Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primary Key Migration Woes #907

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

parsonsmatt
Copy link
Collaborator

This PR tracks #906

Test suite demonstrates problems


Before submitting your PR, check that you've:

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

again <- getMigration migrationAddCol
liftIO $ again @?= []
describe "Add Primary key constraint on raw table" $ do
it "should not be considered safe" $ runDb $ do
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a primary key to a column is definitely not safe, because it's like adding a unique key to a column.

Right migration <- parseMigration addPrimKey
() <- runMigration addPrimKey
again <- getMigration addPrimKey
liftIO $ again @?= []
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently fails on sqlite with:

      src/MigrationTest.hs:68:9: 
      2) Migration, Add Primary key constraint on raw table, works
           uncaught exception: SqliteException
           SQLite3 returned ErrorError while attempting to perform prepare "INSERT INTO \"from_raw_migration_backup\"(\"id\",\"name\",\"age\") SELECT \"id\",\"name\",\"age\" FROM \"from_raw_migration\"": table from_raw_migration_backup has no column named id
    
      To rerun use: --match "/Migration/Add Primary key constraint on raw table/works/"

@parsonsmatt parsonsmatt force-pushed the matt/primary-key-migration-add branch from 37d2d25 to 9bd38ab Compare May 13, 2019 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant