Repository navigation
Conversation
getDisabledVersions strips only the brackets and splits on commas, so a value copied with the quotes keeps them on the first and last entries and those two versions stay enabled.
docs: write the api_disabled_versions example without quotes
The consent reference id migration now fills empty reference ids with the same statement Boot's pre-Schemifier step uses. On Postgres that is an md5 of random input cast to a uuid, which every Postgres version has. gen_random_uuid() exists only from Postgres 13 or with the pgcrypto extension, and Postgres resolves it when it plans the statement, so the migration failed on older versions even when no row needed a new id.
DeduplicateBeforeUniqueIndexTest rebuilds the old shape of the account holder and entitlement tables: no unique index on the natural key, and two rows with the same key. It then runs Boot's pre-Schemifier steps and Schemifier, and checks that the row with the lowest id is kept and the unique index is created.
…eated The step that removes duplicate rows before Schemifier creates a unique index now takes the table and column names from the models. The account holder table is mapperaccountholders and its user column is user_c, so the step found no table under the names written by hand and left the duplicates in place. SQL Server then refused to create the unique index on (user_c, accountbankpermalink, accountpermalink) and the boot stopped.
…eaks it Two users share a user id and two have none. The migration must create the index without removing a user, keep the shared user id on the lowest row id and give the others their own.
The migration that creates the unique index on resourceuser.userid_ now first gives a new user id to each resource user that has none and to each one that shares its user id with a lower row id. No row is removed, and the lowest row id keeps the shared value. Without this, a database holding such rows stopped the boot: every database refuses a repeated value, and SQL Server also refuses a second NULL. The changed rows are written to the migration log.
A System twin and its plain Role, the System and BankLevel variant of a Definition Role, and an old grant whose successor is already stored (as an interrupted run leaves it) all map onto one (bank id, user id, role name). The migration must keep one grant instead of breaking the unique index.
The rename migrations visit Entitlements by id and work out where each one goes. When that key (bank id, user id, role name) is already held, by a grant already under its new name or by an earlier row of the same run, the row is deleted instead of renamed, so the unique index holds and the boot goes on. The user keeps the grant. Keys are compared the way the database compares them, so SQL Server and MySQL ignore case and trailing spaces. Each merged row is listed in the migration log.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This lets an existing, long-lived database boot on the current develop without manual SQL. Before Schemifier creates the new unique indexes, the pre-schemify step removes duplicate account holders and entitlements, using the table and column names taken from the models, so it now finds
mapperaccountholders.user_c.MigrationOfUserIdIndexesgives each resource user its own user id beforeresourceuser.userid_becomes unique.MigrationOfConsentReferenceIdUuidfills consent reference ids withoutgen_random_uuid, so it no longer needs pgcrypto on Postgres.MigrationOfDynamicEntityRoleNamesmerges grants that end up with the same new role name instead of failing on the unique index. The commentedapi_disabled_versionsexample insample.props.templateis now written without quotes.Each fix has a test that builds a database in the broken state and then runs the migration:
DeduplicateBeforeUniqueIndexTest,ResourceUserUserIdUniqueIndexTestandDynamicEntityRoleRenameMigrationTest. With these changes, an existing SQL Server 2017 deployment booted and ran all migrations.