Repository navigation
Conversation
…acy schemas
Databases created from a pre-rewrite baseline cannot complete the migration
chain. 0006 rebuilds `share_links_kind_check` over rows that still hold the
retired `monitor`/`setup` kinds, so the check fails, the transaction rolls back,
and every later migration is left unapplied (35 of them as of 0040).
Rename those rows first (`monitor`→`enroll`, `setup`→`handoff`) and retire them,
matching the rule the backup importer already applies to the same legacy kinds
("import them as inactive enrollment links so their old tokens never regain a
usable public endpoint", `src/console/backup/validate.ts`): the rows were written
for the old page contract, and an old token must not start answering the new one.
Objects introduced by editing `0000_baseline.sql` itself reach no existing
database — the snapshot is already in the ledger, and no later file adds them.
A pre-rewrite database therefore finished the chain while still missing
`telemetry_usage_totals` and the share-key columns on `api_keys`
(`key_mode`, `parent_key_id`, `issued_client_ip`, `issued_client_ip_key`), then
failed its first key lookup with `column "key_mode" does not exist`.
`0041_reconcile_legacy_schema.sql` closes that gap idempotently.
Unused legacy objects (`backup_status`, `console_users.last_login_at`,
`telemetry_payloads.redaction_applied`, four superseded indexes) are left in
place: dropping them is destructive and not required to unblock the upgrade.
Verified against a production dump: chain completes (42 migrations), the
resulting schema matches a fresh database column-for-column, a live completion
succeeds, and data is preserved.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
1 similar comment
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Normalizes the retired share-link kinds before the kind constraint is replaced, and reconciles objects that a pre-rewrite database misses.
Verified by applying the migration chain to a copy of a deployed schema.
Closed by the author.