Skip to content

9.45.0

Choose a tag to compare

@jeremydmiller jeremydmiller released this 12 Oct 21:42
3eb8785

Two fixes for migrations that did the wrong thing to an existing database.

Full upgrade guide: https://weasel.jasperfx.net/release-9-45

Nothing public was removed and no signature changed, but three behaviours did; see the guide's "What changes for you".

db-patch drop files leave untouched schemas alone: #706 / #708

WriteMigrationFileAsync wrote CREATE SCHEMA and, in the drop file, drop schema if exists ... CASCADE for every schema the application knows about. Running that drop file as a rollback destroyed schemas the patch never touched.

  • The patch creates only the schemas of the objects it changes (new SchemaMigration.ChangedSchemas).
  • ⚠️ The drop file never drops a schema. It rolls back each object the patch touched.

Adding and removing primary keys on existing tables: #707 / #708

Reported from Wolverine (JasperFx/wolverine#4989), whose SQL Server queue tables switch between a clustered primary key and a clustered IDENTITY column.

  • ⚠️ PrimaryKeyName is empty for a table without primary key columns, unless set explicitly.
  • SQL Server can add an IDENTITY column to an existing table, drops a removed primary key before creating the new clustered index, and makes a new key's columns NOT NULL first.
  • Removing a primary key no longer writes add CONSTRAINT ... PRIMARY KEY () (SQL Server, PostgreSQL, Oracle).
  • ⚠️ Adding a primary key to an existing table reports PrimaryKeyDifference.Create, and the migration now actually adds it. It used to be a table-level Create that wrote only CREATE TABLE IF NOT EXISTS (SQL Server, PostgreSQL, Oracle).