Skip to content

feat(migrations): support specifying schema for migrations#471

Draft
cofin wants to merge 8 commits into
mainfrom
feat/migration-default-schema
Draft

feat(migrations): support specifying schema for migrations#471
cofin wants to merge 8 commits into
mainfrom
feat/migration-default-schema

Conversation

@cofin
Copy link
Copy Markdown
Member

@cofin cofin commented May 25, 2026

Summary

  • Add migration default_schema and tracker schema resolution through migration config, commands, runners, and utilities.
  • Keep BigQuery on the shared SyncMigrationTracker; remove the custom adapter tracker path.
  • Patch BigQuery SQLGlot DDL rendering so shared tracker SQL emits PRIMARY KEY NOT ENFORCED and orders DEFAULT before NOT NULL.
  • Simplify Oracle migration schema handling to uppercase unquoted schema names and use shared identifier quoting.
  • Gate BigQuery full migration workflow integration tests behind native BigQuery because the emulator rejects column DEFAULT values in tracker DDL.

Validation

  • make install
  • make lint
  • make test (7960 passed, 256 skipped)
  • uv run pytest tests/unit/adapters/test_bigquery/test_migration_schema.py tests/unit/adapters/test_oracledb/test_migration_schema.py -q (8 passed)
  • env SQLSPEC_ENABLE_BIGQUERY_TESTS=1 uv run pytest tests/integration/adapters/bigquery/test_migrations.py -q --run-bigquery-tests (1 passed, 3 skipped on emulator)
  • make coverage was attempted after make test; it produced broad integration failures and then hung during teardown, so I terminated it without a final coverage report.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 25, 2026

Codecov Report

❌ Patch coverage is 94.27609% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.02%. Comparing base (6f91042) to head (b9d3ad2).

Files with missing lines Patch % Lines
sqlspec/adapters/bigquery/driver.py 72.72% 7 Missing and 2 partials ⚠️
sqlspec/migrations/runner.py 77.77% 3 Missing and 3 partials ⚠️
sqlspec/adapters/bigquery/core.py 96.42% 0 Missing and 1 partial ⚠️
sqlspec/adapters/oracledb/migrations.py 93.75% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #471      +/-   ##
==========================================
+ Coverage   70.78%   71.02%   +0.24%     
==========================================
  Files         438      438              
  Lines       52541    52829     +288     
  Branches     7370     7408      +38     
==========================================
+ Hits        37189    37524     +335     
+ Misses      12682    12656      -26     
+ Partials     2670     2649      -21     
Flag Coverage Δ
integration 56.74% <75.75%> (+0.14%) ⬆️
py3.10 68.10% <93.93%> (+0.25%) ⬆️
py3.11 68.12% <93.93%> (+0.25%) ⬆️
py3.12 68.12% <93.93%> (+0.25%) ⬆️
py3.13 68.11% <93.93%> (+0.24%) ⬆️
py3.14 70.20% <93.85%> (+0.24%) ⬆️
unit 57.89% <90.23%> (+0.44%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cofin cofin force-pushed the feat/migration-default-schema branch from ec9e0c8 to b9d3ad2 Compare May 25, 2026 23:39
@cofin cofin changed the title feat: add migration default schema support feat(migrations): support specifying schema for migrations May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants