Make migrations idempotent where possible
The database migrations use data definition commands (
ALTER TABLE, etc) that H2 commits automatically as soon as they're executed, even though we execute the commands within a transaction. If a crash happens during a migration, the DB may be left in a state where the migration has been partially applied. If the data definition commands aren't idempotent then subsequent attempts to apply the migration will fail, making it impossible to complete the migration and open the DB.
Where possible we should use data definition commands that are idempotent. For example,
DELETE COLUMN should be
DELETE COLUMN IF EXISTS,
CREATE COLUMN should be
CREATE COLUMN IF NOT EXISTS, etc.