Migration with the REPL

Every time the REPL starts a new session it compares the current database schema with the set of Delia types in the session. If the schema matches the types, then the REPL executes the Delia source file that you specified.

However, if the schema does not match the types, Delia needs to update the database schema, which is callled a migration. See Migration. Most migrations are considered “low-risk” and are performed automatically.

If the migration may cause data loss in the database then Delia will halt. You can use the REPL to review and possibly modify the migration plan, and then run it.

Manually Deleting Tables

When a migration involves deleting a database table, Delia instead simply renames the table to tableName__BAK, such as “CUSTOMER__BAK”. This allows you to still have access to the data in the table later if needed.

However, if there already is a tableName__BAK table then the Delia will halt. You must manually delete the table (or rename to another name), and then re-run the migration.

The REPL command “db table delete” can be used to delete the table.

myproject> db table delete Customer__BAK

Deleting tables is permanent. Be careful!