O'Reilly logo

Haskell Cookbook by Yogesh Sajanikar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

In this recipe, we ran the migration against an empty database, and the migration created the schema from the scratch. When we modified the model, and ran the migration against the existing ship.db database, the migration detected the change, and created the migration script. It is a better idea to print the migration than run the migration. It would give a chance to rectify any errors in the migration.

In fact, in the example that we have seen, we have added an extra reference to Asset as a foreign key in Structure and Compartment. This would create a problem during migration, as we will not have reference to an asset in the old data.

As the recipe is being written, using the runMigration function against the SQLite database ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required