What's changed
Cloned schemas keep their unique constraints' names (#1292)
clone_schema() renames the indexes that CREATE TABLE ... (LIKE ... INCLUDING ALL) copies back to their source's names, but it skipped the indexes behind unique constraints. Every cloned schema's unique constraints therefore had Postgres-generated names, not the source's. A later migration that drops one of them by name (RemoveConstraint, or a UniqueConstraint removed from Meta.constraints) failed on cloned tenants only, with constraint ... does not exist.
- A clone's unique constraints now carry their source's names.
- Copied indexes are now paired with the source's by the kind of constraint they back (primary key, unique, exclusion or none) as well as by definition. A unique constraint and a separate unique index on the same columns, or a primary key and a unique constraint on one column, can no longer swap names.
Upgrade note: this applies to new clones only. Tenants cloned with an earlier version keep the generated names, so a migration that drops one of those constraints by name will still fail on them. Rename them to their source's names (ALTER INDEX ... RENAME TO ..., which renames the constraint too) before running such a migration.
Schema names in tenant commands (#1290)
--schemaon the command line is now only ever an exact schema name. A number was previously read as a position in the tenant list, so with a tenant named1,--schema 1picked a different tenant.- Interactively, an exact name always wins. Picking by position from the
?list still works, but only when no tenant's schema name is a number. The?list is now ordered by primary key. - The subprocess migration executor passes
--schema=<name>as one argument, so a schema name starting with-is no longer read as an option. - New schema names can't start with
-. Existing tenants with such names keep working.
Full changelog: v4.0.7...v4.1.0