What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

I have an interesting issue. @SprykerDevs In our project sometimes during deployments we get unexpec

UKLUVKWEB
UKLUVKWEB Posts: 18 πŸ§‘πŸ»β€πŸš€ - Cadet
edited May 2020 in Help

I have an interesting issue. @SprykerDevs
In our project sometimes during deployments we get unexpected Propel migration failures.

Executing migration PropelMigration_xxxxx up
Propel\Runtime\Exception\RuntimeException - Exception: Failed to execute SQL "CREATE SEQUENCE "spy_product_set_storage_pk_seq"". Aborting migration.

In such case somebody should login to DB and manually delete the culprit sequences and re-run the deployment, after that it works.
However, it is very annoying.
Does anybody also getting these errors? What could be the automatic workaround for such cases?

Comments

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited May 2020
    1. do you run propel:migration:delete before propel:install ?
  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet
    1. if that fails, opening the migration and running the problematic query directly. it will help understand why it fails
  • UKLUVKWEB
    UKLUVKWEB Posts: 18 πŸ§‘πŸ»β€πŸš€ - Cadet

    It fails cause the sequence already exists, but somehow it is being automatically generated into the migration file..

  • UKLUVKWEB
    UKLUVKWEB Posts: 18 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited May 2020

    As I wrote, when you manually delete the sequence, the same migration runs without errors. So I suppose that the issue is that propel:diff adds the sequence creation when it should not to.

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    πŸ€” from what I see in my migrations, the sequence is always dropped at the end of migration, (otherwise migrations fails) is there that DROP in all your migrations?

  • UKLUVKWEB
    UKLUVKWEB Posts: 18 πŸ§‘πŸ»β€πŸš€ - Cadet

    The thing is that they are auto-generated and the process fails. We do not modify migrations. Standard process seems to be corrupted in some cases.

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    except that's not what I've been asking about πŸ™‚

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    but in case your migrations DO have the DROP and they didn't drop earlier, then it means someone performed migrtation that broke in the middle

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    and that could only happen when some other table failed due to implementation of NOT NULL column which has rows already and which need to be fixed manually before starting the migration

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    either way, I see no other reason for DROP to not be run, the one I mention already happend to us multiple times

  • UKLUVKWEB
    UKLUVKWEB Posts: 18 πŸ§‘πŸ»β€πŸš€ - Cadet

    Thanks, will have in mind your mentioned cases πŸ‘

  • giovanni.piemontese
    giovanni.piemontese Technical Lead @ LΓΆffelhardt Spryker Solution Partner Posts: 871 πŸ§‘πŸ»β€πŸš€ - Cadet

    can u please post here the name of sequence?
    i had a similar case and the problem was the length of sequence name (the same is for fk and index length)... then propel migration has every time dropped and inserted again and every time.. because there is a max length of name for index, fks and maybe also for sequence.

  • UKLUVKWEB
    UKLUVKWEB Posts: 18 πŸ§‘πŸ»β€πŸš€ - Cadet

    These:

    spy_product_concrete_storage_pk_seq
    spy_product_set_storage_pk_seq
    spy_product_abstract_storage_pk_seq
    
  • giovanni.piemontese
    giovanni.piemontese Technical Lead @ LΓΆffelhardt Spryker Solution Partner Posts: 871 πŸ§‘πŸ»β€πŸš€ - Cadet

    OK, then is not problem related the length... it is smth else...

    Did u ckecked if these seq are maybe defined in different schema namespace?

  • UKLUVKWEB
    UKLUVKWEB Posts: 18 πŸ§‘πŸ»β€πŸš€ - Cadet

    I think propel just can't deal with sequence diffs properly. No ideas how.