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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access