feat(migrations)!: ship SQL migrations applied like runMigrations - #27
Conversation
TheGreatAxios
left a comment
There was a problem hiding this comment.
Reviewed the commit. 0001's shape matches old migrations 0001-0005: timestamptz columns, NOT NULL tenant_id, the four CHECKs, metadata and digest columns. The FK rewrite regex is the same one Interchange's rewriteSchemaQualifiedReferences uses. The lock key is unchanged, the package tarball ships migrations/, and the upgrade path was exercised against a database migrated on main. No blocking findings.
1e82d2a to
e18a59d
Compare
|
Follow-up pushed: the reference host exposes its |
8e398f7 to
0744ced
Compare
runArtifactMigrations now takes the same (config, { schema }) arguments
as @intx/db's runMigrations and applies the idempotent SQL files under
migrations/, rewriting the "public". foreign-key references to the host
schema that holds tenant and principal. The package's own tables stay in
the artifacts schema. One advisory-locked transaction still serializes
concurrent boots.
The embedded TypeScript DDL, the checksum ledger, the adopt path and
their errors are gone. 0001 creates the final 0.1.0 shape, so a database
0.1.0 migrated no-ops, and 0002 drops the old ledger table.
0744ced to
00fce3a
Compare
Summary
runArtifactMigrations(config, { schema })takes the same arguments as@intx/db'srunMigrations.schemais the host schema that holdstenantandprincipal. The package's tables stay inartifacts, and the"public".FK references are rewritten toschema.migrations/, included infiles.0001_artifacts.sqlcreates the final 0.1.0 shape.0002_drop_migration_ledger.sqldrops the oldartifacts.migrationsledger.adopt,RunArtifactMigrationsOptions,MigrationChecksumErrorandMigrationAdoptErrorare removed. The run is still one transaction behind the same advisory lock key, so old and new replicas serialize during a rolling deploy.migrations.test.tsis cut to the runner contract: exact table set, re-run no-op, concurrent cold boots, FKs aimed at the host schema, the constraints, and the pre-0.1.0 column upgrade.metadata,content_sha256andparent_version_idsare added withADD COLUMN IF NOT EXISTS, and any column inartifactsstill typedtimestampbecomestimestamptz(read as UTC, as 0.1.0 did). A current database is untouched.Verification
migrations/*.sql, andrunArtifactMigrationsruns from a plain Node 24 consumer.Closes CL-9060
Closes CL-9062