Skip to content

Add the 1.x to 2.0 migration script - #45

Merged
nicoloesch merged 5 commits into
mainfrom
40-migration-script-v2
Nov 18, 2026
Merged

nicoloesch merged 5 commits into
mainfrom
40-migration-script-v2

Conversation

@nicoloesch

Copy link
Copy Markdown
Collaborator

Summary

Replaces the migrations/to_v2.py placeholder with the real script. It upgrades a 1.x stack to 2.0 without touching data. It is a dry run by default and --apply makes the changes.

Script

  • Config
    • schema_name becomes cdm_schema on PostgreSQL ("omop" if absent) and is removed on SQLite
    • Comments are kept
    • The result is validated against the 2.0 StackConfig before writing
    • --rename OLD=NEW renames [databases.*] entries, their vector store references and their registry rows
  • Schema registry
    • Records a baseline for every populated database and role
    • A separate vocab connection gets its own baseline
    • A registry with the pre-release connection_key layout is reconciled and rebuilt
  • omop-emb registries
    • Moves each legacy model_registry into the 2.0 registry
    • storage_identifier is unchanged and provider names are lowercased
    • The old table is renamed to model_registry_legacy_v1, not dropped
  • Safety
    • Stops without changes on a legacy registry in a schema the store does not own, the same model in more than one registry, or a NULL provider_type
    • --apply backs up the config and affected SQLite files first
    • Re-running is a no-op and an interrupted run resumes
  • Verify
    • Opens each CDM engine and vector store read-only and prints OK or FAIL

Docs and messages

  • docs/upgrading-from-1.x.md
    • Promotes the script and keeps the manual steps as the alternative
    • Removes the omop-emb "no manual path" warning
  • Legacy schema_name error
    • Points to the script
    • Test updated

Testing

  • Run manually against scratch SQLite and PostgreSQL databases: dry run, apply, rename, interrupted run, conflicts and a second apply
  • No automated tests for the script

@nicoloesch nicoloesch added the chore Maintenance, refactoring, or housekeeping. Excluded from changelog, no version bump. label Oct 16, 2026
@gkennos
gkennos self-requested a review November 16, 2026 23:04
Comment thread migrations/to_v2.py Resolved
Comment thread migrations/to_v2.py Resolved
@nicoloesch
nicoloesch requested a review from gkennos November 17, 2026 00:11
@nicoloesch
nicoloesch merged commit 129b37c into main Nov 18, 2026
6 checks passed
@nicoloesch
nicoloesch deleted the 40-migration-script-v2 branch November 18, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, refactoring, or housekeeping. Excluded from changelog, no version bump.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add the 1.x to 2.0 migration script (migrations/to_v2.py)

2 participants