@vibeorm/migrate 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adoption.d.ts.map +1 -1
- package/dist/baseline-record.d.ts +14 -0
- package/dist/baseline-record.d.ts.map +1 -0
- package/dist/baseline.d.ts +31 -0
- package/dist/baseline.d.ts.map +1 -0
- package/dist/compare-reference-rls.d.ts +10 -0
- package/dist/compare-reference-rls.d.ts.map +1 -0
- package/dist/compare-sqlite-primary-key.d.ts +6 -0
- package/dist/compare-sqlite-primary-key.d.ts.map +1 -0
- package/dist/desired-state.d.ts.map +1 -1
- package/dist/fs.js +636 -392
- package/dist/fs.js.map +14 -11
- package/dist/index.d.ts +12 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6322 -5092
- package/dist/index.js.map +46 -33
- package/dist/inspect-objects.d.ts +8 -1
- package/dist/inspect-objects.d.ts.map +1 -1
- package/dist/introspect/postgres.d.ts.map +1 -1
- package/dist/module-history.d.ts +6 -0
- package/dist/module-history.d.ts.map +1 -1
- package/dist/module-ownership.d.ts +8 -0
- package/dist/module-ownership.d.ts.map +1 -1
- package/dist/module-pending.d.ts +2 -0
- package/dist/module-pending.d.ts.map +1 -1
- package/dist/mysql-catalog-visibility.d.ts +5 -0
- package/dist/mysql-catalog-visibility.d.ts.map +1 -0
- package/dist/planner.d.ts +5 -0
- package/dist/planner.d.ts.map +1 -1
- package/dist/postgres-type-identity.d.ts +15 -0
- package/dist/postgres-type-identity.d.ts.map +1 -0
- package/dist/postgres-types.d.ts +5 -0
- package/dist/postgres-types.d.ts.map +1 -1
- package/dist/reference-state.d.ts.map +1 -1
- package/dist/replay-objects.d.ts +10 -0
- package/dist/replay-objects.d.ts.map +1 -0
- package/dist/replay-plan.d.ts +28 -0
- package/dist/replay-plan.d.ts.map +1 -0
- package/dist/replay-reference.d.ts +18 -0
- package/dist/replay-reference.d.ts.map +1 -0
- package/dist/runner.d.ts +6 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/shadow-dedicated.d.ts +12 -0
- package/dist/shadow-dedicated.d.ts.map +1 -0
- package/dist/shadow-guard.d.ts +13 -0
- package/dist/shadow-guard.d.ts.map +1 -0
- package/dist/shadow-types.d.ts +52 -0
- package/dist/shadow-types.d.ts.map +1 -0
- package/dist/shadow.d.ts +17 -0
- package/dist/shadow.d.ts.map +1 -0
- package/dist/verify-history.d.ts +35 -0
- package/dist/verify-history.d.ts.map +1 -0
- package/package.json +3 -3
package/dist/index.js.map
CHANGED
|
@@ -1,59 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/
|
|
3
|
+
"sources": ["../src/shadow.ts", "../src/migration-checksum.ts", "../src/execution.ts", "../src/desired-state.ts", "../src/mysql-catalog-visibility.ts", "../src/module-ownership.ts", "../src/object-ownership.ts", "../src/normalize.ts", "../src/relations.ts", "../src/postgres-types.ts", "../src/sqlite-types.ts", "../src/enum-values.ts", "../src/mysql-types.ts", "../src/inventory.ts", "../src/exclusions.ts", "../src/inspect-objects.ts", "../src/introspect/postgres.ts", "../src/journal-table.ts", "../src/introspect/shared.ts", "../src/postgres-type-identity.ts", "../src/introspect/postgres-rls.ts", "../src/ddl/rls.ts", "../src/introspect/mysql.ts", "../src/introspect/sqlite.ts", "../src/execute.ts", "../src/postgres-default-equivalence.ts", "../src/sql-statements.ts", "../src/module-origin.ts", "../src/shadow-guard.ts", "../src/module-history.ts", "../src/module-journal.ts", "../src/journal-read.ts", "../src/runner.ts", "../src/recovery.ts", "../src/differ.ts", "../src/renames.ts", "../src/ddl/render.ts", "../src/ddl/postgres.ts", "../src/ddl/sqlite.ts", "../src/ddl/drop-order.ts", "../src/types.ts", "../src/ddl/mysql.ts", "../src/extensions.ts", "../src/replay-reference.ts", "../src/shadow-dedicated.ts", "../src/replay-objects.ts", "../src/replay-plan.ts", "../src/planner.ts", "../src/baseline.ts", "../src/reference-state.ts", "../src/compile-desired-state.ts", "../src/verify-history.ts", "../src/compare-sqlite-primary-key.ts", "../src/compare-reference-rls.ts", "../src/baseline-record.ts", "../src/history.ts", "../src/down.ts", "../src/push.ts", "../src/module-export.ts", "../src/module-bundle.ts", "../src/module-pending.ts", "../src/module-readiness.ts", "../src/adoption.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * Public types of @vibeorm/migrate: the executor contract, the dialect-neutral\n * migration step model, and the runner's file/result shapes.\n *\n * Steps carry Schema-IR fragments (FieldIR, EnumIR) — never SQL text. SQL is\n * produced exclusively by the per-dialect renderers (ddl-postgres.ts), so every\n * SQL-text decision stays reviewable in one place (constitution rule 3/4).\n */\n\nimport type { CascadeAction, CheckIR, Dialect, EnumIR, FieldIR, SchemaIR } from \"@vibeorm/schema\";\nimport type { ExclusionIR } from \"@vibeorm/schema\";\nimport type { MigrationExecution } from \"./execution.ts\";\nimport type { DesiredState, MigrationDesiredState } from \"./desired-state.ts\";\nimport type { MigrationObjectState } from \"./inspect-objects.ts\";\nimport type { SqlObjectIdentity } from \"@vibeorm/schema\";\n\n// ─── Executor ─────────────────────────────────────────────────────\n\n/**\n * Minimal SQL execution contract the migrate engine runs on. Structurally\n * identical to @vibeorm/runtime's `SqlExecutor` (its `toSqlExecutor` bridges a\n * DatabaseAdapter to this shape) — declared here so the dependency direction\n * stays schema ← sql ← migrate.\n *\n * SESSION AFFINITY: the migrate engine issues session-scoped statements\n * through this contract (BEGIN/COMMIT, `PRAGMA foreign_keys`, advisory locks\n * `pg_advisory_lock` / `GET_LOCK`), so every call MUST hit the same database\n * session. Single-connection adapters (pglite, sqlite) satisfy this by\n * construction; pool-backed executors must pin one connection for the whole\n * migrate operation.\n */\nexport type SqlExecutor = ((params: {\n text: string;\n values?: unknown[];\n}) => Promise<Record<string, unknown>[]>) & {\n /** Reserve one session before lock acquisition; its callback receives a pinned executor. */\n readonly withSession?: <T>(params: { run: (executor: SqlExecutor) => Promise<T> }) => Promise<T>;\n};\n\n// ─── Step building blocks ─────────────────────────────────────────\n\n/** Which aspects of a column an `alterColumn` step changes. */\nexport type AlterColumnAspect = \"type\" | \"nullability\" | \"default\" | \"collation\";\n\n/** One column of an index, with its sort direction. */\nexport type IndexColumn = {\n readonly name: string;\n readonly desc: boolean;\n /**\n * The field is a Decimal (SQLITE-2, SQL review round 2). Inert everywhere\n * except the sqlite DDL renderer: Decimal stores as TEXT there and every\n * compare/order site reads `CAST(col AS REAL)` (B4), which a plain-column\n * index can never serve (EQP-proven SCAN) — sqlite renders an EXPRESSION\n * index over the same cast instead. Not part of the index comparison key:\n * both sides compare by column name + direction.\n */\n readonly decimal?: boolean;\n};\n\n/** One side of an implicit many-to-many join table. */\nexport type JoinTableEnd = {\n /** Referenced table (db name). */\n readonly table: string;\n /** Referenced primary-key column (db name). */\n readonly column: string;\n /** The referenced primary-key field — its type renders the join column's type. */\n readonly field: FieldIR;\n};\n\n// ─── Steps ────────────────────────────────────────────────────────\n\n/**\n * A dialect-neutral migration step produced by `diffSchemas`. `destructive`\n * marks steps that can lose data (dropTable / dropJoinTable / dropColumn /\n * dropEnum / narrowing type changes) — `push` refuses them without\n * `acceptDataLoss`, and `generateMigration` surfaces the flag.\n */\nexport type MigrationStep = (\n | { readonly kind: \"addExclusion\" | \"dropExclusion\"; readonly table: string; readonly exclusion: ExclusionIR; readonly destructive: false }\n | {\n readonly kind: \"enableRls\" | \"forceRls\" | \"disableRls\" | \"noForceRls\" | \"dropPolicy\";\n readonly table: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"createPolicy\";\n readonly table: string;\n readonly schema: SchemaIR;\n readonly model: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"createEnum\";\n readonly enumDef: EnumIR;\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropEnum\";\n readonly enumName: string;\n readonly destructive: true;\n }\n | {\n readonly kind: \"addEnumValue\";\n readonly enumName: string;\n readonly value: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"createTable\";\n readonly table: string;\n readonly columns: readonly FieldIR[];\n /** Primary-key column db names (empty = no PK). */\n readonly primaryKey: readonly string[];\n readonly primaryKeyConstraintName?: string;\n /** Named CHECK constraints, rendered into the CREATE TABLE. */\n readonly checks?: readonly CheckIR[];\n readonly destructive: false;\n }\n | {\n readonly kind: \"addCheck\";\n readonly table: string;\n readonly name: string;\n /** Raw SQL expression, rendered verbatim. */\n readonly expression: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropCheck\";\n readonly table: string;\n readonly name: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropTable\";\n readonly table: string;\n readonly destructive: true;\n }\n | {\n readonly kind: \"addColumn\";\n readonly table: string;\n readonly column: FieldIR;\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropColumn\";\n readonly table: string;\n readonly column: string;\n readonly destructive: true;\n }\n | {\n readonly kind: \"alterColumn\";\n readonly table: string;\n /** Column db name. */\n readonly column: string;\n readonly from: FieldIR;\n readonly to: FieldIR;\n readonly changes: readonly AlterColumnAspect[];\n readonly destructive: boolean;\n }\n | {\n readonly kind: \"createIndex\";\n readonly table: string;\n readonly name: string;\n /** IR index kind (\"btree\", \"gin\", …) — `unique` indexes are always btree. */\n readonly indexKind: string;\n readonly unique: boolean;\n readonly columns: readonly IndexColumn[];\n /** Partial-index predicate, raw SQL. */\n readonly where?: string;\n /** `UNIQUE NULLS NOT DISTINCT` (postgres 15+; sqlite/mysql renderers refuse). */\n readonly nullsNotDistinct?: boolean;\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropIndex\";\n readonly name: string;\n /** PostgreSQL unique-constraint backing indexes are dropped via their owner. */\n readonly constraintName?: string;\n /**\n * Table the index belongs to. Optional for postgres/sqlite (their DROP\n * INDEX is schema-global) but REQUIRED by the mysql renderer\n * (`DROP INDEX … ON table`); the differ always fills it.\n */\n readonly table?: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"addForeignKey\";\n readonly table: string;\n readonly constraintName: string;\n readonly columns: readonly string[];\n readonly refTable: string;\n readonly refColumns: readonly string[];\n readonly onDelete: CascadeAction;\n readonly onUpdate: CascadeAction;\n readonly destructive: false;\n }\n | {\n /**\n * Stage a foreign key without validating existing rows (postgres\n * `NOT VALID`). Skips the scan, NOT the brief ACCESS EXCLUSIVE lock;\n * `validateConstraint` finishes the job under a weaker lock. sqlite and\n * mysql have no such split and refuse this step.\n */\n readonly kind: \"addForeignKeyNotValid\";\n readonly table: string;\n readonly constraintName: string;\n readonly columns: readonly string[];\n readonly refTable: string;\n readonly refColumns: readonly string[];\n readonly onDelete: CascadeAction;\n readonly onUpdate: CascadeAction;\n readonly destructive: false;\n }\n | {\n /** Stage a CHECK without validating existing rows (postgres `NOT VALID`). */\n readonly kind: \"addCheckNotValid\";\n readonly table: string;\n readonly name: string;\n /** Raw SQL expression, rendered verbatim. */\n readonly expression: string;\n readonly destructive: false;\n }\n | {\n /** Validate a previously staged NOT VALID constraint (postgres only). */\n readonly kind: \"validateConstraint\";\n readonly table: string;\n readonly name: string;\n readonly destructive: false;\n }\n | {\n /**\n * Rename a physical table, preserving its rows, defaults, indexes and\n * inbound foreign keys. Only ever produced from an EXPLICIT rename\n * intent (renames.ts) — never inferred from a drop/create pair.\n */\n readonly kind: \"renameTable\";\n readonly from: string;\n readonly to: string;\n readonly destructive: false;\n }\n | {\n /** Rename a physical column, preserving its data, default and indexes. */\n readonly kind: \"renameColumn\";\n readonly table: string;\n readonly from: string;\n readonly to: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropForeignKey\";\n readonly table: string;\n readonly constraintName: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"createJoinTable\";\n readonly table: string;\n readonly a: JoinTableEnd;\n readonly b: JoinTableEnd;\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropJoinTable\";\n readonly table: string;\n readonly destructive: true;\n }\n | {\n readonly kind: \"addPrimaryKey\";\n readonly table: string;\n readonly constraintName?: string;\n readonly columns: readonly string[];\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropPrimaryKey\";\n readonly table: string;\n readonly constraintName?: string;\n readonly destructive: false;\n }\n | {\n /**\n * Drop a view present in the live database but absent from the target\n * schema (board #26). Ordered FIRST — postgres refuses dropping a column\n * a leftover view depends on (2BP01), so removed views must go before\n * the table/column changes they block. Destructive: the view definition\n * is not stored in the IR, so the drop cannot be reversed.\n */\n readonly kind: \"dropView\";\n /** View db name. */\n readonly table: string;\n readonly destructive: true;\n }\n) & {\n /** Separate from data loss: a removal or potentially widening policy replacement. */\n readonly securityChange?: string;\n};\n\n/** One-line human description of a step (refusal messages, CLI output). */\nexport function describeStep(params: { step: MigrationStep }): string {\n const { step } = params;\n switch (step.kind) {\n case \"addExclusion\": return `add exclusion \"${step.exclusion.name}\" on \"${step.table}\"`;\n case \"dropExclusion\": return `drop exclusion \"${step.exclusion.name}\" on \"${step.table}\"`;\n case \"enableRls\": return `enable native RLS on \"${step.table}\"`;\n case \"forceRls\": return `force native RLS on \"${step.table}\"`;\n case \"disableRls\": return `disable native RLS on \"${step.table}\"`;\n case \"noForceRls\": return `remove forced native RLS on \"${step.table}\"`;\n case \"createPolicy\": return `create native RLS policy on \"${step.table}\"`;\n case \"dropPolicy\": return `drop native RLS policy on \"${step.table}\"`;\n case \"createEnum\":\n return `create enum \"${step.enumDef.dbName ?? step.enumDef.name}\"`;\n case \"dropEnum\":\n return `drop enum \"${step.enumName}\"`;\n case \"addEnumValue\":\n return `add value \"${step.value}\" to enum \"${step.enumName}\"`;\n case \"createTable\":\n return `create table \"${step.table}\"`;\n case \"dropTable\":\n return `drop table \"${step.table}\"`;\n case \"addColumn\":\n return `add column \"${step.table}\".\"${step.column.dbName ?? step.column.name}\"`;\n case \"dropColumn\":\n return `drop column \"${step.table}\".\"${step.column}\"`;\n case \"alterColumn\":\n return `alter column \"${step.table}\".\"${step.column}\" (${step.changes.join(\", \")})`;\n case \"createIndex\":\n return `create ${step.unique ? \"unique \" : \"\"}index \"${step.name}\" on \"${step.table}\"`;\n case \"addCheck\":\n return `add check \"${step.name}\" on \"${step.table}\"`;\n case \"dropCheck\":\n return `drop check \"${step.name}\" on \"${step.table}\"`;\n case \"dropIndex\":\n return `drop index \"${step.name}\"`;\n case \"addForeignKey\":\n return `add foreign key \"${step.constraintName}\" on \"${step.table}\"`;\n case \"addForeignKeyNotValid\":\n return `add foreign key \"${step.constraintName}\" on \"${step.table}\" (NOT VALID)`;\n case \"addCheckNotValid\":\n return `add check \"${step.name}\" on \"${step.table}\" (NOT VALID)`;\n case \"validateConstraint\":\n return `validate constraint \"${step.name}\" on \"${step.table}\"`;\n case \"renameTable\":\n return `rename table \"${step.from}\" to \"${step.to}\"`;\n case \"renameColumn\":\n return `rename column \"${step.table}\".\"${step.from}\" to \"${step.to}\"`;\n case \"dropForeignKey\":\n return `drop foreign key \"${step.constraintName}\" on \"${step.table}\"`;\n case \"createJoinTable\":\n return `create join table \"${step.table}\"`;\n case \"dropJoinTable\":\n return `drop join table \"${step.table}\"`;\n case \"addPrimaryKey\":\n return `add primary key on \"${step.table}\"`;\n case \"dropPrimaryKey\":\n return `drop primary key on \"${step.table}\"`;\n case \"dropView\":\n return `drop view \"${step.table}\"`;\n }\n}\n\n// ─── Runner shapes ────────────────────────────────────────────────\n\n/** A named migration: ordered SQL statements plus its aggregate destructiveness. */\nexport type MigrationFile = {\n /** Immutable package origin; absent preserves historical checksum rules. */\n readonly moduleOrigin?: import(\"./module-origin.ts\").ModuleMigrationOrigin;\n /** Reviewed desired state, checksum-bound for new migrations only. */\n readonly desiredState?: MigrationDesiredState;\n /** Offline --empty shell: cannot execute or establish trusted desired state until finalized. */\n readonly desiredStatePending?: true;\n readonly name: string;\n /** One SQL string per statement, in execution order. */\n readonly sql: readonly string[];\n /** True when any underlying step can lose data. */\n readonly destructive: boolean;\n /**\n * Reverse statements (`down.sql`), when the migration carries them.\n * Migrations generated before down-migration support have none —\n * `rollbackMigration` refuses those with a clear error.\n */\n readonly downSql?: readonly string[];\n /** Security changes are not authorized by an ordinary data-loss acknowledgement. */\n readonly securityChanges?: readonly string[];\n readonly downSecurityChanges?: readonly string[];\n /** Trusted source declarations used for drift preflight on generated migrations. */\n readonly rls?: { readonly from: SchemaIR; readonly to: SchemaIR };\n /**\n * Explicit execution semantics (transaction mode, migration-owned session\n * limits, declared per-statement operations). ABSENT means the dialect's\n * existing behaviour, and hashes exactly as it always did — see\n * execution.ts's checksum-compatibility rule.\n */\n readonly execution?: MigrationExecution;\n /** Execution semantics of `downSql`; absent means the dialect's existing behaviour. */\n readonly downExecution?: MigrationExecution;\n};\n\n/** Subset preserves programmatic calls; complete requires an ordered full chain. */\nexport type MigrationHistoryMode = \"subset\" | \"complete\";\n\n/** Pure replay validation before an operation such as reset destroys the database. */\nexport type MigrationReplayOptions = {\n readonly migrations: readonly MigrationFile[];\n readonly dialect?: Dialect;\n readonly acceptSecurityChanges?: boolean;\n readonly acceptIntegrityLoss?: boolean;\n readonly removeUnmanaged?: readonly SqlObjectIdentity[];\n readonly probe?: \"none\" | \"rollback\" | \"temporary\";\n};\n\n/** Result of a lock-held rollback selection and execution. */\nexport type RollbackResult = { readonly rolledBack: readonly string[] };\n\n/** Result of `applyMigrations`. */\nexport type AppliedResult = {\n /** Migrations executed by this call, in order. */\n readonly applied: readonly string[];\n /** Migrations already recorded and verified, skipped. */\n readonly skipped: readonly string[];\n};\n\n/** Result of `migrationStatus`. */\nexport type MigrationStatus = {\n /** Journal rows with no supplied file; omitted when empty for compatibility. */\n readonly unknownFiles?: readonly string[];\n /** Recorded migrations whose checksum matches. */\n readonly applied: readonly string[];\n /** Migrations with no record yet. */\n readonly pending: readonly string[];\n /** Recorded migrations whose checksum no longer matches their SQL. */\n readonly mismatched: readonly string[];\n /**\n * Migrations whose rollback started but did not finish (mysql only — its\n * DDL is non-transactional, so `rollbackMigration` records per-statement\n * progress). Re-run the rollback to resume, or repair with\n * `resolveMigration`.\n */\n readonly rollingBack: readonly string[];\n};\n\n/**\n * How one bookkeeping row stands against the migration file of the same name.\n * `unknown-file` is a recorded migration whose file is missing from the\n * migrations directory — history the tool cannot reverse.\n */\nexport type RecordedMigrationState =\n | \"applied\"\n | \"partial\"\n | \"mismatched\"\n | \"rolling-back\"\n | \"unknown-file\";\n\n/** One row of the `_vibe_migrations` journal, in the order it was written. */\nexport type RecordedMigration = {\n readonly name: string;\n /** Recorded checksum; empty for a `resolveMigration` repair record. */\n readonly checksum: string;\n /** Statements completed; NEGATIVE (-(k+1)) marks an unfinished rollback. */\n readonly statementIndex: number;\n readonly state: RecordedMigrationState;\n};\n\n/** Result of `push`. */\nexport type PushResult = {\n readonly objects?: readonly MigrationObjectState[];\n readonly blocked?: boolean;\n readonly unmanagedRemovals?: readonly SqlObjectIdentity[];\n readonly desiredState?: DesiredState;\n /** The diff that was applied (empty = database already matched). */\n readonly steps: readonly MigrationStep[];\n /** The SQL statements that were executed, in order. */\n readonly applied: readonly string[];\n /** Dry-run statements, never executed. */\n readonly planned?: readonly string[];\n readonly securityChanges?: readonly string[];\n};\n",
|
|
6
|
-
"/**\n * IR-vs-IR schema differ → dialect-neutral migration steps.\n *\n * The contract that matters most: `diffSchemas({ from: introspect(push(X)),\n * to: X })` is EMPTY — both sides normalize through normalize.ts before\n * comparison, so representation differences (implicit list sides vs explicit\n * M2M fields, `@unique` vs `@@unique`, app-level defaults, cascade-action\n * defaults) never produce phantom steps and `db push` twice is a no-op.\n *\n * No rename detection (v1 parity): a renamed table/column diffs as drop +\n * create. Removing a value from a surviving enum throws\n * VIBE_UNSUPPORTED_CAPABILITY — postgres cannot drop enum values without a\n * manual type rebuild, and silence would be dialect dishonesty.\n */\n\nimport { isEnumType, unsupportedCapability } from \"@vibeorm/schema\";\nimport { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect, EnumIR, SchemaIR } from \"@vibeorm/schema\";\nimport { assertEnumStringTransition, isEnumStringTransition, resolveEnumValues } from \"./enum-values.ts\";\nimport { assertStringEnumLabelsFit, normalizeSchema } from \"./normalize.ts\";\nimport type { NormalizedSchema, NormalizedTable } from \"./normalize.ts\";\nimport { isScalarToArrayChange } from \"./postgres-types.ts\";\nimport { assertRlsDialect, withRlsSteps } from \"./ddl/rls.ts\";\nimport { planRenames } from \"./renames.ts\";\nimport type { RenameIntent } from \"./renames.ts\";\nimport type { AlterColumnAspect, MigrationStep } from \"./types.ts\";\n\n// ─── Ordered step buckets ─────────────────────────────────────────\n\n/**\n * Steps are emitted in dependency-safe buckets: view drops first of all (a\n * leftover view blocks dropping any column it references — postgres 2BP01,\n * board #26), enums next (columns reference the types), FK/index drops before\n * the objects they attach to disappear, table creates before the\n * FKs/indexes/join tables that need them, enum drops last (after every column\n * using the type is gone).\n */\ntype StepBuckets = {\n dropExclusion: MigrationStep[];\n addExclusion: MigrationStep[];\n dropView: MigrationStep[];\n createEnum: MigrationStep[];\n addEnumValue: MigrationStep[];\n dropForeignKey: MigrationStep[];\n dropIndex: MigrationStep[];\n dropJoinTable: MigrationStep[];\n dropTable: MigrationStep[];\n createTable: MigrationStep[];\n addColumn: MigrationStep[];\n alterColumn: MigrationStep[];\n dropColumn: MigrationStep[];\n dropPrimaryKey: MigrationStep[];\n addPrimaryKey: MigrationStep[];\n dropCheck: MigrationStep[];\n addCheck: MigrationStep[];\n createIndex: MigrationStep[];\n addForeignKey: MigrationStep[];\n createJoinTable: MigrationStep[];\n dropEnum: MigrationStep[];\n};\n\n// ─── Public API ───────────────────────────────────────────────────\n\n/**\n * Diff two Schema IRs into an ordered list of dialect-neutral migration steps\n * that transform the `from` database shape into the `to` shape.\n *\n * `dialect` (default postgres) selects the comparison rules: sqlite/mysql\n * compare columns by physical type (see normalize.ts), refuse scalar-list\n * columns up front (no array types — VIBE_UNSUPPORTED_CAPABILITY naming the\n * model.field), skip standalone enum steps (their enums are inline: TEXT +\n * CHECK on sqlite, `ENUM(…)` on mysql — value changes flow through\n * `alterColumn`), and refuse enum-value REMOVAL at the column level.\n */\nexport function diffSchemas(params: {\n from: SchemaIR;\n to: SchemaIR;\n dialect?: Dialect;\n /**\n * EXPLICIT physical renames, written down by whoever wants them (renames.ts).\n * Applied to the source schema before the diff runs, so a renamed table or\n * column produces a rename step instead of the drop/create pair the differ\n * would otherwise — correctly — derive. Nothing here is ever inferred.\n */\n renames?: readonly RenameIntent[];\n}): MigrationStep[] {\n const dialect = params.dialect ?? \"postgres\";\n for (const schema of [params.from, params.to]) if (dialect !== \"postgres\" && schema.models.some((model) => (model.exclusions?.length ?? 0) > 0)) throw unsupportedCapability({ dialect, feature: \"exclusionConstraints\" });\n assertRlsDialect({ schema: params.from, dialect });\n assertRlsDialect({ schema: params.to, dialect });\n if (dialect !== \"postgres\") refuseScalarListColumns({ schema: params.to, dialect });\n\n const renamed = planRenames({ from: params.from, to: params.to, renames: params.renames ?? [], dialect });\n params = { ...params, from: renamed.from };\n\n const from = normalizeSchema({ schema: params.from, dialect });\n const to = normalizeSchema({ schema: params.to, dialect });\n\n const buckets: StepBuckets = {\n dropExclusion: [],\n addExclusion: [],\n dropView: [],\n createEnum: [],\n addEnumValue: [],\n dropForeignKey: [],\n dropIndex: [],\n dropJoinTable: [],\n dropTable: [],\n createTable: [],\n addColumn: [],\n alterColumn: [],\n dropColumn: [],\n dropPrimaryKey: [],\n addPrimaryKey: [],\n dropCheck: [],\n addCheck: [],\n createIndex: [],\n addForeignKey: [],\n createJoinTable: [],\n dropEnum: [],\n };\n\n // Standalone enum objects only exist on postgres (CREATE TYPE); sqlite and\n // mysql inline their enums into the columns, so value changes surface as\n // alterColumn steps via the value-based type keys instead.\n if (dialect === \"postgres\") diffEnums({ from, to, buckets });\n diffViews({ from, to, buckets });\n diffJoinTables({ from, to, buckets });\n diffTables({ from, to, buckets, dialect });\n for (const model of params.to.models) {\n const table = model.dbName ?? model.name;\n const previous = params.from.models.find((entry) => (entry.dbName ?? entry.name) === table);\n for (const exclusion of model.exclusions ?? []) {\n const before = previous?.exclusions?.find((entry) => entry.name === exclusion.name);\n if (before?.definition === exclusion.definition) continue;\n if (before?.catalogDefinition) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Exclusion comparison requires normalized evidence\", meta: { reason: \"exclusion-inspection-unavailable\", table, name: exclusion.name } });\n if (before !== undefined) buckets.dropExclusion.push({ kind: \"dropExclusion\", table, exclusion: before, destructive: false });\n buckets.addExclusion.push({ kind: \"addExclusion\", table, exclusion, destructive: false });\n }\n for (const exclusion of previous?.exclusions ?? []) if (!model.exclusions?.some((entry) => entry.name === exclusion.name)) buckets.dropExclusion.push({ kind: \"dropExclusion\", table, exclusion, destructive: false });\n }\n refuseDependentEnumStorageChanges({ from, to, buckets, dialect });\n\n return withRlsSteps({ from: params.from, to: params.to, steps: [\n // Renames run FIRST: every later step (and the normalized comparison\n // above) already refers to the objects by their new physical names.\n ...renamed.steps,\n ...buckets.dropView,\n ...buckets.createEnum,\n ...buckets.addEnumValue,\n ...buckets.dropForeignKey,\n ...buckets.dropExclusion,\n ...buckets.dropIndex,\n ...buckets.dropCheck,\n ...buckets.dropPrimaryKey,\n ...buckets.dropJoinTable,\n ...buckets.dropTable,\n ...buckets.createTable,\n ...buckets.addColumn,\n ...buckets.alterColumn,\n ...buckets.dropColumn,\n ...buckets.addPrimaryKey,\n ...buckets.addCheck,\n ...buckets.addExclusion,\n ...buckets.createIndex,\n ...buckets.addForeignKey,\n ...buckets.createJoinTable,\n ...buckets.dropEnum,\n ] });\n}\n\n// ─── Enums ────────────────────────────────────────────────────────\n\ntype NormalizedPair = {\n from: NormalizedSchema;\n to: NormalizedSchema;\n buckets: StepBuckets;\n};\n\n// ─── Capability guards ────────────────────────────────────────────\n\n/** sqlite/mysql have no array columns — refuse every scalar-list field loudly. */\nfunction refuseScalarListColumns(params: { schema: SchemaIR; dialect: Dialect }): void {\n const { schema, dialect } = params;\n for (const model of schema.models) {\n if (model.isView) continue;\n for (const field of model.fields) {\n if (!field.isList || field.isUnsupported === true) continue;\n throw unsupportedCapability({\n dialect,\n feature: `scalar list column \"${model.name}.${field.name}\"`,\n hint: `${dialect} has no array column type — model the list as a separate table or a ${\n dialect === \"mysql\" ? \"JSON\" : \"Json\"\n } column`,\n });\n }\n }\n}\n\nfunction diffEnums(params: NormalizedPair): void {\n const { from, to, buckets } = params;\n\n for (const [name, enumDef] of to.enums) {\n const previous = from.enums.get(name);\n if (previous === undefined) {\n buckets.createEnum.push({ kind: \"createEnum\", enumDef, destructive: false });\n continue;\n }\n\n const previousValues = new Set(previous.values);\n const currentValues = new Set(enumDef.values);\n for (const value of enumDef.values) {\n if (!previousValues.has(value)) {\n buckets.addEnumValue.push({ kind: \"addEnumValue\", enumName: name, value, destructive: false });\n }\n }\n for (const value of previous.values) {\n if (!currentValues.has(value)) {\n throw unsupportedCapability({\n dialect: \"postgres\",\n feature: `removing value \"${value}\" from enum \"${name}\"`,\n hint: \"postgres cannot drop enum values — recreate the type manually (create new type, ALTER COLUMN ... USING, drop old type)\",\n });\n }\n }\n }\n\n for (const [name] of from.enums) {\n if (!to.enums.has(name)) {\n buckets.dropEnum.push({ kind: \"dropEnum\", enumName: name, destructive: true });\n }\n }\n}\n\n/** Existing FK/join dependencies need a coordinated migration, not isolated ALTERs. */\nfunction refuseDependentEnumStorageChanges(params: NormalizedPair & { dialect: Dialect }): void {\n const { from, to, buckets, dialect } = params;\n for (const step of buckets.alterColumn) {\n if (step.kind !== \"alterColumn\" || !isEnumStringTransition({ from: step.from, to: step.to })) continue;\n for (const normalized of [from, to]) {\n const hasFk = [...normalized.tables.values()].some((table) => [...table.fks.values()].some((fk) =>\n (table.table === step.table && fk.columns.includes(step.column)) ||\n (fk.refTable === step.table && fk.refColumns.includes(step.column)),\n ));\n const hasJoin = [...normalized.joinTables.values()].some((join) => [join.a, join.b].some((end) =>\n end.table === step.table && end.column === step.column,\n ));\n if (hasFk || hasJoin) {\n throw unsupportedCapability({\n dialect,\n feature: `enum storage conversion on \"${step.table}\".\"${step.column}\" with foreign-key dependencies`,\n hint: \"migrate the referencing columns and constraints together in a reviewed manual migration\",\n });\n }\n }\n }\n}\n\n// ─── Views (#26) ──────────────────────────────────────────\n\n/**\n * A view in `from` the target no longer declares gets a `dropView` step — a\n * leftover view otherwise blocks the column drops beneath it (postgres 2BP01)\n * and `push` fails on a schema the user considers valid. Views only in `to`\n * emit nothing: view CREATION stays out-of-band in this wave (see #11), and\n * whatever design lands there must keep this drop rule.\n */\nfunction diffViews(params: NormalizedPair): void {\n const { from, to, buckets } = params;\n for (const [name] of from.views) {\n if (!to.views.has(name)) {\n buckets.dropView.push({ kind: \"dropView\", table: name, destructive: true });\n }\n }\n}\n\n// ─── Join tables ──────────────────────────────────────────────────\n\nfunction diffJoinTables(params: NormalizedPair): void {\n const { from, to, buckets } = params;\n\n for (const [table, joinTable] of to.joinTables) {\n if (!from.joinTables.has(table)) {\n buckets.createJoinTable.push({\n kind: \"createJoinTable\",\n table,\n a: joinTable.a,\n b: joinTable.b,\n destructive: false,\n });\n }\n }\n for (const [table] of from.joinTables) {\n if (!to.joinTables.has(table)) {\n buckets.dropJoinTable.push({ kind: \"dropJoinTable\", table, destructive: true });\n }\n }\n}\n\n// ─── Tables ───────────────────────────────────────────────────────\n\nfunction diffTables(params: NormalizedPair & { dialect: Dialect }): void {\n const { from, to, buckets, dialect } = params;\n\n for (const [name, table] of to.tables) {\n const previous = from.tables.get(name);\n if (previous === undefined) createWholeTable({ table, buckets });\n else\n diffOneTable({\n previous,\n current: table,\n buckets,\n dialect,\n fromEnums: from.enums,\n toEnums: to.enums,\n });\n }\n\n // PostgreSQL/MySQL drops are RESTRICT, not CASCADE. Remove outgoing edges\n // explicitly, including cycles inside a removed group. SQLite instead orders\n // child drops and must not rebuild a table that is itself being removed.\n for (const [name, table] of from.tables) {\n if (to.tables.has(name)) continue;\n if (dialect !== \"sqlite\") for (const fk of table.fks.values()) {\n buckets.dropForeignKey.push({ kind: \"dropForeignKey\", table: name, constraintName: fk.constraintName, destructive: false });\n }\n buckets.dropTable.push({ kind: \"dropTable\", table: name, destructive: true });\n }\n}\n\nfunction createWholeTable(params: { table: NormalizedTable; buckets: StepBuckets }): void {\n const { table, buckets } = params;\n\n buckets.createTable.push({\n kind: \"createTable\",\n table: table.table,\n columns: [...table.columns.values()].map((column) => column.field),\n primaryKey: table.pk,\n ...(table.model.primaryKeyConstraintName === undefined ? {} : { primaryKeyConstraintName: table.model.primaryKeyConstraintName }),\n checks: [...table.checks].map(([name, expression]) => ({ name, expression })),\n destructive: false,\n });\n\n for (const index of table.indexes.values()) {\n buckets.createIndex.push({\n kind: \"createIndex\",\n table: table.table,\n name: index.name,\n indexKind: index.kind,\n unique: index.unique,\n columns: index.columns,\n ...(index.where === undefined ? {} : { where: index.where }),\n ...(index.nullsNotDistinct === true ? { nullsNotDistinct: true } : {}),\n destructive: false,\n });\n }\n\n for (const fk of table.fks.values()) {\n buckets.addForeignKey.push({\n kind: \"addForeignKey\",\n table: table.table,\n constraintName: fk.constraintName,\n columns: fk.columns,\n refTable: fk.refTable,\n refColumns: fk.refColumns,\n onDelete: fk.onDelete,\n onUpdate: fk.onUpdate,\n destructive: false,\n });\n }\n}\n\nfunction diffOneTable(params: {\n previous: NormalizedTable;\n current: NormalizedTable;\n buckets: StepBuckets;\n dialect: Dialect;\n fromEnums: ReadonlyMap<string, EnumIR>;\n toEnums: ReadonlyMap<string, EnumIR>;\n}): void {\n const { previous, current, buckets, dialect, fromEnums, toEnums } = params;\n const table = current.table;\n\n // Columns.\n for (const [name, column] of current.columns) {\n const before = previous.columns.get(name);\n if (before === undefined) {\n buckets.addColumn.push({ kind: \"addColumn\", table, column: column.field, destructive: false });\n continue;\n }\n\n const changes: AlterColumnAspect[] = [];\n if (before.typeKey !== column.typeKey) changes.push(\"type\");\n if (before.nullable !== column.nullable) changes.push(\"nullability\");\n if (before.defaultKey !== column.defaultKey) changes.push(\"default\");\n // An omitted declaration leaves the physical collation unchanged. Explicit\n // declarations are compared with catalog truth, not with a guessed default.\n const collationChanged = dialect === \"mysql\" && column.field.collation !== undefined &&\n before.field.collation?.toLowerCase() !== column.field.collation.toLowerCase();\n if (collationChanged) changes.push(\"collation\");\n if (changes.length === 0) continue;\n if (changes.includes(\"type\") && [...previous.checks].some(([name, expression]) => current.checks.get(name) === expression)) {\n throw unsupportedCapability({ dialect, feature: \"alterColumnWithRetainedCheck\", hint: \"CHECK dependencies and type compatibility are not proven; use a reviewed migration that replaces and revalidates the affected constraints\" });\n }\n\n const storageChange = isEnumStringTransition({ from: before.field, to: column.field });\n if (storageChange) {\n assertEnumStringTransition({ from: before.field, to: column.field, dialect, table, column: name });\n if (isEnumType(before.field.type) && column.field.type === \"String\") {\n const values = resolveEnumValues({ name: before.field.type.enum, enums: fromEnums });\n if (values !== undefined) assertStringEnumLabelsFit({ field: column.field, values, dialect, table });\n }\n }\n let narrowingType =\n changes.includes(\"type\") &&\n !isScalarToArrayChange({ from: before.field, to: column.field }) &&\n !(storageChange && column.field.type === \"String\");\n\n // Inline-enum dialects: an enum→enum type change is a value-list change.\n // Pure widening (values only added) is safe and non-destructive; REMOVING\n // a value is refused outright — existing rows may hold it, and silence\n // would be dialect dishonesty.\n if (\n dialect !== \"postgres\" &&\n changes.includes(\"type\") &&\n isEnumType(before.field.type) &&\n isEnumType(column.field.type)\n ) {\n const fromValues = resolveEnumValues({ name: before.field.type.enum, enums: fromEnums });\n const toValues = resolveEnumValues({ name: column.field.type.enum, enums: toEnums });\n if (fromValues !== undefined && toValues !== undefined) {\n const removed = fromValues.filter((value) => !toValues.includes(value));\n if (removed.length > 0) {\n throw unsupportedCapability({\n dialect,\n feature: `removing value(s) ${removed.map((value) => `\"${value}\"`).join(\", \")} from enum column \"${table}\".\"${name}\"`,\n hint: \"migrate the stored values away first, then recreate the column with the narrower enum\",\n });\n }\n narrowingType = false; // Pure widening — no data can be lost.\n }\n }\n\n buckets.alterColumn.push({\n kind: \"alterColumn\",\n table,\n column: name,\n from: before.field,\n to: column.field,\n changes,\n destructive: narrowingType || collationChanged,\n });\n }\n\n for (const [name] of previous.columns) {\n if (!current.columns.has(name)) {\n buckets.dropColumn.push({ kind: \"dropColumn\", table, column: name, destructive: true });\n }\n }\n\n // Primary key.\n const pkBefore = previous.pk.join(\",\");\n const pkAfter = current.pk.join(\",\");\n if (pkBefore !== pkAfter) {\n if (previous.pk.length > 0) {\n buckets.dropPrimaryKey.push({ kind: \"dropPrimaryKey\", table, destructive: false, ...(previous.model.primaryKeyConstraintName === undefined ? {} : { constraintName: previous.model.primaryKeyConstraintName }) });\n }\n if (current.pk.length > 0) {\n buckets.addPrimaryKey.push({\n kind: \"addPrimaryKey\",\n table,\n columns: current.pk,\n ...(current.model.primaryKeyConstraintName === undefined ? {} : { constraintName: current.model.primaryKeyConstraintName }),\n destructive: false,\n });\n }\n }\n\n // Authored expression changes replace the named constraint. Live callers\n // must establish expression equivalence before passing catalog IR here.\n for (const [name, expression] of current.checks) {\n const before = previous.checks.get(name);\n if (before === expression) continue;\n if (before !== undefined && previous.model.checks?.some((check) => check.name === name && check.catalogExpression === true)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Unequal catalog CHECK text requires normalized evidence or explicit replacement through the live planner\", meta: { reason: \"check-inspection-unavailable\", table, name } });\n if (before !== undefined) buckets.dropCheck.push({ kind: \"dropCheck\", table, name, destructive: false });\n buckets.addCheck.push({ kind: \"addCheck\", table, name, expression, destructive: false });\n }\n for (const [name] of previous.checks) {\n if (current.checks.has(name)) continue;\n buckets.dropCheck.push({ kind: \"dropCheck\", table, name, destructive: false });\n }\n\n // Indexes (uniques included — normalize.ts already merged @unique fields in).\n for (const [key, index] of current.indexes) {\n if (previous.indexes.has(key)) continue;\n buckets.createIndex.push({\n kind: \"createIndex\",\n table,\n name: index.name,\n indexKind: index.kind,\n unique: index.unique,\n columns: index.columns,\n ...(index.where === undefined ? {} : { where: index.where }),\n ...(index.nullsNotDistinct === true ? { nullsNotDistinct: true } : {}),\n destructive: false,\n });\n }\n for (const [key, index] of previous.indexes) {\n if (current.indexes.has(key)) continue;\n buckets.dropIndex.push({ kind: \"dropIndex\", name: index.name, table, destructive: false, ...(index.constraintName === undefined ? {} : { constraintName: index.constraintName }) });\n }\n\n // Foreign keys. Cascade-action drift needs DROP + ADD — postgres has no\n // ALTER CONSTRAINT ... ON DELETE for FKs (LEARNINGS).\n for (const [key, fk] of current.fks) {\n const before = previous.fks.get(key);\n if (before === undefined) {\n buckets.addForeignKey.push({\n kind: \"addForeignKey\",\n table,\n constraintName: fk.constraintName,\n columns: fk.columns,\n refTable: fk.refTable,\n refColumns: fk.refColumns,\n onDelete: fk.onDelete,\n onUpdate: fk.onUpdate,\n destructive: false,\n });\n continue;\n }\n if (before.onDelete !== fk.onDelete || before.onUpdate !== fk.onUpdate) {\n buckets.dropForeignKey.push({\n kind: \"dropForeignKey\",\n table,\n constraintName: before.constraintName,\n destructive: false,\n });\n buckets.addForeignKey.push({\n kind: \"addForeignKey\",\n table,\n constraintName: fk.constraintName,\n columns: fk.columns,\n refTable: fk.refTable,\n refColumns: fk.refColumns,\n onDelete: fk.onDelete,\n onUpdate: fk.onUpdate,\n destructive: false,\n });\n }\n }\n for (const [key, fk] of previous.fks) {\n if (current.fks.has(key)) continue;\n buckets.dropForeignKey.push({\n kind: \"dropForeignKey\",\n table,\n constraintName: fk.constraintName,\n destructive: false,\n });\n }\n}\n",
|
|
7
|
-
"/**\n * Enum-value resolution shared by the sqlite/mysql type mappers.\n *\n * On dialects without named enum types (sqlite: TEXT + CHECK, mysql: inline\n * `ENUM(...)`) the enum's NAME does not survive in the database — only its\n * VALUES do. Column comparison keys and DDL rendering therefore resolve a\n * field's enum reference to its value list; the name is presentation only.\n */\n\nimport { isEnumType, unsupportedCapability } from \"@vibeorm/schema\";\nimport type { Dialect, EnumIR, FieldIR } from \"@vibeorm/schema\";\n\n/**\n * Resolve an enum name to its values. The map is keyed by db name\n * (`dbName ?? name`, the normalize.ts convention); a schema-side reference by\n * IR name falls back to a scan so both key styles resolve.\n */\nexport function resolveEnumValues(params: {\n name: string;\n enums: ReadonlyMap<string, EnumIR>;\n}): readonly string[] | undefined {\n const { name, enums } = params;\n const direct = enums.get(name);\n if (direct !== undefined) return direct.values;\n for (const enumDef of enums.values()) {\n if (enumDef.name === name) return enumDef.values;\n }\n return undefined;\n}\n\n/** Storage transitions are detected on physical fields, after normalization. */\nexport function isEnumStringTransition(params: { from: FieldIR; to: FieldIR }): boolean {\n const { from, to } = params;\n return (isEnumType(from.type) && to.type === \"String\") || (from.type === \"String\" && isEnumType(to.type));\n}\n\n/** Shared differ/renderer backstop for storage casts that are not yet lossless. */\nexport function assertEnumStringTransition(params: { from: FieldIR; to: FieldIR; dialect: Dialect; table: string; column: string }): void {\n const { from, to, dialect, table, column } = params;\n if (!isEnumStringTransition({ from, to })) return;\n const reason = from.isList !== to.isList\n ? \"change scalar/list shape separately from enum storage\"\n : from.default?.kind === \"dbgenerated\" || to.default?.kind === \"dbgenerated\"\n ? \"database-expression defaults may depend on the native enum type — migrate the default explicitly first\"\n : dialect === \"mysql\" && isEnumType(to.type)\n ? \"non-strict mysql can silently replace out-of-list strings with '' — validate and migrate this column manually in strict mode\"\n : undefined;\n if (reason !== undefined) {\n throw unsupportedCapability({ dialect, feature: `enum storage conversion on \"${table}\".\"${column}\"`, hint: reason });\n }\n}\n",
|
|
5
|
+
"import { randomUUID } from \"node:crypto\";\nimport { mkdtemp, rm } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { VibeError, providerToDialect } from \"@vibeorm/schema\";\nimport { getSqlDialect, renderShadowOperation, SHADOW_DATABASE } from \"@vibeorm/sql\";\nimport { applyMigrations, validateMigrationReplay } from \"./runner.ts\";\nimport { captureReplayReference } from \"./replay-reference.ts\";\nimport { runShadowReplay } from \"./shadow-guard.ts\";\nimport { withDedicatedShadow } from \"./shadow-dedicated.ts\";\nimport type { MigrationReferenceOptions, ShadowConnection } from \"./shadow-types.ts\";\nimport type { SqlExecutor } from \"./types.ts\";\n\n/** @internal Cleanup always runs; preserve a primary failure when cleanup also fails. */\nexport function finishShadowWork<T>(params: { run: () => Promise<T>; cleanup: () => Promise<void>; artifact: string }): Promise<T> {\n return Promise.resolve().then(params.run).then(\n async (value) => {\n await Promise.resolve().then(params.cleanup).then(undefined, (cause: unknown) => {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Migration reference completed but its owned resource could not be cleaned. Inspect the named artifact before explicit cleanup.\", meta: { cleanupReason: \"shadow-cleanup-failed\", artifact: params.artifact, cleanupFailure: cause instanceof VibeError ? cause.code : \"unavailable\" }, cause });\n });\n return value;\n },\n async (primary: unknown) => {\n const [cleanup] = await Promise.allSettled([Promise.resolve().then(params.cleanup)]);\n if (cleanup!.status === \"rejected\") throw new VibeError({ code: primary instanceof VibeError ? primary.code : \"VIBE_MIGRATION\", message: \"Migration reference failed and its owned resource could not be cleaned. Inspect the named artifact before explicit cleanup.\", meta: { cleanupReason: \"shadow-cleanup-failed\", artifact: params.artifact, cleanupFailure: cleanup!.reason instanceof VibeError ? cleanup!.reason.code : \"unavailable\" }, cause: { primary, cleanup: cleanup!.reason } });\n throw primary;\n },\n );\n}\n\n/** @internal Keep a pinned session for every identity, lease, reset and replay query. */\nexport function withShadowConnection<T>(params: { connection: ShadowConnection; run: (executor: SqlExecutor) => Promise<T>; artifact: string }): Promise<T> {\n const runPinned = (executor: SqlExecutor): Promise<T> => {\n // A lifecycle already owns the session. Do not let nested runner calls reserve another one.\n const pinned: SqlExecutor = ({ text, values }) => executor({ text, values });\n return params.run(pinned);\n };\n return finishShadowWork({ artifact: params.artifact, cleanup: () => params.connection.close(), run: () => params.connection.executor.withSession === undefined ? runPinned(params.connection.executor) : params.connection.executor.withSession({ run: runPinned }) });\n}\n\n/** Build an independent reference and own its entire lifetime; never connect to an implicit target. */\nexport async function withMigrationReference<T>(params: MigrationReferenceOptions<T>): Promise<T> {\n const dialect = providerToDialect({ provider: params.shadow.provider });\n const replay = { ...params.replay, migrations: params.migrations, dialect };\n validateMigrationReplay(replay);\n const inspect = async (executor: SqlExecutor, privateTable?: string): Promise<T> => {\n await runShadowReplay({ executor, run: () => applyMigrations({ ...replay, executor, history: \"complete\" }) });\n const reference = await captureReplayReference({ executor, dialect, migrations: params.migrations, ...(privateTable === undefined ? {} : { privateTable }), ...(params.shadow.mode === \"dedicated\" && dialect === \"postgres\" ? { privateNamespace: SHADOW_DATABASE.schema } : {}) });\n return params.run({ executor, reference });\n };\n if (params.shadow.mode === \"dedicated\") return withDedicatedShadow({ ...params, shadow: params.shadow, runReference: inspect });\n if (params.shadow.provider === \"pglite\") {\n const connection = await params.openConnection({ provider: \"pglite\", url: \"memory://\" });\n return withShadowConnection({ connection, artifact: \"owned PGlite instance\", run: inspect });\n }\n if (params.shadow.provider === \"sqlite\") {\n const directory = await mkdtemp(join(tmpdir(), \"vibeorm-shadow-\"));\n return finishShadowWork({ artifact: directory, cleanup: () => rm(directory, { recursive: true, force: true }), run: async () => {\n const connection = await params.openConnection({ provider: \"sqlite\", url: `file:${join(directory, \"shadow.db\")}` });\n return withShadowConnection({ connection, artifact: directory, run: inspect });\n } });\n }\n if (!(\"adminUrl\" in params.shadow)) throw new VibeError({ code: \"VIBE_CONFIG\", message: \"Automatic server shadows require an explicit admin URL\" });\n const { provider, adminUrl } = params.shadow;\n const url = await Promise.resolve().then(() => new URL(adminUrl)).then((value) => value, (cause: unknown) => { throw new VibeError({ code: \"VIBE_CONFIG\", message: \"shadowAdminUrl must be an explicit server database URL\", cause }); });\n const expected = provider === \"postgresql\" ? [\"postgres:\", \"postgresql:\"] : [\"mysql:\"];\n if (!expected.includes(url.protocol) || url.hostname.length === 0 || url.pathname.length <= 1 || [...url.searchParams.keys()].some((key) => [\"database\", \"dbname\", \"host\", \"hostaddr\", \"port\", \"user\", \"socketpath\", \"connectionstring\", \"uri\", \"url\", \"service\"].includes(key.toLowerCase()))) throw new VibeError({ code: \"VIBE_CONFIG\", message: \"Shadow admin URL has an unsupported protocol or conflicting connection selector\", meta: { reason: \"shadow-url-ambiguous\" } });\n const prefix = /^\\/vibeorm_test(?:_|$)/.test(url.pathname) ? \"vibeorm_test_shadow\" : \"vibeorm_shadow\";\n const name = `${prefix}_${randomUUID().replaceAll(\"-\", \"\")}`;\n const connection = await params.openConnection({ provider, url: adminUrl });\n return withShadowConnection({ connection, artifact: name, run: async (admin) => {\n const sqlDialect = getSqlDialect({ dialect });\n for (const query of renderShadowOperation({ dialect: sqlDialect, operation: { kind: \"createDatabase\", name } })) {\n await admin({ text: query.text, values: [...query.values] }).then(undefined, (cause: unknown) => {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Shadow CREATE did not report success. No deletion was attempted; inspect the named artifact on the configured admin server before explicit cleanup.\", meta: { reason: \"shadow-create-outcome-unknown\", artifact: name }, cause });\n });\n }\n // Deletion authority begins only after CREATE returned success. An uncertain CREATE never reaches this scope.\n return finishShadowWork({ artifact: name, cleanup: async () => {\n for (const query of renderShadowOperation({ dialect: sqlDialect, operation: { kind: \"dropDatabase\", name } })) await admin({ text: query.text, values: [...query.values] });\n }, run: async () => {\n url.pathname = `/${name}`;\n const shadow = await params.openConnection({ provider, url: url.toString() });\n return withShadowConnection({ connection: shadow, artifact: name, run: inspect });\n } });\n } });\n}\n",
|
|
6
|
+
"import { createHash } from \"node:crypto\";\nimport { executionChecksumSuffix } from \"./execution.ts\";\nimport type { MigrationExecution } from \"./execution.ts\";\nimport { desiredStateChecksumSuffix } from \"./desired-state.ts\";\nimport type { MigrationDesiredState } from \"./desired-state.ts\";\nimport { moduleOriginChecksumSuffix } from \"./module-origin.ts\";\nimport type { ModuleMigrationOrigin } from \"./module-origin.ts\";\n\n/** Historical SQL/execution checksum, with optional immutable state and module provenance. */\nexport function migrationChecksum(params: {\n moduleOrigin?: ModuleMigrationOrigin;\n sql: readonly string[];\n execution?: MigrationExecution;\n desiredState?: MigrationDesiredState;\n downSql?: readonly string[];\n downExecution?: MigrationExecution;\n desiredStatePending?: boolean;\n}): string {\n const suffix = executionChecksumSuffix({ ...(params.execution === undefined ? {} : { execution: params.execution }) });\n return createHash(\"sha256\").update(params.sql.join(\"\\n\") + suffix + moduleOriginChecksumSuffix(params) + (params.desiredStatePending === true ? \"\\n-- vibeorm:desired-state unfinalized-v1\" : \"\") + desiredStateChecksumSuffix({ ...(params.desiredState === undefined ? {} : { desiredState: params.desiredState }) }) + (params.desiredState === undefined ? \"\" : `\\n-- vibeorm:down ${JSON.stringify(params.downSql ?? null)}${executionChecksumSuffix({ ...(params.downExecution === undefined ? {} : { execution: params.downExecution }) })}`)).digest(\"hex\");\n}\n",
|
|
7
|
+
"/**\n * Explicit execution semantics for a migration file: which transaction regime\n * it runs in, which session limits it scopes to its own work, and what each of\n * its statements is DECLARED to do.\n *\n * Why declarations and not SQL parsing: a nontransactional migration can die\n * between a statement committing and the journal recording it. Recovery then\n * has to establish what actually happened, and the only honest way to do that\n * is to compare the live catalog against a declared postcondition. Guessing an\n * operation out of SQL text is exactly the class of bug F29/F33 came from.\n *\n * CHECKSUM COMPATIBILITY — the rule this module exists to protect. A migration\n * with no execution block, or one that asks for nothing beyond today's\n * behaviour, hashes byte-for-byte as before ({@link isDefaultExecution} is\n * true ⇒ {@link executionChecksumSuffix} is empty). Every migration file\n * written before this feature existed therefore keeps its historical checksum\n * and no journal row starts looking corrupt. Only an explicitly non-default\n * block folds a canonical description into the hash, so editing execution\n * semantics after a migration was applied surfaces as the existing\n * checksum-mismatch refusal instead of silently changing how it runs.\n */\n\nimport { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect } from \"@vibeorm/schema\";\nimport type { MigrationStep } from \"./types.ts\";\n\n// ─── Model ────────────────────────────────────────────────────────\n\n/**\n * How the runner wraps a migration's statements.\n *\n * - `\"default\"` — the dialect's own regime, unchanged: one transaction per\n * migration on postgres/sqlite, per-statement bookkeeping on mysql.\n * - `\"none\"` — the migration runs OUTSIDE any transaction the runner opens,\n * with per-statement journal progress. Required for statements PostgreSQL\n * refuses inside a transaction block, `CREATE INDEX CONCURRENTLY` first\n * among them.\n */\nexport type MigrationTransactionMode = \"default\" | \"none\";\n\n/**\n * What one statement of a nontransactional migration is declared to do — the\n * postcondition recovery checks against the live catalog. Declared by whoever\n * wrote the migration; never inferred from the SQL text.\n */\nexport type MigrationOperation =\n | {\n readonly kind: \"createIndexConcurrently\";\n readonly index: string;\n readonly table: string;\n readonly unique: boolean;\n /** Access method as PostgreSQL names it (`btree`, `gin`, …). */\n readonly method: string;\n /** Key columns in index order, as PostgreSQL deparses them. */\n readonly columns: readonly string[];\n /** Partial-index predicate, when the index has one. */\n readonly where?: string;\n }\n | { readonly kind: \"dropIndexConcurrently\"; readonly index: string }\n | { readonly kind: \"addConstraintNotValid\"; readonly table: string; readonly constraint: string }\n | { readonly kind: \"validateConstraint\"; readonly table: string; readonly constraint: string }\n | { readonly kind: \"renameTable\"; readonly from: string; readonly to: string }\n | { readonly kind: \"renameColumn\"; readonly table: string; readonly from: string; readonly to: string };\n\n/** One statement's declared operation, keyed by its index in `MigrationFile.sql`. */\nexport type MigrationOperationBinding = {\n /** 0-based index into the migration's statement array. */\n readonly statement: number;\n readonly operation: MigrationOperation;\n};\n\n/** Explicit execution semantics of one direction (up or down) of a migration. */\nexport type MigrationExecution = {\n readonly transaction: MigrationTransactionMode;\n /** Migration-owned `lock_timeout` in milliseconds; 0 = no limit (server default). */\n readonly lockTimeoutMs?: number;\n /** Migration-owned `statement_timeout` in milliseconds; 0 = no limit. */\n readonly statementTimeoutMs?: number;\n readonly operations?: readonly MigrationOperationBinding[];\n};\n\n/** On-disk sidecar filename beside `migration.sql` / `down.sql`. */\nexport const EXECUTION_SIDECAR_FILENAME: string = \"execution.json\";\n\n/** Sidecar format version — bumped only on an incompatible layout change. */\nexport const EXECUTION_SIDECAR_VERSION: number = 1;\n\n// ─── Identity ─────────────────────────────────────────────────────\n\n/** True when the block asks for nothing beyond the dialect's existing behaviour. */\nexport function isDefaultExecution(params: { execution?: MigrationExecution }): boolean {\n const execution = params.execution;\n if (execution === undefined) return true;\n return (\n execution.transaction === \"default\" &&\n (execution.lockTimeoutMs ?? 0) === 0 &&\n (execution.statementTimeoutMs ?? 0) === 0 &&\n (execution.operations ?? []).length === 0\n );\n}\n\n/** Deterministic one-line description of an operation — checksum input and error text. */\nexport function describeOperation(params: { operation: MigrationOperation }): string {\n const operation = params.operation;\n switch (operation.kind) {\n case \"createIndexConcurrently\":\n return `createIndexConcurrently index=${operation.index} table=${operation.table} unique=${String(operation.unique)} method=${operation.method} columns=${operation.columns.join(\",\")}${operation.where === undefined ? \"\" : ` where=${operation.where}`}`;\n case \"dropIndexConcurrently\":\n return `dropIndexConcurrently index=${operation.index}`;\n case \"addConstraintNotValid\":\n return `addConstraintNotValid table=${operation.table} constraint=${operation.constraint}`;\n case \"validateConstraint\":\n return `validateConstraint table=${operation.table} constraint=${operation.constraint}`;\n case \"renameTable\":\n return `renameTable from=${operation.from} to=${operation.to}`;\n case \"renameColumn\":\n return `renameColumn table=${operation.table} from=${operation.from} to=${operation.to}`;\n }\n}\n\n/**\n * The canonical text folded into the migration checksum — EMPTY for a default\n * block, so historical checksums are untouched (see the module doc). The text\n * is built field by field in a fixed order rather than JSON-stringified, so it\n * cannot drift with object key order.\n */\nexport function executionChecksumSuffix(params: { execution?: MigrationExecution }): string {\n if (isDefaultExecution({ ...params })) return \"\";\n const execution = params.execution as MigrationExecution;\n const lines = [\n `-- vibeorm:execution transaction=${execution.transaction} lockTimeoutMs=${String(execution.lockTimeoutMs ?? 0)} statementTimeoutMs=${String(execution.statementTimeoutMs ?? 0)}`,\n ...[...(execution.operations ?? [])]\n .map((binding) => `-- vibeorm:operation ${String(binding.statement)} ${describeOperation({ operation: binding.operation })}`)\n .sort(),\n ];\n return `\\n${lines.join(\"\\n\")}`;\n}\n\n// ─── Validation ───────────────────────────────────────────────────\n\nfunction invalid(params: { migration: string; detail: string }): VibeError {\n return new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `invalid execution metadata for migration \"${params.migration}\": ${params.detail}`,\n meta: { reason: \"execution-metadata-invalid\", migration: params.migration },\n });\n}\n\n/**\n * Structural checks a declared block must pass before the runner trusts it:\n * every operation binding points at a real statement, no statement carries two\n * operations, and the timeouts are non-negative safe integers.\n */\nexport function assertValidExecution(params: {\n execution?: MigrationExecution;\n statements: number;\n migration: string;\n}): void {\n const { execution, statements, migration } = params;\n if (execution === undefined) return;\n if (execution.transaction !== \"default\" && execution.transaction !== \"none\") {\n throw invalid({ migration, detail: `unknown transaction mode ${JSON.stringify(execution.transaction)}` });\n }\n for (const [label, value] of [[\"lockTimeoutMs\", execution.lockTimeoutMs], [\"statementTimeoutMs\", execution.statementTimeoutMs]] as const) {\n if (value === undefined) continue;\n if (!Number.isSafeInteger(value) || value < 0) {\n throw invalid({ migration, detail: `${label} must be a non-negative integer number of milliseconds` });\n }\n }\n const seen = new Set<number>();\n for (const binding of execution.operations ?? []) {\n if (!Number.isSafeInteger(binding.statement) || binding.statement < 0 || binding.statement >= statements) {\n throw invalid({ migration, detail: `operation refers to statement ${String(binding.statement)}, which is outside the migration's ${String(statements)} statement(s)` });\n }\n if (seen.has(binding.statement)) {\n throw invalid({ migration, detail: `statement ${String(binding.statement)} carries more than one declared operation` });\n }\n seen.add(binding.statement);\n }\n}\n\n/** The operation declared for one statement, if any. */\nexport function operationFor(params: {\n execution?: MigrationExecution;\n statement: number;\n}): MigrationOperation | undefined {\n return params.execution?.operations?.find((binding) => binding.statement === params.statement)?.operation;\n}\n\n// ─── Sidecar ──────────────────────────────────────────────────────\n\n/**\n * Serialize the execution sidecar, or `undefined` when both directions are\n * default and no file should be written at all. Keeping the file absent for\n * ordinary migrations is what makes the feature invisible to existing trees.\n */\nexport function serializeExecutionSidecar(params: {\n execution?: MigrationExecution;\n downExecution?: MigrationExecution;\n}): string | undefined {\n if (isDefaultExecution({ ...(params.execution === undefined ? {} : { execution: params.execution }) })\n && isDefaultExecution({ ...(params.downExecution === undefined ? {} : { execution: params.downExecution }) })) {\n return undefined;\n }\n return `${JSON.stringify({\n version: EXECUTION_SIDECAR_VERSION,\n ...(params.execution === undefined ? {} : { up: params.execution }),\n ...(params.downExecution === undefined ? {} : { down: params.downExecution }),\n }, null, 2)}\\n`;\n}\n\n/**\n * Read and validate the sidecar. Nothing here is trusted: an unknown version,\n * a malformed body or an out-of-range operation binding refuses rather than\n * silently degrading to default semantics — a migration that believes it runs\n * outside a transaction and quietly runs inside one is exactly the failure\n * this metadata exists to prevent.\n */\nexport function parseExecutionSidecar(params: {\n text: string;\n migration: string;\n statements: number;\n downStatements: number;\n}): { readonly execution?: MigrationExecution; readonly downExecution?: MigrationExecution } {\n const { migration } = params;\n let parsed: unknown;\n try {\n parsed = JSON.parse(params.text);\n } catch (error) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `invalid execution metadata for migration \"${migration}\": not valid JSON`,\n meta: { reason: \"execution-metadata-invalid\", migration },\n cause: error,\n });\n }\n if (parsed === null || typeof parsed !== \"object\") throw invalid({ migration, detail: \"expected a JSON object\" });\n const body = parsed as { version?: unknown; up?: unknown; down?: unknown };\n if (body.version !== EXECUTION_SIDECAR_VERSION) {\n throw invalid({ migration, detail: `unsupported sidecar version ${String(body.version)} (this build reads version ${String(EXECUTION_SIDECAR_VERSION)})` });\n }\n const up = body.up === undefined ? undefined : (body.up as MigrationExecution);\n const down = body.down === undefined ? undefined : (body.down as MigrationExecution);\n assertValidExecution({ ...(up === undefined ? {} : { execution: up }), statements: params.statements, migration });\n assertValidExecution({ ...(down === undefined ? {} : { execution: down }), statements: params.downStatements, migration });\n return {\n ...(up === undefined ? {} : { execution: up }),\n ...(down === undefined ? {} : { downExecution: down }),\n };\n}\n\n// ─── Dry-run risk ─────────────────────────────────────────────────\n\n/** A reviewable risk a planned migration carries, for dry-run output. */\nexport type MigrationRisk = {\n readonly kind: \"tableRewrite\" | \"exclusiveLock\" | \"concurrentIndex\" | \"validateScan\" | \"notOnline\" | \"integrityLoss\" | \"unknownObjectRemoval\";\n readonly detail: string;\n readonly table?: string;\n};\n\n/**\n * Describe the operational risk of a planned migration, for dry-run output.\n *\n * Deliberately conservative and deliberately incomplete: it reports what the\n * step model can prove (a type change that rewrites the table on postgres, an\n * ALTER/DROP that takes ACCESS EXCLUSIVE, a validation scan) and it always\n * appends the `notOnline` note, because nothing here — `lock_timeout`\n * included — makes a migration online. A short lock WAIT is not a short lock\n * HOLD.\n */\nexport function describeMigrationRisks(params: {\n steps: readonly MigrationStep[];\n dialect: Dialect;\n}): readonly MigrationRisk[] {\n const { steps, dialect } = params;\n const risks: MigrationRisk[] = [];\n for (const step of steps) {\n switch (step.kind) {\n case \"dropExclusion\":\n case \"dropCheck\":\n case \"dropForeignKey\":\n case \"dropPrimaryKey\":\n case \"dropIndex\":\n risks.push({ kind: \"integrityLoss\", detail: `${step.kind} removes a constraint or index; integrity and dependent objects must be checked separately from row loss`, ...(\"table\" in step && step.table !== undefined ? { table: step.table } : {}) });\n break;\n case \"alterColumn\":\n if (step.changes.includes(\"type\")) {\n risks.push({ kind: \"tableRewrite\", table: step.table, detail: `changing the type of \"${step.table}\".\"${step.column}\" rewrites every row of the table while holding ACCESS EXCLUSIVE` });\n } else if (step.changes.includes(\"nullability\") && !step.to.isOptional) {\n risks.push({ kind: \"exclusiveLock\", table: step.table, detail: `SET NOT NULL on \"${step.table}\".\"${step.column}\" scans the whole table under ACCESS EXCLUSIVE${dialect === \"postgres\" ? \" unless a matching validated CHECK already proves it\" : \"\"}` });\n }\n break;\n case \"addColumn\":\n if (step.column.default !== undefined && step.column.default.kind === \"dbgenerated\") {\n risks.push({ kind: \"tableRewrite\", table: step.table, detail: `adding \"${step.table}\".\"${step.column.dbName ?? step.column.name}\" with a volatile default rewrites the table` });\n }\n break;\n case \"createIndex\":\n risks.push({ kind: \"exclusiveLock\", table: step.table, detail: `an ordinary CREATE INDEX on \"${step.table}\" blocks writes for the whole build — see the concurrent-index path in docs/migrations.md` });\n break;\n case \"addForeignKey\":\n risks.push({ kind: \"validateScan\", table: step.table, detail: `adding foreign key \"${step.constraintName}\" scans \"${step.table}\" and locks the referenced table — the staged NOT VALID path splits that` });\n break;\n case \"addCheck\":\n risks.push({ kind: \"validateScan\", table: step.table, detail: `adding check \"${step.name}\" scans \"${step.table}\" under ACCESS EXCLUSIVE — the staged NOT VALID path splits that` });\n break;\n case \"addForeignKeyNotValid\":\n case \"addCheckNotValid\":\n risks.push({ kind: \"exclusiveLock\", table: step.table, detail: `NOT VALID still takes a brief ACCESS EXCLUSIVE lock on \"${step.table}\"; it skips the scan, not the lock` });\n break;\n case \"validateConstraint\":\n risks.push({ kind: \"validateScan\", table: step.table, detail: `validating \"${step.name}\" scans \"${step.table}\" under SHARE UPDATE EXCLUSIVE — concurrent reads and writes continue` });\n break;\n case \"renameTable\":\n risks.push({ kind: \"exclusiveLock\", table: step.from, detail: `renaming \"${step.from}\" to \"${step.to}\" takes ACCESS EXCLUSIVE and breaks every client still using the old name` });\n break;\n case \"renameColumn\":\n risks.push({ kind: \"exclusiveLock\", table: step.table, detail: `renaming \"${step.table}\".\"${step.from}\" to \"${step.to}\" takes ACCESS EXCLUSIVE and breaks every client still using the old name` });\n break;\n case \"dropTable\":\n case \"dropJoinTable\":\n risks.push({ kind: \"integrityLoss\", table: step.table, detail: `${step.kind} also removes the table's constraints and indexes; their integrity loss requires separate acknowledgement` });\n risks.push({ kind: \"exclusiveLock\", detail: `${step.kind} takes ACCESS EXCLUSIVE and is not recoverable by re-running the migration` });\n break;\n case \"dropColumn\":\n risks.push({ kind: \"exclusiveLock\", detail: `${step.kind} takes ACCESS EXCLUSIVE and is not recoverable by re-running the migration` });\n break;\n default:\n break;\n }\n }\n if (risks.length > 0) {\n risks.push({\n kind: \"notOnline\",\n detail: \"lock_timeout bounds how long a statement WAITS for a lock, not how long it HOLDS one. A migration that acquires its lock immediately can still block every other session for the length of the operation.\",\n });\n }\n return risks;\n}\n",
|
|
8
|
+
"import { VibeError, assertValidSchemaIR, isSqlObjectDefinition, isSqlObjectIdentity, providerToDialect, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR, SqlObjectDefinition, SqlObjectIdentity } from \"@vibeorm/schema\";\n\n/** Authored desired state; live catalog observations never become this state implicitly. */\nexport type DesiredState = {\n readonly schema: SchemaIR;\n readonly definitions: readonly SqlObjectDefinition[];\n /** Server context for independently normalized definitions; absent for authored-only records. */\n readonly normalization?: { readonly format: \"catalog-v1\"; readonly dialect: Dialect; readonly serverVersion: string };\n};\n\n/** Immutable metadata shipped beside each new forward migration. */\nexport type MigrationDesiredState = {\n readonly version: 1;\n readonly dialect: Dialect;\n readonly from: DesiredState;\n readonly to: DesiredState;\n /** Actual rollback target when irreversible steps cannot restore from exactly. */\n readonly down?: DesiredState;\n /** Exact unmanaged objects the forward SQL intentionally removes, including collateral. */\n readonly unmanagedRemovals?: readonly SqlObjectIdentity[];\n};\n\n/** Offline shells declare uncertainty until reviewed before/after metadata is supplied. */\nexport const UNFINALIZED_DESIRED_STATE: Readonly<{ version: 1; status: \"unfinalized\" }> = Object.freeze({ version: 1, status: \"unfinalized\" });\n\n/** Recognize only the exact offline placeholder, never malformed finalized metadata. */\nexport function isUnfinalizedDesiredState(params: { text: string }): boolean {\n const value: unknown = JSON.parse(params.text);\n return record(value) && value.version === 1 && value.status === \"unfinalized\" && Object.keys(value).length === 2;\n}\n\n/** On-disk desired-state format. */\nexport const DESIRED_STATE_METADATA: Readonly<{ filename: string; version: 1 }> = Object.freeze({ filename: \"desired-state.json\", version: 1 });\n\n/** Construct metadata from declarations, never from the database being verified. */\nexport function createDesiredState(params: { schema: SchemaIR; dialect: Dialect; definitions?: readonly SqlObjectDefinition[] }): DesiredState {\n assertValidSchemaIR({ schema: params.schema });\n const provider = providerToDialect({ provider: params.schema.datasource.provider }) === params.dialect ? params.schema.datasource.provider : params.dialect === \"postgres\" ? \"postgresql\" : params.dialect;\n const schema: SchemaIR = { ...params.schema, datasource: { provider } };\n const definitions = params.definitions ?? (schema.migrationObjects ?? []).flatMap((object) => object.expected === undefined ? [] : [object.expected]);\n const seen = new Set<string>();\n for (const definition of definitions) {\n if (!isSqlObjectDefinition(definition)) throw invalid({ migration: \"declaration\", detail: \"malformed expected definition\" });\n const key = sqlObjectKey({ identity: definition.identity });\n if (seen.has(key)) throw invalid({ migration: \"declaration\", detail: `duplicate definition ${key}` });\n seen.add(key);\n }\n return { schema, definitions };\n}\n\nfunction invalid(params: { migration: string; detail: string; cause?: unknown }): VibeError {\n return new VibeError({ code: \"VIBE_MIGRATION\", message: `Invalid desired state for migration \"${params.migration}\": ${params.detail}`, meta: { reason: \"desired-state-invalid\", migration: params.migration }, ...(params.cause === undefined ? {} : { cause: params.cause }) });\n}\nfunction record(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction keysOnly(value: Record<string, unknown>, allowed: readonly string[]): boolean {\n return Object.keys(value).every((key) => allowed.includes(key));\n}\nfunction modelShape(value: unknown): boolean {\n if (!record(value) || typeof value.name !== \"string\" || !Array.isArray(value.fields) || !Array.isArray(value.relations) || !Array.isArray(value.indexes)) return false;\n return value.fields.every((field) => record(field) && typeof field.name === \"string\"\n && (field.nativeTypeIdentity === undefined || (record(field.nativeTypeIdentity) && keysOnly(field.nativeTypeIdentity, [\"source\", \"namespace\"]) && field.isUnsupported === true && typeof field.nativeTypeIdentity.source === \"string\" && field.nativeTypeIdentity.source === field.nativeType && typeof field.nativeTypeIdentity.namespace === \"string\" && field.nativeTypeIdentity.namespace.length > 0))\n && (typeof field.type === \"string\" || (record(field.type) && typeof field.type.enum === \"string\"))\n && [\"isId\", \"isUnique\", \"isOptional\", \"isList\"].every((key) => typeof field[key] === \"boolean\"))\n && value.relations.every(record)\n && value.indexes.every((index) => record(index) && Array.isArray(index.fields) && index.fields.every(record))\n && (value.checks === undefined || (Array.isArray(value.checks) && value.checks.every((check) => record(check) && typeof check.name === \"string\" && typeof check.expression === \"string\")));\n}\nfunction state(value: unknown): value is DesiredState {\n if (!record(value) || !keysOnly(value, [\"schema\", \"definitions\", \"normalization\"]) || !record(value.schema) || !Array.isArray(value.definitions) || !value.definitions.every(isSqlObjectDefinition)) return false;\n const schema = value.schema;\n return record(schema.datasource) && [\"postgresql\", \"pglite\", \"sqlite\", \"mysql\"].includes(String(schema.datasource.provider))\n && keysOnly(schema, [\"datasource\", \"models\", \"enums\", \"extensions\", \"rls\", \"migrationObjects\"])\n && keysOnly(schema.datasource, [\"provider\"]) && Array.isArray(schema.models) && schema.models.every(modelShape)\n && Array.isArray(schema.enums) && schema.enums.every((entry) => record(entry) && typeof entry.name === \"string\" && Array.isArray(entry.values) && entry.values.every((label) => typeof label === \"string\")) && Array.isArray(schema.extensions) && schema.extensions.every(record)\n && (value.normalization === undefined || (record(value.normalization) && value.normalization.format === \"catalog-v1\" && [\"postgres\", \"sqlite\", \"mysql\"].includes(String(value.normalization.dialect)) && typeof value.normalization.serverVersion === \"string\"));\n}\n\n/** Validate untrusted sidecars, including their Schema IR, before planning or checksumming. */\nexport function assertDesiredState(params: { value: unknown; migration: string }): asserts params is { value: MigrationDesiredState; migration: string } {\n const value = params.value;\n if (!record(value) || !keysOnly(value, [\"version\", \"dialect\", \"from\", \"to\", \"down\", \"unmanagedRemovals\"]) || value.version !== 1 || ![\"postgres\", \"sqlite\", \"mysql\"].includes(String(value.dialect)) || !state(value.from) || !state(value.to) || (value.down !== undefined && !state(value.down))) {\n throw invalid({ migration: params.migration, detail: \"unsupported version or malformed state\" });\n }\n if (value.unmanagedRemovals !== undefined && (!Array.isArray(value.unmanagedRemovals) || !value.unmanagedRemovals.every(isSqlObjectIdentity))) throw invalid({ migration: params.migration, detail: \"malformed unmanaged-removal identities\" });\n for (const entry of [value.from, value.to, ...(value.down === undefined ? [] : [value.down as DesiredState])]) {\n assertValidSchemaIR({ schema: entry.schema });\n if (providerToDialect({ provider: entry.schema.datasource.provider }) !== value.dialect) throw invalid({ migration: params.migration, detail: \"schema provider differs from sidecar dialect\" });\n if (entry.normalization !== undefined && entry.normalization.dialect !== value.dialect) throw invalid({ migration: params.migration, detail: \"normalization dialect differs from sidecar dialect\" });\n const keys = entry.definitions.map((definition) => sqlObjectKey({ identity: definition.identity }));\n if (new Set(keys).size !== keys.length) throw invalid({ migration: params.migration, detail: \"duplicate definition\" });\n }\n}\n\n/** Canonical metadata bytes. Array order is retained because declarations may be ordered. */\nexport function canonicalMigrationJson(params: { value: unknown }): string {\n const value = params.value;\n if (Array.isArray(value)) return `[${value.map((entry) => canonicalMigrationJson({ value: entry })).join(\",\")}]`;\n if (record(value)) return `{${Object.keys(value).filter((key) => value[key] !== undefined).sort().map((key) => `${JSON.stringify(key)}:${canonicalMigrationJson({ value: value[key] })}`).join(\",\")}}`;\n return JSON.stringify(value) ?? \"null\";\n}\n\n/** Absent metadata contributes no checksum bytes, preserving old applied migrations. */\nexport function desiredStateChecksumSuffix(params: { desiredState?: MigrationDesiredState }): string {\n if (params.desiredState === undefined) return \"\";\n assertDesiredState({ value: params.desiredState, migration: \"checksum\" });\n return `\\n-- vibeorm:desired-state ${canonicalMigrationJson({ value: params.desiredState })}`;\n}\n\n/** Serialize metadata for a NEW migration; never retrofit an applied directory. */\nexport function serializeDesiredStateSidecar(params: { desiredState: MigrationDesiredState }): string {\n assertDesiredState({ value: params.desiredState, migration: \"serialize\" });\n return JSON.stringify(params.desiredState, null, 2) + \"\\n\";\n}\n\n/** Parse and validate a reviewed desired-state file. */\nexport function parseDesiredStateSidecar(params: { text: string; migration: string }): MigrationDesiredState {\n return parseMigrationMetadata({ text: params.text, parse: (value) => {\n const checked = { value, migration: params.migration };\n assertDesiredState(checked);\n return checked.value;\n }, failure: (cause) => invalid({ migration: params.migration, detail: \"malformed metadata\", cause }) });\n}\n\n/** Shared typed JSON boundary for desired-state and immutable module metadata. */\nexport function parseMigrationMetadata<T>(params: { text: string; parse: (value: unknown) => T; failure: (cause: unknown) => VibeError }): T {\n try {\n return params.parse(JSON.parse(params.text) as unknown);\n } catch (cause) {\n throw params.failure(cause);\n }\n}\n",
|
|
9
|
+
"/** Prove unfiltered MySQL FK metadata visibility without requiring global row reads. */\nexport function hasMysqlGlobalCatalogVisibility(params: { rows: readonly Record<string, unknown>[] }): boolean {\n let visible = false;\n for (const row of params.rows) {\n const values = Object.values(row);\n // Partial REVOKE records and unknown grant shapes may hide remote tables.\n // SHOW GRANTS does not expand roles; only a direct global grant is evidence.\n if (values.length !== 1 || typeof values[0] !== \"string\" || !values[0].startsWith(\"GRANT \")) return false;\n const grant = /^GRANT ([A-Z_ ,]+) ON \\*\\.\\* TO /.exec(values[0]);\n const privileges = grant?.[1]?.split(\", \") ?? [];\n if (privileges.some((privilege) => privilege === \"SHOW VIEW\" || privilege === \"SELECT\" || privilege === \"ALL PRIVILEGES\")) visible = true;\n }\n return visible;\n}\n",
|
|
10
|
+
"import { hasMysqlGlobalCatalogVisibility } from \"./mysql-catalog-visibility.ts\";\nimport { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport { getSqlDialect, renderModuleDependencyQuery } from \"@vibeorm/sql\";\nimport type { SqlObjectIdentity } from \"@vibeorm/schema\";\nimport { canonicalMigrationJson } from \"./desired-state.ts\";\nimport type { DesiredState, MigrationDesiredState } from \"./desired-state.ts\";\nimport type { ModuleMigrationOrigin } from \"./module-origin.ts\";\nimport { schemaObjectIdentities } from \"./object-ownership.ts\";\nimport { inspectMigrationInventory } from \"./inventory.ts\";\nimport { introspectPhysicalPostgres } from \"./introspect/postgres.ts\";\nimport { introspectMysql } from \"./introspect/mysql.ts\";\nimport { introspectSqlite, introspectSqliteBeforeForeignKeyRestore } from \"./introspect/sqlite.ts\";\nimport { migrationNamespace, verifyMigrationTransition, verifySqliteTransitionBeforeRestore } from \"./inspect-objects.ts\";\nimport type { SqlExecutor } from \"./types.ts\";\n\nfunction refusal(params: { reason: string; moduleId?: string; identity?: SqlObjectIdentity }): VibeError {\n return new VibeError({ code: \"VIBE_MIGRATION\", message: \"Module ownership or dependencies cannot be reconciled with the declared and live schema; no package SQL was authorized\", meta: params });\n}\nfunction identities(params: { state: DesiredState; dialect: MigrationDesiredState[\"dialect\"]; namespace: string }): SqlObjectIdentity[] {\n return [...schemaObjectIdentities({ schema: params.state.schema, dialect: params.dialect, namespace: params.namespace }), ...(params.state.schema.migrationObjects ?? []).map((object) => object.identity), ...params.state.definitions.map((definition) => definition.identity)];\n}\n\n/** Baked placement; MySQL authors must name the actual application database. */\nexport function moduleNamespace(params: { origin: ModuleMigrationOrigin }): string {\n if (params.origin.dialect !== \"mysql\") return params.origin.dialect === \"sqlite\" ? \"main\" : \"public\";\n const first = params.origin.owned[0];\n if (first === undefined) throw refusal({ reason: \"module-namespace-required\", moduleId: params.origin.moduleId });\n return \"table\" in first ? first.table.namespace : first.name.namespace;\n}\n\n/** Derive the complete exact ownership set from source declarations, not a naming prefix. */\nexport function moduleOwnedObjects(params: { desiredState: MigrationDesiredState; namespace?: string }): readonly SqlObjectIdentity[] {\n const { desiredState } = params;\n const namespace = params.namespace ?? (desiredState.dialect === \"sqlite\" ? \"main\" : \"public\");\n const all = [desiredState.from, desiredState.to, ...(desiredState.down === undefined ? [] : [desiredState.down])].flatMap((state) => identities({ state, dialect: desiredState.dialect, namespace }));\n return [...new Map(all.map((identity) => [sqlObjectKey({ identity }), identity])).values()].sort((a, b) => sqlObjectKey({ identity: a }).localeCompare(sqlObjectKey({ identity: b })));\n}\n\n/** A checksum does not turn extra ownership claims into authority over application objects. */\nexport function assertModuleOwnership(params: { origin: ModuleMigrationOrigin; desiredState?: MigrationDesiredState }): void {\n const { origin } = params;\n const state = origin.source.desiredState!;\n const namespace = moduleNamespace({ origin });\n const expected = moduleOwnedObjects({ desiredState: state, namespace });\n const owned = new Set(origin.owned.map((identity) => sqlObjectKey({ identity })));\n if (expected.length !== owned.size || expected.some((identity) => !owned.has(sqlObjectKey({ identity })))) throw refusal({ reason: \"module-ownership-invalid\", moduleId: origin.moduleId });\n for (const identity of expected) {\n const name = \"table\" in identity ? identity.table : typeof identity.name === \"object\" ? identity.name : undefined;\n if (name?.namespace !== namespace || name.name === \"_vibe_migrations\") throw refusal({ reason: \"module-ownership-invalid\", moduleId: origin.moduleId, identity });\n }\n for (const target of [state.from, state.to, ...(state.down === undefined ? [] : [state.down])]) {\n if (target.schema.rls !== undefined || target.schema.extensions.length > 0) throw refusal({ reason: \"module-schema-unsupported\", moduleId: origin.moduleId });\n for (const dependency of [...target.definitions.flatMap((definition) => definition.dependencies), ...(target.schema.migrationObjects ?? []).flatMap((object) => object.dependsOn), ...(state.unmanagedRemovals ?? [])]) {\n if (!owned.has(sqlObjectKey({ identity: dependency }))) throw refusal({ reason: \"module-external-dependency\", moduleId: origin.moduleId, identity: dependency });\n }\n }\n if (params.desiredState === undefined) return;\n const local = params.desiredState;\n const rest = (actual: DesiredState, source: DesiredState): unknown => {\n const tables = new Set(source.schema.models.map((model) => model.dbName ?? model.name));\n const enums = new Set(source.schema.enums.map((entry) => entry.dbName ?? entry.name));\n const selected = actual.schema.models.filter((model) => tables.has(model.dbName ?? model.name));\n const selectedEnums = actual.schema.enums.filter((entry) => enums.has(entry.dbName ?? entry.name));\n if (canonicalMigrationJson({ value: selected }) !== canonicalMigrationJson({ value: source.schema.models }) || canonicalMigrationJson({ value: selectedEnums }) !== canonicalMigrationJson({ value: source.schema.enums })) throw refusal({ reason: \"module-source-state-mismatch\", moduleId: origin.moduleId });\n const selectedObjects = (actual.schema.migrationObjects ?? []).filter((object) => owned.has(sqlObjectKey({ identity: object.identity })));\n const selectedDefinitions = actual.definitions.filter((definition) => owned.has(sqlObjectKey({ identity: definition.identity })));\n if (canonicalMigrationJson({ value: selectedObjects }) !== canonicalMigrationJson({ value: source.schema.migrationObjects ?? [] }) || canonicalMigrationJson({ value: selectedDefinitions }) !== canonicalMigrationJson({ value: source.definitions })) throw refusal({ reason: \"module-source-state-mismatch\", moduleId: origin.moduleId });\n return { ...actual, schema: { ...actual.schema, models: actual.schema.models.filter((model) => !tables.has(model.dbName ?? model.name)), enums: actual.schema.enums.filter((entry) => !enums.has(entry.dbName ?? entry.name)), migrationObjects: (actual.schema.migrationObjects ?? []).filter((object) => !owned.has(sqlObjectKey({ identity: object.identity }))) }, definitions: actual.definitions.filter((definition) => !owned.has(sqlObjectKey({ identity: definition.identity }))) };\n };\n const before = canonicalMigrationJson({ value: rest(local.from, state.from) });\n if (before !== canonicalMigrationJson({ value: rest(local.to, state.to) }) || before !== canonicalMigrationJson({ value: rest(local.down ?? local.from, state.down ?? state.from) })) throw refusal({ reason: \"module-mutates-application-state\", moduleId: origin.moduleId });\n}\n\nfunction dependencyUnavailable(params: { origin: ModuleMigrationOrigin; cause?: unknown }): VibeError {\n return new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot establish module foreign-key dependencies across namespaces. MySQL requires direct global SHOW VIEW (or SELECT) without partial revokes; SHOW VIEW exposes metadata without granting external row reads. Restore catalog visibility before retrying\", meta: { reason: \"module-dependency-unavailable\", moduleId: params.origin.moduleId }, ...(params.cause === undefined ? {} : { cause: params.cause }) });\n}\n\nasync function assertCrossNamespaceModuleDependencies(params: { executor: SqlExecutor; origin: ModuleMigrationOrigin; namespace: string; tables: ReadonlySet<string> }): Promise<void> {\n const { executor, origin } = params;\n const dialect = getSqlDialect({ dialect: origin.dialect });\n const query = renderModuleDependencyQuery({ dialect, operation: { kind: \"foreignKeys\", namespace: params.namespace, tables: [...params.tables] } });\n // SQLite FKs cannot name an attached database. Its existing local checks below\n // remain authoritative; a module with no owned tables has no FK endpoints.\n if (query === undefined) return;\n const visibility = renderModuleDependencyQuery({ dialect, operation: { kind: \"visibility\" } });\n if (visibility !== undefined) {\n const rows = await executor({ text: visibility.text, values: [...visibility.values] }).then(undefined, (cause: unknown) => { throw dependencyUnavailable({ origin, cause }); });\n if (!hasMysqlGlobalCatalogVisibility({ rows })) throw dependencyUnavailable({ origin });\n }\n const rows = await executor({ text: query.text, values: [...query.values] }).then(undefined, (cause: unknown) => { throw dependencyUnavailable({ origin, cause }); });\n const flags: readonly unknown[] = [true, false, 0, 1, \"0\", \"1\"];\n for (const row of rows) {\n const { constraint_name: name, source_namespace: namespace, source_table: table, target_namespace: targetNamespace, target_table: targetTable, source_owned: source, target_owned: target } = row;\n if (typeof name !== \"string\" || name.length === 0 || typeof namespace !== \"string\" || namespace.length === 0 || typeof table !== \"string\" || table.length === 0 || typeof targetNamespace !== \"string\" || targetNamespace.length === 0 || typeof targetTable !== \"string\" || targetTable.length === 0 || !flags.includes(source) || !flags.includes(target) || Number(source) + Number(target) === 0) throw dependencyUnavailable({ origin });\n if (Number(source) !== Number(target)) throw refusal({ reason: \"module-external-dependency\", moduleId: origin.moduleId, identity: { kind: \"constraint\", constraintType: \"foreignKey\", table: { namespace, name: table }, name } });\n }\n}\n\n/** Inspect full physical inventory: new objects cannot claim existing app objects or external dependents. */\nexport async function assertLiveModuleOwnership(params: { executor: SqlExecutor; origin: ModuleMigrationOrigin; resume?: boolean; sqliteRestorePending?: true }): Promise<void> {\n const { executor, origin } = params;\n const namespace = moduleNamespace({ origin });\n if (await migrationNamespace({ executor, dialect: origin.dialect }) !== namespace) throw refusal({ reason: \"module-placement-mismatch\", moduleId: origin.moduleId });\n const inventory = await inspectMigrationInventory({ executor, dialect: origin.dialect, namespace });\n const before = new Set(identities({ state: origin.source.desiredState!.from, dialect: origin.dialect, namespace }).map((identity) => sqlObjectKey({ identity })));\n const owned = new Set(origin.owned.map((identity) => sqlObjectKey({ identity })));\n const tables = new Set(origin.owned.flatMap((identity) => identity.kind === \"table\" ? [identity.name.name] : []));\n await assertCrossNamespaceModuleDependencies({ executor, origin, namespace, tables });\n for (const object of inventory) {\n const key = sqlObjectKey({ identity: object.identity });\n if (params.resume !== true && owned.has(key) && !before.has(key)) throw refusal({ reason: \"module-object-collision\", moduleId: origin.moduleId, identity: object.identity });\n if (!owned.has(key) && ([\"function\", \"view\", \"trigger\"].includes(object.identity.kind) || \"table\" in object.identity && tables.has(object.identity.table.name) && object.backingConstraint === undefined)) throw refusal({ reason: \"module-external-dependency\", moduleId: origin.moduleId, identity: object.identity });\n if (object.inspectionUnavailable !== undefined && (owned.has(key) || \"table\" in object.identity && tables.has(object.identity.table.name))) throw refusal({ reason: \"module-dependency-unavailable\", moduleId: origin.moduleId, identity: object.identity });\n }\n const physical = origin.dialect === \"postgres\" ? await introspectPhysicalPostgres({ executor }) : origin.dialect === \"mysql\" ? await introspectMysql({ executor }) : params.sqliteRestorePending === true ? await introspectSqliteBeforeForeignKeyRestore({ executor }) : await introspectSqlite({ executor });\n for (const model of physical.models) for (const relation of model.relations) {\n const target = physical.models.find((candidate) => candidate.name === relation.targetModel);\n if (target !== undefined && tables.has(model.dbName ?? model.name) !== tables.has(target.dbName ?? target.name)) throw refusal({ reason: \"module-external-dependency\", moduleId: origin.moduleId });\n }\n}\n\n/** Protect installed module objects without requiring an application snapshot. */\nexport async function assertApplicationModuleState(params: {\n executor: SqlExecutor;\n origins: readonly ModuleMigrationOrigin[];\n probe?: \"none\" | \"rollback\" | \"temporary\";\n sqliteRestorePending?: true;\n}): Promise<void> {\n for (const origin of params.origins) {\n await assertLiveModuleOwnership({ executor: params.executor, origin, resume: true, ...(params.sqliteRestorePending === true ? { sqliteRestorePending: true } : {}) });\n const state = origin.source.desiredState!;\n const options = { executor: params.executor, dialect: origin.dialect, from: state.from, to: state.to, removals: state.unmanagedRemovals, ...(params.probe === undefined ? {} : { probe: params.probe }) };\n const report = params.sqliteRestorePending === true ? await verifySqliteTransitionBeforeRestore(options) : await verifyMigrationTransition(options);\n if (!report.inSync) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Application SQL cannot change objects owned by module ${origin.moduleId}; use its reviewed module upgrade`, meta: { reason: \"module-application-mutation\", moduleId: origin.moduleId, report } });\n }\n}\n",
|
|
11
|
+
"import { VibeError, sqlObjectKey, enumStorageOf } from \"@vibeorm/schema\";\nimport type { Dialect, ExtensionArtifact, MigrationObjectIR, SchemaIR, SqlObjectIdentity } from \"@vibeorm/schema\";\nimport type { MigrationStep } from \"./types.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { normalizeSchema } from \"./normalize.ts\";\n\n/** Legacy artifact registrations enter the same identity pipeline as migration-only objects. */\nexport function legacyMigrationObjects(params: { artifacts: readonly ExtensionArtifact[]; dialect: Dialect; namespace: string }): MigrationObjectIR[] {\n return params.artifacts.map((artifact) => {\n const owner = artifact.owns;\n const table = \"table\" in owner ? { namespace: params.namespace, name: owner.table } : undefined;\n let identity: SqlObjectIdentity;\n switch (owner.kind) {\n case \"postgresExtension\": case \"table\": identity = { kind: owner.kind, name: { namespace: params.namespace, name: owner.name } }; break;\n case \"column\": identity = { kind: \"column\", table: table!, column: owner.column }; break;\n case \"index\": case \"trigger\": identity = { kind: owner.kind, table: table!, name: owner.name }; break;\n }\n return { id: artifact.id, dialect: params.dialect, identity, create: artifact.create, drop: artifact.drop, dependsOn: artifact.expected?.dependencies ?? [], ...(artifact.expected === undefined ? {} : { expected: artifact.expected }) };\n });\n}\n\n/** Remove only migration-owned portions of physical IR, preserving unrelated fields and constraints. */\nexport function preserveMigrationObjects(params: { from: SchemaIR; to: SchemaIR; objects: readonly MigrationObjectIR[]; namespace?: string }): SchemaIR {\n const namespace = params.namespace ?? (params.to.datasource.provider === \"sqlite\" ? \"main\" : \"public\");\n const objects = params.objects.filter((object) => (\"table\" in object.identity ? object.identity.table.namespace : object.identity.name.namespace) === namespace);\n const models = params.from.models.flatMap((model) => {\n const table = model.dbName ?? model.name;\n const target = params.to.models.find((entry) => (entry.dbName ?? entry.name) === table);\n if (objects.some((object) => (object.identity.kind === \"table\" || object.identity.kind === \"view\") && object.identity.name.name === table)) return [];\n const owners = objects.map((object) => object.identity).filter((identity) => \"table\" in identity && identity.table.name === table);\n return [{ ...model,\n fields: model.fields.flatMap((field) => {\n const column = field.dbName ?? field.name;\n if (owners.some((owner) => owner.kind === \"column\" && owner.column === column)) return [];\n if (owners.some((owner) => (owner.kind === \"columnDefault\" || owner.kind === \"generatedColumn\") && owner.column === column)) {\n const authored = target?.fields.find((entry) => (entry.dbName ?? entry.name) === column);\n if (authored === undefined) return [field];\n const { default: ignored, ...rest } = field;\n return [{ ...rest, ...(authored.default === undefined ? {} : { default: authored.default }) }];\n }\n return [field];\n }),\n exclusions: (model.exclusions ?? []).filter((exclusion) => !owners.some((owner) => owner.kind === \"constraint\" && owner.constraintType === \"exclusion\" && owner.name === exclusion.name)),\n checks: (model.checks ?? []).filter((check) => !owners.some((owner) => owner.kind === \"constraint\" && owner.constraintType === \"check\" && owner.name === check.name)),\n indexes: model.indexes.filter((index) => !owners.some((owner) => owner.kind === \"index\" && owner.name === index.name)),\n relations: model.relations.filter((relation) => !owners.some((owner) => owner.kind === \"constraint\" && owner.constraintType === \"foreignKey\" && owner.name === relation.constraintName)),\n }];\n });\n const enums = params.from.enums.filter((enumDef) => enumStorageOf({ enumDef }) === \"string\" || !objects.some((object) => object.identity.kind === \"enum\" && object.identity.name.name === (enumDef.dbName ?? enumDef.name)));\n return { ...params.from, models, enums };\n}\n\n/** Rebuild targets must retain migration-owned constraints and indexes that the core diff excludes. */\nexport function sqlitePreservedSchema(params: { from: SchemaIR; to: SchemaIR; objects: readonly MigrationObjectIR[] }): SchemaIR {\n return { ...params.to, models: params.to.models.map((model) => {\n const table = model.dbName ?? model.name;\n const before = params.from.models.find((entry) => (entry.dbName ?? entry.name) === table);\n if (before === undefined) return model;\n const owners = params.objects.map((object) => object.identity).filter((owner) => \"table\" in owner && owner.table.namespace === \"main\" && owner.table.name === table);\n return { ...model,\n checks: [...(model.checks ?? []), ...(before.checks ?? []).filter((check) => !model.checks?.some((entry) => entry.name === check.name) && owners.some((owner) => owner.kind === \"constraint\" && owner.constraintType === \"check\" && owner.name === check.name))],\n indexes: [...model.indexes, ...before.indexes.filter((index) => !model.indexes.some((entry) => entry.name === index.name) && owners.some((owner) => owner.kind === \"index\" && owner.name === index.name))],\n relations: [...model.relations, ...before.relations.filter((relation) => !model.relations.some((entry) => entry.constraintName === relation.constraintName) && owners.some((owner) => owner.kind === \"constraint\" && owner.constraintType === \"foreignKey\" && owner.name === relation.constraintName))],\n };\n }) };\n}\n\n/** Physical identity of a removal proposed by the core differ. */\nexport function removalIdentity(params: { step: MigrationStep; namespace: string }): SqlObjectIdentity | undefined {\n const { step, namespace } = params;\n const table = \"table\" in step && step.table !== undefined ? { namespace, name: step.table } : undefined;\n switch (step.kind) {\n case \"dropEnum\": return { kind: \"enum\", name: { namespace, name: step.enumName } };\n case \"dropTable\": case \"dropJoinTable\": return { kind: \"table\", name: table! };\n case \"dropView\": return { kind: \"view\", name: table! };\n case \"dropColumn\": return { kind: \"column\", table: table!, column: step.column };\n case \"alterColumn\": return step.changes.includes(\"default\") && step.from.default !== undefined ? { kind: \"columnDefault\", table: table!, column: step.column } : undefined;\n case \"dropIndex\": return table === undefined ? undefined : step.constraintName === undefined ? { kind: \"index\", table, name: step.name } : { kind: \"constraint\", constraintType: \"unique\", table, name: step.constraintName };\n case \"dropExclusion\": return { kind: \"constraint\", constraintType: \"exclusion\", table: table!, name: step.exclusion.name };\n case \"dropCheck\": return { kind: \"constraint\", constraintType: \"check\", table: table!, name: step.name };\n case \"dropForeignKey\": return { kind: \"constraint\", constraintType: \"foreignKey\", table: table!, name: step.constraintName };\n case \"dropPrimaryKey\": return { kind: \"constraint\", constraintType: \"primaryKey\", table: table!, name: step.constraintName ?? `${step.table}_pkey` };\n default: return undefined;\n }\n}\n\n/** Known ownership from the previous authored declaration, not a target snapshot. */\nexport function schemaObjectIdentities(params: { schema: SchemaIR; dialect: Dialect; namespace: string }): SqlObjectIdentity[] {\n const normalized = normalizeSchema({ schema: params.schema, dialect: params.dialect });\n const result: SqlObjectIdentity[] = [];\n if (params.dialect === \"postgres\") for (const name of normalized.enums.keys()) result.push({ kind: \"enum\", name: { namespace: params.namespace, name } });\n for (const [name, model] of normalized.tables) {\n const table = { namespace: params.namespace, name };\n result.push({ kind: \"table\", name: table });\n for (const [column, definition] of model.columns) {\n result.push({ kind: \"column\", table, column });\n if (definition.defaultKey !== null) result.push({ kind: \"columnDefault\", table, column });\n if (params.dialect === \"postgres\" && definition.field.default?.kind === \"autoincrement\") result.push({ kind: \"sequence\", name: { namespace: params.namespace, name: `${name}_${column}_seq` } });\n }\n for (const exclusion of model.model.exclusions ?? []) result.push({ kind: \"constraint\", constraintType: \"exclusion\", table, name: exclusion.name });\n for (const check of model.checks.keys()) result.push({ kind: \"constraint\", constraintType: \"check\", table, name: check });\n for (const index of model.indexes.values()) {\n result.push({ kind: \"index\", table, name: index.name });\n if (index.constraintName !== undefined) result.push({ kind: \"constraint\", constraintType: \"unique\", table, name: index.constraintName });\n }\n for (const fk of model.fks.values()) result.push({ kind: \"constraint\", constraintType: \"foreignKey\", table, name: fk.constraintName });\n if (model.pk.length > 0) result.push({ kind: \"constraint\", constraintType: \"primaryKey\", table, name: model.model.primaryKeyConstraintName ?? (params.dialect === \"mysql\" ? \"PRIMARY\" : `${name}_pkey`) });\n }\n for (const name of normalized.joinTables.keys()) {\n const table = { namespace: params.namespace, name };\n result.push({ kind: \"table\", name: table });\n for (const column of [\"A\", \"B\"]) result.push({ kind: \"column\", table, column }, { kind: \"constraint\", constraintType: \"foreignKey\", table, name: `${name}_${column}_fkey` });\n for (const suffix of [\"AB_unique\", \"B_index\"]) result.push({ kind: \"index\", table, name: `${name}_${suffix}` });\n }\n for (const name of normalized.views.keys()) result.push({ kind: \"view\", name: { namespace: params.namespace, name } });\n return result;\n}\n\n/** A removed registration cannot silently surrender previously trusted ownership. */\nexport function assertRetainedMigrationObjects(params: { from: readonly MigrationObjectIR[]; to: readonly MigrationObjectIR[] }): void {\n const keys = new Set(params.to.map((object) => sqlObjectKey({ identity: object.identity })));\n const removed = params.from.filter((object) => !keys.has(sqlObjectKey({ identity: object.identity })));\n if (removed.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Removing migration ownership requires a reviewed hand-authored migration and new desired state\", meta: { reason: \"migration-object-removal-review-required\", shadowReusable: true, objects: removed.map((object) => object.identity) } });\n}\n\n/** One dependency order for live planning, authored generation and reverse artifact removal. */\nexport function orderedMigrationObjects(params: { objects: readonly MigrationObjectIR[] }): MigrationObjectIR[] {\n const byKey = new Map(params.objects.map((object) => [sqlObjectKey({ identity: object.identity }), object]));\n const result: MigrationObjectIR[] = [];\n const visiting = new Set<string>();\n const visited = new Set<string>();\n const visit = (object: MigrationObjectIR): void => {\n const key = sqlObjectKey({ identity: object.identity });\n if (visited.has(key)) return;\n if (visiting.has(key)) throw new VibeError({ code: \"VIBE_SCHEMA_INVALID\", message: \"Migration object dependency cycle\", meta: { id: object.id } });\n visiting.add(key);\n for (const dependency of object.dependsOn) { const target = byKey.get(sqlObjectKey({ identity: dependency })); if (target !== undefined) visit(target); }\n visiting.delete(key);\n visited.add(key);\n result.push(object);\n };\n for (const object of params.objects) visit(object);\n return result;\n}\n\n/** Exact unmanaged identities require acknowledgement even when removal is collateral DDL. */\nexport function assertNamedRemovals(params: { removals: readonly SqlObjectIdentity[]; approved?: readonly SqlObjectIdentity[]; acceptIntegrityLoss?: boolean }): void {\n const approved = new Set((params.approved ?? []).map((identity) => sqlObjectKey({ identity })));\n const missing = params.removals.filter((identity) => !approved.has(sqlObjectKey({ identity })));\n if (missing.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Unmanaged removals require individually named approvals\", meta: { reason: \"unmanaged-removal-required\", shadowReusable: true, objects: missing } });\n const integrity = params.removals.filter((identity) => identity.kind === \"constraint\" || identity.kind === \"index\");\n if (integrity.length > 0 && params.acceptIntegrityLoss !== true) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Named constraint or index removals also require acceptIntegrityLoss\", meta: { reason: \"integrity-acknowledgement-required\", shadowReusable: true, objects: integrity } });\n}\n\n/** Independent authorizations: row loss does not authorize integrity loss or unnamed removals. */\nexport function assertRemovalAuthorization(params: { steps: readonly MigrationStep[]; previous?: DesiredState; dialect: Dialect; namespace: string; acceptIntegrityLoss?: boolean; removeUnmanaged?: readonly SqlObjectIdentity[] }): void {\n const declared = params.previous === undefined ? [] : schemaObjectIdentities({ schema: params.previous.schema, dialect: params.dialect, namespace: params.namespace });\n const known = new Set(declared.map((identity) => sqlObjectKey({ identity })));\n const approved = new Set((params.removeUnmanaged ?? []).map((identity) => sqlObjectKey({ identity })));\n const unknown: SqlObjectIdentity[] = [];\n const integrity: SqlObjectIdentity[] = [];\n for (const step of params.steps) {\n const identity = removalIdentity({ step, namespace: params.namespace });\n if (identity === undefined) continue;\n const key = sqlObjectKey({ identity });\n if (!known.has(key) && !approved.has(key)) unknown.push(identity);\n if (identity.kind === \"constraint\" || identity.kind === \"index\") integrity.push(identity);\n if (step.kind === \"dropTable\" || step.kind === \"dropJoinTable\") {\n for (const child of [...declared, ...(params.removeUnmanaged ?? [])]) {\n if ((child.kind === \"constraint\" || child.kind === \"index\") && child.table.namespace === params.namespace && child.table.name === step.table) integrity.push(child);\n }\n }\n }\n if (unknown.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Unknown object removals require individually named removeUnmanaged decisions\", meta: { reason: \"unmanaged-removal-required\", shadowReusable: true, objects: unknown } });\n if (integrity.length > 0 && params.acceptIntegrityLoss !== true) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Constraint or index removal requires acceptIntegrityLoss; data-loss acknowledgement does not authorize it\", meta: { reason: \"integrity-acknowledgement-required\", shadowReusable: true, objects: integrity } });\n}\n",
|
|
8
12
|
"/**\n * Schema-IR normalization for diffing.\n *\n * Both sides of a diff (a parsed/DSL schema and an introspected one) collapse\n * into the same normalized shape, so representation differences never produce\n * phantom steps. The normalizations, each pinned by a differ test:\n *\n * - `@unique` on a field and a `kind: \"unique\"` model index are the same\n * unique index (the database stores both identically).\n * - A single `@id` field and a single-field `@@id` are the same primary key.\n * - Field names resolve to db names (`@map` / `@@map`) everywhere.\n * - FK cascade actions resolve Prisma's defaults (required → Restrict,\n * optional → SetNull, onUpdate → Cascade) before comparing.\n * - App-level defaults (uuid/cuid/nanoid/ulid) compare as \"no database\n * default\"; `isUpdatedAt` is app-level and ignored entirely.\n * - Implicit M2M pairs collapse to their join table regardless of whether the\n * sides are parser `manyToMany` fields or introspected unnamed `oneToMany`\n * list sides (structural detection, LEARNINGS).\n * - Views never join the table diff (migrate does not manage view DDL in this\n * wave) but ARE collected by db name, so the differ can emit DROP VIEW for\n * views the target schema no longer declares (board #26).\n */\n\nimport { VibeError, enumStorageOf, isEnumType, unsupportedCapability } from \"@vibeorm/schema\";\nimport type {\n CascadeAction,\n Dialect,\n EnumIR,\n FieldIR,\n IndexIR,\n ModelIR,\n SchemaIR,\n} from \"@vibeorm/schema\";\nimport { detectImplicitM2MPairs } from \"./relations.ts\";\nimport {\n columnTypeKey,\n columnTypeSql,\n normalizeNativeType,\n defaultFingerprint,\n resolveOnDelete,\n resolveOnUpdate,\n} from \"./postgres-types.ts\";\nimport { sqliteColumnTypeKey, sqliteDefaultFingerprint } from \"./sqlite-types.ts\";\nimport { mysqlColumnTypeKey, mysqlColumnTypeSql, mysqlDefaultFingerprint, normalizeMysqlType } from \"./mysql-types.ts\";\nimport type { IndexColumn, JoinTableEnd } from \"./types.ts\";\n\n// ─── Normalized shapes ────────────────────────────────────────────\n\n/** A column ready for comparison. */\nexport type NormalizedColumn = {\n /** Column db name. */\n readonly name: string;\n readonly field: FieldIR;\n readonly typeKey: string;\n readonly nullable: boolean;\n readonly defaultKey: string | null;\n};\n\n/** An index (unique or not) ready for comparison. `key` ignores the name. */\nexport type NormalizedIndex = {\n readonly constraintName?: string;\n readonly key: string;\n readonly name: string;\n readonly kind: string;\n readonly unique: boolean;\n readonly columns: readonly IndexColumn[];\n readonly where?: string;\n /** `UNIQUE NULLS NOT DISTINCT` (postgres 15+). */\n readonly nullsNotDistinct?: boolean;\n};\n\n/** A foreign key ready for comparison. `key` excludes the cascade actions. */\nexport type NormalizedFk = {\n readonly key: string;\n readonly constraintName: string;\n readonly columns: readonly string[];\n readonly refTable: string;\n readonly refColumns: readonly string[];\n readonly onDelete: CascadeAction;\n readonly onUpdate: CascadeAction;\n};\n\n/** A model collapsed to its database shape. */\nexport type NormalizedTable = {\n readonly model: ModelIR;\n /** Table db name. */\n readonly table: string;\n readonly columns: ReadonlyMap<string, NormalizedColumn>;\n /** Primary-key column db names (empty = none). */\n readonly pk: readonly string[];\n readonly indexes: ReadonlyMap<string, NormalizedIndex>;\n readonly fks: ReadonlyMap<string, NormalizedFk>;\n /** CHECK names and authored expressions; live callers establish normalized equivalence first. */\n readonly checks: ReadonlyMap<string, string>;\n};\n\n/** An implicit M2M join table collapsed to its database shape. */\nexport type NormalizedJoinTable = {\n readonly table: string;\n readonly a: JoinTableEnd;\n readonly b: JoinTableEnd;\n};\n\n/** A whole schema, ready for diffing. */\nexport type NormalizedSchema = {\n readonly tables: ReadonlyMap<string, NormalizedTable>;\n readonly joinTables: ReadonlyMap<string, NormalizedJoinTable>;\n /** Enums keyed by db name. */\n readonly enums: ReadonlyMap<string, EnumIR>;\n /** View models keyed by db name — present for drop detection only (#26). */\n readonly views: ReadonlyMap<string, ModelIR>;\n};\n\n// ─── Entry point ──────────────────────────────────────────────────\n\n/**\n * Collapse a SchemaIR into its comparable database shape. `dialect` (default\n * postgres) selects the column comparison keys: on sqlite columns compare by\n * STORAGE CLASS (TEXT/INTEGER/REAL/BLOB — the TEXT-ambiguity rule), on mysql\n * by mysql column type; enum columns on both compare by VALUE LIST, never by\n * name (the database does not store one).\n */\nexport function normalizeSchema(params: {\n schema: SchemaIR;\n dialect?: Dialect;\n}): NormalizedSchema {\n const { schema } = params;\n const dialect = params.dialect ?? \"postgres\";\n\n const enums = new Map<string, EnumIR>();\n for (const enumDef of schema.enums) {\n if (enumStorageOf({ enumDef }) === \"string\") continue;\n enums.set(enumDef.dbName ?? enumDef.name, enumDef);\n }\n\n const tables = new Map<string, NormalizedTable>();\n const views = new Map<string, ModelIR>();\n for (const model of schema.models) {\n if (model.isView) {\n views.set(model.dbName ?? model.name, model);\n continue;\n }\n const table = normalizeModel({ model, schema, dialect, enums });\n tables.set(table.table, table);\n }\n\n const joinTables = new Map<string, NormalizedJoinTable>();\n for (const pair of detectImplicitM2MPairs({ schema })) {\n joinTables.set(pair.tableName, normalizeJoinTable({ pair, schema, dialect }));\n }\n\n return { tables, joinTables, enums, views };\n}\n\n// ─── Logical enum → physical String ───────────────────────────────\n\nfunction physicalEnumField(params: { field: FieldIR; schema: SchemaIR; dialect: Dialect; table: string }): FieldIR {\n const { field, schema, dialect, table } = params;\n if (!isEnumType(field.type)) return field;\n const name = field.type.enum;\n const enumDef = schema.enums.find((candidate) => candidate.name === name || candidate.dbName === name);\n if (enumDef === undefined) return field;\n if (enumStorageOf({ enumDef }) !== \"string\") {\n return dialect === \"postgres\" ? { ...field, type: { enum: enumDef.dbName ?? enumDef.name } } : field;\n }\n const physical: FieldIR = {\n ...field,\n type: \"String\",\n ...(field.default?.kind === \"enumValue\" ? { default: { kind: \"literal\", value: field.default.value } } : {}),\n };\n assertStringEnumLabelsFit({ field: physical, values: enumDef.values, dialect, table });\n return physical;\n}\n\nconst MYSQL_TEXT_BYTES: Readonly<Record<string, number>> = {\n tinytext: 255,\n text: 65_535,\n mediumtext: 16_777_215,\n longtext: 4_294_967_295,\n};\n\n/** Refuse string storage that cannot preserve every enum label verbatim. */\nexport function assertStringEnumLabelsFit(params: {\n field: FieldIR;\n values: readonly string[];\n dialect: Dialect;\n table: string;\n}): void {\n const { field, values, dialect, table } = params;\n // SQLite's ordinary String mapping ignores native-type annotations and is\n // always unbounded TEXT. PostgreSQL/MySQL retain supported text overrides.\n if (dialect === \"sqlite\") return;\n const type = dialect === \"postgres\"\n ? normalizeNativeType({ raw: columnTypeSql({ field: { ...field, isList: false } }) })\n : normalizeMysqlType({ raw: mysqlColumnTypeSql({ field, enums: new Map() }) });\n const varchar = /^varchar(?:\\((\\d+)\\))?$/.exec(type);\n const textBytes = dialect === \"mysql\" ? MYSQL_TEXT_BYTES[type] : undefined;\n const supported = type === \"text\" || varchar !== null || textBytes !== undefined;\n const charLimit = varchar?.[1] === undefined ? undefined : Number(varchar[1]);\n const tooLong = values.some((value) =>\n (charLimit !== undefined && [...value].length > charLimit) ||\n (textBytes !== undefined && new TextEncoder().encode(value).length > textBytes),\n );\n if (!supported || tooLong) {\n throw unsupportedCapability({\n dialect,\n feature: `string enum column \"${table}\".\"${field.dbName ?? field.name}\" stored as ${type}`,\n hint: supported\n ? \"an enum label exceeds the physical column limit — choose a wider varchar or text type\"\n : \"use text or varchar storage; other types cannot preserve arbitrary enum labels verbatim\",\n });\n }\n}\n\n// ─── Per-dialect column keys ─────────────────────────────────\n\n/** Dialect-routed column type comparison key. */\nexport function columnTypeKeyFor(params: {\n field: FieldIR;\n dialect: Dialect;\n enums: ReadonlyMap<string, EnumIR>;\n}): string {\n const { field, dialect, enums } = params;\n switch (dialect) {\n case \"postgres\":\n return columnTypeKey({ field });\n case \"sqlite\":\n return sqliteColumnTypeKey({ field, enums });\n case \"mysql\":\n return mysqlColumnTypeKey({ field, enums });\n }\n}\n\n/** Dialect-routed default fingerprint. */\nexport function defaultFingerprintFor(params: {\n field: FieldIR;\n dialect: Dialect;\n}): string | null {\n const { field, dialect } = params;\n switch (dialect) {\n case \"postgres\":\n return defaultFingerprint({ field });\n case \"sqlite\":\n return sqliteDefaultFingerprint({ field });\n case \"mysql\":\n return mysqlDefaultFingerprint({ field });\n }\n}\n\n// ─── Model → table ────────────────────────────────────────────────\n\nfunction normalizeModel(params: {\n model: ModelIR;\n schema: SchemaIR;\n dialect: Dialect;\n enums: ReadonlyMap<string, EnumIR>;\n}): NormalizedTable {\n const { model, schema, dialect, enums } = params;\n const table = model.dbName ?? model.name;\n\n const columns = new Map<string, NormalizedColumn>();\n for (const logicalField of model.fields) {\n const field = physicalEnumField({ field: logicalField, schema, dialect, table });\n const name = field.dbName ?? field.name;\n columns.set(name, {\n name,\n field,\n typeKey: columnTypeKeyFor({ field, dialect, enums }),\n nullable: field.isOptional,\n defaultKey: defaultFingerprintFor({ field, dialect }),\n });\n }\n\n const pk = normalizePk({ model });\n const indexes = normalizeIndexes({ model, table });\n const fks = normalizeFks({ model, table, schema });\n\n const checks = new Map<string, string>();\n for (const check of model.checks ?? []) checks.set(check.name, check.expression);\n\n return { model, table, columns, pk, indexes, fks, checks };\n}\n\nfunction normalizePk(params: { model: ModelIR }): readonly string[] {\n const { model } = params;\n if (model.primaryKey !== undefined && model.primaryKey.fields.length > 0) {\n return model.primaryKey.fields.map((name) => fieldDbName({ model, name }));\n }\n return model.fields.filter((field) => field.isId).map((field) => field.dbName ?? field.name);\n}\n\nfunction normalizeIndexes(params: {\n model: ModelIR;\n table: string;\n}): ReadonlyMap<string, NormalizedIndex> {\n const { model, table } = params;\n const result = new Map<string, NormalizedIndex>();\n\n const add = (index: IndexIR): void => {\n const unique = index.kind === \"unique\";\n const kind = unique ? \"btree\" : index.kind;\n const columns: IndexColumn[] = index.fields.map((field) => {\n const fieldIR = model.fields.find((candidate) => candidate.name === field.name);\n // SQLITE-2: Decimal-typed index columns carry a marker — the sqlite DDL\n // renderer emits CAST(col AS REAL) expression indexes so B4's cast\n // compare sites stay indexable. Inert on other dialects and absent from\n // the comparison key.\n const decimal = fieldIR !== undefined && fieldIR.type === \"Decimal\" && fieldIR.isList !== true;\n return {\n name: fieldDbName({ model, name: field.name }),\n desc: field.sort === \"desc\",\n ...(decimal ? { decimal: true } : {}),\n };\n });\n const where = index.where;\n const nullsNotDistinct = unique && index.nullsNotDistinct === true;\n const key = indexComparisonKey({ unique, kind, columns, where, nullsNotDistinct });\n if (result.has(key)) return;\n const name =\n index.name ??\n `${table}_${columns.map((column) => column.name).join(\"_\")}_${unique ? \"key\" : \"idx\"}`;\n result.set(key, {\n key,\n name,\n ...(index.constraintName === undefined ? {} : { constraintName: index.constraintName }),\n kind,\n unique,\n columns,\n ...(where === undefined ? {} : { where }),\n ...(nullsNotDistinct ? { nullsNotDistinct: true } : {}),\n });\n };\n\n for (const index of model.indexes) add(index);\n\n // `@unique` on a field is the same database object as `@@unique([field])`.\n for (const field of model.fields) {\n if (!field.isUnique) continue;\n add({ kind: \"unique\", fields: [{ name: field.name }] });\n }\n\n return result;\n}\n\nfunction indexComparisonKey(params: {\n unique: boolean;\n kind: string;\n columns: readonly IndexColumn[];\n where: string | undefined;\n nullsNotDistinct?: boolean;\n}): string {\n const { unique, kind, columns, where, nullsNotDistinct } = params;\n const cols = columns\n .map((column) => `${column.name}${column.desc ? \" desc\" : \"\"}`)\n .join(\",\");\n return `${unique ? \"u\" : \"i\"}${nullsNotDistinct === true ? \"n\" : \"\"}:${kind}:${cols}:${normalizeWhere({ where })}`;\n}\n\n/**\n * Comparison key for a partial-index predicate.\n *\n * Literal bytes, quoted identifier case and casts are semantic. Only the\n * supported boolean structure is reparenthesized. Quoted and unquoted names\n * may conservatively compare unequal; equivalence requires catalog evidence.\n * Complex lexical forms remain opaque rather than claiming false convergence.\n */\nexport function normalizeWhere(params: { where: string | undefined }): string {\n const { where } = params;\n if (where === undefined || where.trim() === \"\") return \"\";\n if (/\\$|\\\\|--|\\/\\*/.test(where)) return `raw:${where.trim()}`;\n const tokens = tokenizeWhere({ text: where });\n const parsed = parseOrExpression({ tokens, at: 0 });\n return parsed !== undefined && parsed.at === tokens.length\n ? parsed.text\n : tokens.join(\" \");\n}\n\n/** Tokenize the supported lexical subset without erasing quoted names or casts. */\nfunction tokenizeWhere(params: { text: string }): string[] {\n const { text } = params;\n const tokens: string[] = [];\n let i = 0;\n while (i < text.length) {\n const ch = text[i] as string;\n if (/\\s/.test(ch)) {\n i += 1;\n continue;\n }\n if (ch === \"'\") {\n // A literal is DATA: its bytes and its case decide equality.\n let literal = \"'\";\n i += 1;\n while (i < text.length) {\n literal += text[i];\n if (text[i] === \"'\") {\n if (text[i + 1] === \"'\") {\n literal += \"'\";\n i += 2;\n continue;\n }\n i += 1;\n break;\n }\n i += 1;\n }\n tokens.push(literal);\n continue;\n }\n if (ch === '\"' || ch === \"`\") {\n let name = \"\";\n i += 1;\n while (i < text.length) {\n if (text[i] === ch) {\n if (text[i + 1] !== ch) { i += 1; break; }\n name += ch;\n i += 2;\n } else {\n name += text[i];\n i += 1;\n }\n }\n tokens.push(JSON.stringify(name));\n continue;\n }\n if (ch === \"[\") {\n // A bracket can quote a SQLite identifier or carry PostgreSQL array\n // structure. Never consume ARRAY literal bytes as an identifier.\n const end = text.indexOf(\"]\", i + 1);\n const inner = end === -1 ? undefined : text.slice(i + 1, end);\n if (\n inner !== undefined &&\n tokens[tokens.length - 1] !== \"array\" &&\n /^[A-Za-z_][A-Za-z_0-9$]*$/.test(inner)\n ) {\n tokens.push(JSON.stringify(inner));\n i = end + 1;\n continue;\n }\n tokens.push(ch);\n i += 1;\n continue;\n }\n const word = /^[A-Za-z_][A-Za-z_0-9$]*/.exec(text.slice(i));\n if (word !== null) {\n tokens.push(word[0].toLowerCase());\n i += word[0].length;\n continue;\n }\n const number = /^[0-9]+(?:\\.[0-9]+)?/.exec(text.slice(i));\n if (number !== null) {\n tokens.push(number[0]);\n i += number[0].length;\n continue;\n }\n tokens.push(ch);\n i += 1;\n }\n return tokens;\n}\n\ntype ParsedExpression = { text: string; at: number; kind: \"or\" | \"and\" | \"atom\" };\n\n/** `<and> (OR <and>)*` — the loosest binding level. */\nfunction parseOrExpression(params: {\n tokens: readonly string[];\n at: number;\n}): ParsedExpression | undefined {\n const first = parseAndExpression({ tokens: params.tokens, at: params.at });\n if (first === undefined) return undefined;\n let at = first.at;\n const parts = [first.text];\n while (params.tokens[at] === \"or\") {\n const next = parseAndExpression({ tokens: params.tokens, at: at + 1 });\n if (next === undefined) return undefined;\n parts.push(next.text);\n at = next.at;\n }\n return parts.length === 1\n ? { text: parts[0] as string, at, kind: first.kind }\n : { text: parts.join(\" or \"), at, kind: \"or\" };\n}\n\n/** `<primary> (AND <primary>)*` — binds tighter than OR, so OR operands get parentheses. */\nfunction parseAndExpression(params: {\n tokens: readonly string[];\n at: number;\n}): ParsedExpression | undefined {\n const first = parsePrimaryExpression({ tokens: params.tokens, at: params.at });\n if (first === undefined) return undefined;\n let at = first.at;\n const operands: ParsedExpression[] = [first];\n while (params.tokens[at] === \"and\") {\n const next = parsePrimaryExpression({ tokens: params.tokens, at: at + 1 });\n if (next === undefined) return undefined;\n operands.push(next);\n at = next.at;\n }\n // Parentheses are re-added only where AND binds tighter than an OR operand.\n return operands.length === 1\n ? { text: first.text, at, kind: first.kind }\n : {\n text: operands\n .map((operand) => (operand.kind === \"or\" ? `(${operand.text})` : operand.text))\n .join(\" and \"),\n at,\n kind: \"and\",\n };\n}\n\n/** A parenthesized group, a `NOT`, or an atom read up to the next top-level operator. */\nfunction parsePrimaryExpression(params: {\n tokens: readonly string[];\n at: number;\n}): ParsedExpression | undefined {\n const { tokens } = params;\n let at = params.at;\n if (tokens[at] === \"not\") {\n const operand = parsePrimaryExpression({ tokens, at: at + 1 });\n if (operand === undefined) return undefined;\n const inner = operand.kind === \"atom\" ? operand.text : `(${operand.text})`;\n return { text: `not ${inner}`, at: operand.at, kind: \"atom\" };\n }\n if (tokens[at] === \"(\") {\n const inner = parseOrExpression({ tokens, at: at + 1 });\n if (inner === undefined || tokens[inner.at] !== \")\") return undefined;\n // The parentheses themselves are formatting; the STRUCTURE they created is\n // carried in `kind` and re-parenthesized only where precedence needs it.\n return { text: inner.text, at: inner.at + 1, kind: inner.kind };\n }\n const parts: string[] = [];\n let depth = 0;\n while (at < tokens.length) {\n const token = tokens[at] as string;\n if (depth === 0 && (token === \"and\" || token === \"or\" || token === \")\")) break;\n if (token === \"(\") depth += 1;\n if (token === \")\") depth -= 1;\n parts.push(token);\n at += 1;\n }\n if (parts.length === 0) return undefined;\n // PostgreSQL omits unnecessary identifier quotes in these simple predicates.\n // Restrict this equivalence to a column null-check: quotes on SQL values,\n // function names, casts and mixed-case identifiers must remain significant.\n if (parts[1] === \"is\" && (parts.length === 3 && parts[2] === \"null\" || parts.length === 4 && parts[2] === \"not\" && parts[3] === \"null\")) {\n const quoted = /^\"([a-z_][a-z_0-9]*)\"$/.exec(parts[0]!);\n if (quoted !== null && !/^(?:true|false|null|unknown|default|user|current_.*|session_user|system_user|localtime|localtimestamp|and|or|not|is)$/.test(quoted[1]!)) parts[0] = quoted[1]!;\n }\n return { text: parts.join(\" \"), at, kind: \"atom\" };\n}\n\nfunction normalizeFks(params: {\n model: ModelIR;\n table: string;\n schema: SchemaIR;\n}): ReadonlyMap<string, NormalizedFk> {\n const { model, table, schema } = params;\n const result = new Map<string, NormalizedFk>();\n\n for (const relation of model.relations) {\n if (relation.fields === undefined || relation.fields.length === 0) continue;\n\n const target = schema.models.find((candidate) => candidate.name === relation.targetModel);\n // A view is not a table — no dialect can reference one from a foreign key.\n // Views are skipped as tables everywhere else here (normalizeSchema,\n // differ, detectImplicitM2MPairs); the FK side skips them for the same\n // reason, so a model may carry a relation INTO a view for query purposes\n // without the DDL ever trying to constrain it.\n if (target !== undefined && target.isView) continue;\n const refTable = target === undefined ? relation.targetModel : (target.dbName ?? target.name);\n const columns = relation.fields.map((name) => fieldDbName({ model, name }));\n const refColumns = (relation.references ?? []).map((name) =>\n target === undefined ? name : fieldDbName({ model: target, name }),\n );\n\n // Required = every FK column is non-nullable (the ground truth the\n // database sees; Prisma's cascade defaults key off it).\n const required = relation.fields.every((name) => {\n const field = model.fields.find((candidate) => candidate.name === name);\n return field === undefined ? true : !field.isOptional;\n });\n\n const key = `${columns.join(\",\")}→${refTable}.${refColumns.join(\",\")}`;\n if (result.has(key)) continue;\n result.set(key, {\n key,\n constraintName: relation.constraintName ?? `${table}_${columns.join(\"_\")}_fkey`,\n columns,\n refTable,\n refColumns,\n onDelete: resolveOnDelete({ explicit: relation.onDelete, required }),\n onUpdate: resolveOnUpdate({ explicit: relation.onUpdate }),\n });\n }\n\n return result;\n}\n\n// ─── Join tables ──────────────────────────────────────────────────\n\nfunction normalizeJoinTable(params: {\n pair: { modelA: string; modelB: string; tableName: string };\n schema: SchemaIR;\n dialect: Dialect;\n}): NormalizedJoinTable {\n const { pair, schema, dialect } = params;\n return {\n table: pair.tableName,\n a: joinTableEnd({ modelName: pair.modelA, schema, dialect, joinTable: pair.tableName }),\n b: joinTableEnd({ modelName: pair.modelB, schema, dialect, joinTable: pair.tableName }),\n };\n}\n\nfunction joinTableEnd(params: {\n modelName: string;\n schema: SchemaIR;\n dialect: Dialect;\n joinTable: string;\n}): JoinTableEnd {\n const { modelName, schema, joinTable } = params;\n const model = schema.models.find((candidate) => candidate.name === modelName);\n if (model === undefined) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `implicit many-to-many table \"${joinTable}\" references unknown model \"${modelName}\"`,\n meta: { joinTable, model: modelName },\n });\n }\n\n const pkFields =\n model.primaryKey !== undefined && model.primaryKey.fields.length > 0\n ? model.primaryKey.fields.map((name) => model.fields.find((field) => field.name === name))\n : model.fields.filter((field) => field.isId);\n\n const pkField = pkFields[0];\n if (pkFields.length !== 1 || pkField === undefined) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `implicit many-to-many relations require a single-column primary key on \"${modelName}\" (join table \"${joinTable}\")`,\n meta: { joinTable, model: modelName },\n });\n }\n\n return {\n table: model.dbName ?? model.name,\n column: pkField.dbName ?? pkField.name,\n field: physicalEnumField({ field: pkField, schema, dialect: params.dialect, table: model.dbName ?? model.name }),\n };\n}\n\n// ─── Shared helper ────────────────────────────────────────────────\n\n/** Resolve a field name to its db column name on a model. */\nexport function fieldDbName(params: { model: ModelIR; name: string }): string {\n const { model, name } = params;\n const field = model.fields.find((candidate) => candidate.name === name);\n return field === undefined ? name : (field.dbName ?? field.name);\n}\n",
|
|
9
13
|
"/**\n * Implicit many-to-many detection on Schema IR.\n *\n * ONE structural rule in @vibeorm/schema, also used by RLS validation and\n * matching the parser's ambiguity rule (see LEARNINGS): two fields form an\n * implicit M:N **iff** both are lists that declare no FK columns, they are\n * distinct fields (self-exclusion — a 1:N self-relation must never pair with\n * itself), their relation names match symmetrically (both unnamed, or both\n * the same name), and each side is the OTHER'S SOLE counterpart under that\n * name key. Detection never reads `relation.type`, because an introspected\n * schema represents a real join table as two unnamed `oneToMany` list sides —\n * trusting the type would break round-trip stability.\n *\n * The sole-counterpart requirement is the phantom-join-table fix, round two:\n * two models holding foreign keys INTO EACH OTHER introspect as an unnamed\n * fieldless list on each side (every FK synthesizes one on its target), and\n * name-matching alone would marry those lists into a join table that exists\n * nowhere. Counting EVERY relation under the name key — FK-owning sides\n * included — disambiguates: the parser rejects the same shape as\n * `ambiguous-relation` at parse time, so parsed and introspected schemas\n * resolve identically.\n *\n * The join-table naming itself comes from the ONE shared convention in\n * `@vibeorm/schema` (`implicitJoinTable`) — never re-derived here.\n */\n\nimport { implicitJoinTable, isImplicitManyToManyRelation } from \"@vibeorm/schema\";\nimport type { SchemaIR } from \"@vibeorm/schema\";\n\n/** A detected implicit many-to-many relation. `modelA` sorts before `modelB`. */\nexport type ImplicitM2MPair = {\n readonly modelA: string;\n readonly modelB: string;\n /** Shared explicit relation name, when both sides declare one. */\n readonly relationName?: string;\n /** Join table name per the shared convention (`_PostToTag`, `_tags`). */\n readonly tableName: string;\n};\n\n/** Detect every implicit many-to-many pair in a schema. */\nexport function detectImplicitM2MPairs(params: { schema: SchemaIR }): ImplicitM2MPair[] {\n const { schema } = params;\n const pairs: ImplicitM2MPair[] = [];\n const seen = new Set<string>();\n\n for (const model of schema.models) {\n if (model.isView) continue;\n for (const relation of model.relations) {\n if (!isImplicitManyToManyRelation({ model, relation, models: schema.models })) continue;\n\n const joinTable = implicitJoinTable({\n modelA: model.name,\n modelB: relation.targetModel,\n ...(relation.relationName === undefined ? {} : { relationName: relation.relationName }),\n });\n if (seen.has(joinTable.tableName)) continue;\n seen.add(joinTable.tableName);\n\n pairs.push({\n modelA: joinTable.modelA,\n modelB: joinTable.modelB,\n ...(relation.relationName === undefined ? {} : { relationName: relation.relationName }),\n tableName: joinTable.tableName,\n });\n }\n }\n\n return pairs;\n}\n",
|
|
10
|
-
"/**\n * Postgres column-type mapping (IR → pg text and back), native-type\n * normalization, default-value fingerprints/rendering, and cascade-action\n * resolution.\n *\n * The forward mapping implements dialect-matrix §2; the fingerprint helpers are\n * the differ's normalization layer — both the differ and the introspector lean\n * on them so `diff(introspect(push(X)), X) = []` holds by construction.\n */\n\nimport { VibeError, isEnumType, scalarListDefault, serializeJsonDefault } from \"@vibeorm/schema\";\nimport type { CascadeAction, FieldIR, ScalarType } from \"@vibeorm/schema\";\nimport { POSTGRES_CODECS, postgresDialect, toPgArrayLiteral } from \"@vibeorm/sql\";\n\n// ─── Canonical scalar mapping (dialect-matrix §2) ─────────────────\n\n/** IR scalar → canonical postgres column type. */\nexport const SCALAR_TO_PG: Readonly<Record<ScalarType, string>> = {\n String: \"text\",\n Boolean: \"boolean\",\n Int: \"integer\",\n BigInt: \"bigint\",\n Float: \"double precision\",\n Decimal: \"numeric\",\n DateTime: \"timestamptz\",\n Json: \"jsonb\",\n Bytes: \"bytea\",\n};\n\n/**\n * Native spellings that compare EQUAL to a scalar's canonical mapping without\n * being it (comparison only — rendering keeps the declared spelling, so\n * `@db.Timestamptz(3)` still creates a precision-3 column). The canonical\n * DateTime mapping is bare `timestamptz` — postgres's server default,\n * precision 6, exactly what v1 emitted — so v1-created (and hand-written, and\n * Prisma-created) databases upgrade with zero DDL. `timestamptz(6)` is the\n * same type spelled explicitly, and `timestamptz(3)` is grandfathered for\n * databases created by the 2.0 alphas, which emitted it: without this class\n * either population would report a destructive type change on every DateTime\n * column. Any other precision stays distinct and still diffs.\n */\nconst CANONICAL_EQUIVALENTS: Readonly<Partial<Record<ScalarType, readonly string[]>>> = {\n DateTime: [\"timestamptz(3)\", \"timestamptz(6)\"],\n};\n\n// ─── Native-type normalization ────────────────────────────────────\n\n/**\n * Alias map applied to the base name of a native type (everything before the\n * parenthesized modifier) so that schema-declared `@db.*` spellings and\n * catalog-reported names compare equal.\n */\nconst NATIVE_ALIASES: Readonly<Record<string, string>> = {\n charactervarying: \"varchar\",\n character: \"char\",\n bpchar: \"char\",\n int: \"integer\",\n int4: \"integer\",\n int2: \"smallint\",\n int8: \"bigint\",\n serial: \"integer\",\n bigserial: \"bigint\",\n bool: \"boolean\",\n float4: \"real\",\n float8: \"doubleprecision\",\n double: \"doubleprecision\",\n doubleprecision: \"doubleprecision\",\n decimal: \"numeric\",\n timestampwithtimezone: \"timestamptz\",\n timestampwithouttimezone: \"timestamp\",\n timewithtimezone: \"timetz\",\n timewithouttimezone: \"time\",\n};\n\n/**\n * Normalize a native type string for comparison: lowercase, whitespace\n * stripped, base name de-aliased. `\"VarChar(191)\"` and `\"character varying(191)\"`\n * both become `\"varchar(191)\"`.\n */\nexport function normalizeNativeType(params: { raw: string }): string {\n const compact = params.raw.toLowerCase().replace(/\\s+/g, \"\");\n const match = compact.match(/^([a-z_0-9]+)(\\(.*\\))?(\\[\\])?$/);\n if (match === null) return compact;\n const base = NATIVE_ALIASES[match[1] as string] ?? (match[1] as string);\n return `${base}${match[2] ?? \"\"}${match[3] ?? \"\"}`;\n}\n\n/**\n * Comparison key for a column's type. Two columns with equal keys need no\n * ALTER. A native type equal to the scalar's canonical mapping is dropped, so\n * `DateTime` and `DateTime @db.Timestamptz` compare equal — and so do the\n * mapping's `CANONICAL_EQUIVALENTS` (`@db.Timestamptz(6)`, the same type\n * spelled explicitly, and `@db.Timestamptz(3)`, what the 2.0 alphas created).\n * Any other precision stays distinct and still diffs.\n */\nexport function columnTypeKey(params: { field: FieldIR }): string {\n const { field } = params;\n const listSuffix = field.isList ? \"[]\" : \"\";\n\n if (field.isUnsupported === true) {\n return `u:${normalizeNativeType({ raw: field.nativeType ?? \"\" })}`;\n }\n if (isEnumType(field.type)) {\n return `e:${field.type.enum}${listSuffix}`;\n }\n if (field.nativeType !== undefined) {\n const normalized = normalizeNativeType({ raw: field.nativeType });\n const canonical = normalizeNativeType({ raw: SCALAR_TO_PG[field.type] });\n const isCanonical =\n normalized === canonical ||\n (CANONICAL_EQUIVALENTS[field.type]?.includes(normalized) ?? false);\n if (!isCanonical) return `n:${normalized}${listSuffix}`;\n }\n return `s:${field.type}${listSuffix}`;\n}\n\n/**\n * True when a type change from `from` to `to` is the safe scalar→array repair\n * (same base type, scalar becomes a one-element array via a `USING` clause —\n * the LEARNINGS enum-array lesson). Every other type change is treated as\n * potentially narrowing, i.e. destructive.\n */\nexport function isScalarToArrayChange(params: { from: FieldIR; to: FieldIR }): boolean {\n const { from, to } = params;\n if (from.isList || !to.isList) return false;\n const fromBase = columnTypeKey({ field: { ...from, isList: false } });\n const toBase = columnTypeKey({ field: { ...to, isList: false } });\n return fromBase === toBase;\n}\n\n// ─── Column type rendering ────────────────────────────────────────\n\n/** Render the postgres column type for a field (no identity, no default). */\nexport function columnTypeSql(params: { field: FieldIR }): string {\n const { field } = params;\n if (field.isUnsupported === true) {\n if (field.nativeType === undefined) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `unsupported column \"${field.name}\" carries no native type to render`,\n meta: { field: field.name },\n });\n }\n return field.nativeType;\n }\n const listSuffix = field.isList ? \"[]\" : \"\";\n if (isEnumType(field.type)) {\n return `${postgresDialect.quoteIdent({ name: \"public\" })}.${postgresDialect.quoteIdent({ name: field.type.enum })}${listSuffix}`;\n }\n if (field.nativeType !== undefined) {\n const normalized = normalizeNativeType({ raw: field.nativeType });\n const canonical = normalizeNativeType({ raw: SCALAR_TO_PG[field.type] });\n if (normalized !== canonical) return `${field.nativeType.toLowerCase()}${listSuffix}`;\n }\n return `${SCALAR_TO_PG[field.type]}${listSuffix}`;\n}\n\n/** True when the field renders as an identity column (autoincrement Int/BigInt). */\nexport function isIdentityColumn(params: { field: FieldIR }): boolean {\n const { field } = params;\n return (\n field.default?.kind === \"autoincrement\" &&\n !field.isList &&\n !isEnumType(field.type) &&\n (field.type === \"Int\" || field.type === \"BigInt\")\n );\n}\n\n// ─── Defaults ─────────────────────────────────────────────────────\n\n/**\n * Normalized fingerprint of a column default for diffing, or `null` when the\n * database carries no default. App-level id generators (uuid / cuid / nanoid /\n * ulid) fingerprint as `null`: the runtime injects them client-side, so the\n * database honestly has no default — this is what keeps introspection\n * round-trips stable for `@default(uuid())` columns.\n */\nexport function defaultFingerprint(params: { field: FieldIR }): string | null {\n const { field } = params;\n const def = field.default;\n if (def === undefined) return null;\n switch (def.kind) {\n case \"autoincrement\":\n return \"autoincrement\";\n case \"now\":\n return \"now\";\n case \"uuid\":\n case \"cuid\":\n case \"nanoid\":\n case \"ulid\":\n return null;\n case \"list\":\n return `list:${JSON.stringify(field.type === \"Json\" ? def.values.map((value) => serializeJsonDefault({ value: POSTGRES_CODECS.Json.decode(value) })) : scalarListDefault({ type: field.type, values: def.values }))}`;\n case \"literal\": {\n const value = def.value;\n if (field.type === \"Json\" && typeof value === \"string\") return `json:${serializeJsonDefault({ value: POSTGRES_CODECS.Json.decode(value) })}`;\n if (typeof value === \"boolean\") return `bool:${value}`;\n if (typeof value === \"number\") return `num:${value}`;\n // A string literal on an enum column is the same default as an enumValue.\n if (isEnumType(field.type)) return `enum:${value}`;\n // A numeric string on a numeric column (`Decimal @default(\"0\")`) is the\n // same default as the number: postgres reports it back as `'0'::numeric`\n // and introspection parses that numerically, so a `str:` fingerprint\n // here would make the in-sync state unreachable — the step re-appears\n // after every push, forever.\n if (isNumericScalar({ type: field.type }) && NUMERIC_LITERAL.test(value)) {\n // Compare the DIGITS, not a rounded double: E4 now carries an exact\n // BigInt default as its decimal string, and `9007199254740993` and\n // `9007199254740992` are different defaults (E4 hand-off, F36).\n return /^-?\\d+$/.test(value) ? `num:${BigInt(value).toString()}` : `num:${Number(value)}`;\n }\n return `str:${value}`;\n }\n case \"enumValue\":\n return `enum:${def.value}`;\n case \"dbgenerated\":\n // SQL expressions are opaque. Even whitespace and case can be literal\n // data (including dollar quotes); false equivalence is unsafe.\n return `db:${def.sql.trim()}`;\n }\n}\n\n/**\n * Render the `DEFAULT` expression for a field, or `undefined` when the column\n * takes no database default (no default declared, app-level generators,\n * autoincrement — which renders as identity instead).\n */\nexport function defaultSql(params: { field: FieldIR }): string | undefined {\n const def = params.field.default;\n if (def === undefined) return undefined;\n switch (def.kind) {\n case \"autoincrement\":\n case \"uuid\":\n case \"cuid\":\n case \"nanoid\":\n case \"ulid\":\n return undefined;\n case \"now\":\n return \"CURRENT_TIMESTAMP\";\n case \"list\":\n return `${quotePgString({ value: toPgArrayLiteral({ values: def.values }) })}::${columnTypeSql({ field: params.field })}`;\n case \"literal\": {\n const value = def.value;\n if (typeof value === \"boolean\") return value ? \"true\" : \"false\";\n if (typeof value === \"number\") return String(value);\n return quotePgString({ value });\n }\n case \"enumValue\":\n return quotePgString({ value: def.value });\n case \"dbgenerated\":\n return def.sql;\n }\n}\n\n/** Integer/decimal literal shape — the same one the introspector accepts. */\nconst NUMERIC_LITERAL: RegExp = /^-?\\d+(\\.\\d+)?$/;\n\n/** True for scalars whose defaults postgres reports back as numeric literals. */\nexport function isNumericScalar(params: { type: ScalarType }): boolean {\n const { type } = params;\n return type === \"Int\" || type === \"BigInt\" || type === \"Float\" || type === \"Decimal\";\n}\n\n// ─── Cascade actions ──────────────────────────────────────────────\n\n/**\n * `pg_constraint.confdeltype` / `confupdtype` single-char codes → IR actions\n * (used by the introspector).\n */\nexport const PG_CHAR_TO_CASCADE_ACTION: Readonly<Record<string, CascadeAction>> = {\n a: \"NoAction\",\n r: \"Restrict\",\n c: \"Cascade\",\n n: \"SetNull\",\n d: \"SetDefault\",\n};\n\n/** CascadeAction → SQL clause body. */\nexport const CASCADE_ACTION_SQL: Readonly<Record<CascadeAction, string>> = {\n Cascade: \"CASCADE\",\n Restrict: \"RESTRICT\",\n NoAction: \"NO ACTION\",\n SetNull: \"SET NULL\",\n SetDefault: \"SET DEFAULT\",\n};\n\n/**\n * Effective onDelete with Prisma's postgres defaults applied (LEARNINGS):\n * required FK → Restrict, optional FK → SetNull.\n */\nexport function resolveOnDelete(params: {\n explicit: CascadeAction | undefined;\n required: boolean;\n}): CascadeAction {\n if (params.explicit !== undefined) return params.explicit;\n return params.required ? \"Restrict\" : \"SetNull\";\n}\n\n/** Effective onUpdate — Prisma's postgres default is Cascade. */\nexport function resolveOnUpdate(params: { explicit: CascadeAction | undefined }): CascadeAction {\n return params.explicit ?? \"Cascade\";\n}\n\n// ─── Small quoting helpers ────────────────────────────────────────\n\n/** Quote a postgres string literal (single quotes, doubled embedded quotes). */\nexport function quotePgString(params: { value: string }): string {\n return `'${params.value.replaceAll(\"'\", \"''\")}'`;\n}\n",
|
|
14
|
+
"/**\n * Postgres column-type mapping (IR → pg text and back), native-type\n * normalization, default-value fingerprints/rendering, and cascade-action\n * resolution.\n *\n * The forward mapping implements dialect-matrix §2; the fingerprint helpers are\n * the differ's normalization layer — both the differ and the introspector lean\n * on them so `diff(introspect(push(X)), X) = []` holds by construction.\n */\n\nimport { VibeError, isEnumType, scalarListDefault, serializeJsonDefault } from \"@vibeorm/schema\";\nimport type { CascadeAction, FieldIR, ScalarType } from \"@vibeorm/schema\";\nimport type { PostgresTypeName } from \"@vibeorm/sql\";\nimport { POSTGRES_CODECS, postgresDialect, toPgArrayLiteral, parsePostgresTypeName, renderPostgresTypeName } from \"@vibeorm/sql\";\n\n// ─── Canonical scalar mapping (dialect-matrix §2) ─────────────────\n\n/** IR scalar → canonical postgres column type. */\nexport const SCALAR_TO_PG: Readonly<Record<ScalarType, string>> = {\n String: \"text\",\n Boolean: \"boolean\",\n Int: \"integer\",\n BigInt: \"bigint\",\n Float: \"double precision\",\n Decimal: \"numeric\",\n DateTime: \"timestamptz\",\n Json: \"jsonb\",\n Bytes: \"bytea\",\n};\n\n/**\n * Native spellings that compare EQUAL to a scalar's canonical mapping without\n * being it (comparison only — rendering keeps the declared spelling, so\n * `@db.Timestamptz(3)` still creates a precision-3 column). The canonical\n * DateTime mapping is bare `timestamptz` — postgres's server default,\n * precision 6, exactly what v1 emitted — so v1-created (and hand-written, and\n * Prisma-created) databases upgrade with zero DDL. `timestamptz(6)` is the\n * same type spelled explicitly, and `timestamptz(3)` is grandfathered for\n * databases created by the 2.0 alphas, which emitted it: without this class\n * either population would report a destructive type change on every DateTime\n * column. Any other precision stays distinct and still diffs.\n */\nconst CANONICAL_EQUIVALENTS: Readonly<Partial<Record<ScalarType, readonly string[]>>> = {\n DateTime: [\"timestamptz(3)\", \"timestamptz(6)\"],\n};\n\n// ─── Native-type normalization ────────────────────────────────────\n\n/**\n * Alias map applied to the base name of a native type (everything before the\n * parenthesized modifier) so that schema-declared `@db.*` spellings and\n * catalog-reported names compare equal.\n */\nconst NATIVE_ALIASES: Readonly<Record<string, string>> = {\n charactervarying: \"varchar\",\n character: \"char\",\n bpchar: \"char\",\n int: \"integer\",\n int4: \"integer\",\n int2: \"smallint\",\n int8: \"bigint\",\n serial: \"integer\",\n bigserial: \"bigint\",\n bool: \"boolean\",\n float4: \"real\",\n float8: \"doubleprecision\",\n double: \"doubleprecision\",\n doubleprecision: \"doubleprecision\",\n decimal: \"numeric\",\n timestampwithtimezone: \"timestamptz\",\n timestampwithouttimezone: \"timestamp\",\n timewithtimezone: \"timetz\",\n timewithouttimezone: \"time\",\n};\n\n/**\n * Normalize a native type string for comparison: lowercase, whitespace\n * stripped, base name de-aliased. `\"VarChar(191)\"` and `\"character varying(191)\"`\n * both become `\"varchar(191)\"`.\n */\nexport function normalizeNativeType(params: { raw: string }): string {\n const compact = params.raw.toLowerCase().replace(/\\s+/g, \"\");\n const match = compact.match(/^([a-z_0-9]+)(\\(.*\\))?(\\[\\])?$/);\n if (match === null) return compact;\n const base = NATIVE_ALIASES[match[1] as string] ?? (match[1] as string);\n return `${base}${match[2] ?? \"\"}${match[3] ?? \"\"}`;\n}\n\n/** Parse unsupported types without folding quoted identifier or literal bytes. */\nexport function parseUnsupportedPostgresType(params: { raw: string }): PostgresTypeName | undefined {\n const temporal = /^\\s*(time(?:stamp)?)\\s*(\\(\\s*\\d+\\s*\\))?\\s+(with|without)\\s+time\\s+zone\\s*((?:\\[\\s*\\]\\s*)*)$/i.exec(params.raw);\n if (temporal !== null) return parsePostgresTypeName({ raw: `${temporal[1]!.toLowerCase()}${temporal[3]!.toLowerCase() === \"with\" ? \"tz\" : \"\"}${temporal[2] ?? \"\"}${temporal[4] ?? \"\"}` });\n const parsed = parsePostgresTypeName(params);\n if (parsed !== undefined || /[\"']/.test(params.raw)) return parsed;\n const base = params.raw.toLowerCase().replace(/\\s+/g, \"\").replace(/\\(.*\\)|\\[\\]/g, \"\");\n return NATIVE_ALIASES[base] === undefined ? undefined : parsePostgresTypeName({ raw: normalizeNativeType(params) });\n}\n\n/**\n * Comparison key for a column's type. Two columns with equal keys need no\n * ALTER. A native type equal to the scalar's canonical mapping is dropped, so\n * `DateTime` and `DateTime @db.Timestamptz` compare equal — and so do the\n * mapping's `CANONICAL_EQUIVALENTS` (`@db.Timestamptz(6)`, the same type\n * spelled explicitly, and `@db.Timestamptz(3)`, what the 2.0 alphas created).\n * Any other precision stays distinct and still diffs.\n */\nexport function columnTypeKey(params: { field: FieldIR }): string {\n const { field } = params;\n const listSuffix = field.isList ? \"[]\" : \"\";\n\n if (field.isUnsupported === true) {\n const parsed = parseUnsupportedPostgresType({ raw: field.nativeType ?? \"\" });\n if (parsed === undefined) return `u:${field.nativeType ?? \"\"}`;\n const evidence = field.nativeTypeIdentity;\n const namespace = evidence !== undefined && evidence.source === field.nativeType ? evidence.namespace : parsed.namespace;\n return `u:${JSON.stringify([namespace ?? null, parsed.name, parsed.modifier, parsed.array || field.isList])}`;\n }\n if (isEnumType(field.type)) {\n return `e:${field.type.enum}${listSuffix}`;\n }\n if (field.nativeType !== undefined) {\n const normalized = normalizeNativeType({ raw: field.nativeType });\n const canonical = normalizeNativeType({ raw: SCALAR_TO_PG[field.type] });\n const isCanonical =\n normalized === canonical ||\n (CANONICAL_EQUIVALENTS[field.type]?.includes(normalized) ?? false);\n if (!isCanonical) return `n:${normalized}${listSuffix}`;\n }\n return `s:${field.type}${listSuffix}`;\n}\n\n/**\n * True when a type change from `from` to `to` is the safe scalar→array repair\n * (same base type, scalar becomes a one-element array via a `USING` clause —\n * the LEARNINGS enum-array lesson). Every other type change is treated as\n * potentially narrowing, i.e. destructive.\n */\nexport function isScalarToArrayChange(params: { from: FieldIR; to: FieldIR }): boolean {\n const { from, to } = params;\n if (from.isList || !to.isList) return false;\n const fromBase = columnTypeKey({ field: { ...from, isList: false } });\n const toBase = columnTypeKey({ field: { ...to, isList: false } });\n return fromBase === toBase;\n}\n\n// ─── Column type rendering ────────────────────────────────────────\n\n/** Render the postgres column type for a field (no identity, no default). */\nexport function columnTypeSql(params: { field: FieldIR }): string {\n const { field } = params;\n if (field.isUnsupported === true) {\n if (field.nativeType === undefined) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `unsupported column \"${field.name}\" carries no native type to render`,\n meta: { field: field.name },\n });\n }\n const parsed = parseUnsupportedPostgresType({ raw: field.nativeType });\n const evidence = field.nativeTypeIdentity;\n if (parsed !== undefined && evidence?.source === field.nativeType) return renderPostgresTypeName({ dialect: postgresDialect, type: { ...parsed, namespace: evidence.namespace, array: parsed.array || field.isList } });\n return field.nativeType;\n }\n const listSuffix = field.isList ? \"[]\" : \"\";\n if (isEnumType(field.type)) {\n return `${postgresDialect.quoteIdent({ name: \"public\" })}.${postgresDialect.quoteIdent({ name: field.type.enum })}${listSuffix}`;\n }\n if (field.nativeType !== undefined) {\n const normalized = normalizeNativeType({ raw: field.nativeType });\n const canonical = normalizeNativeType({ raw: SCALAR_TO_PG[field.type] });\n if (normalized !== canonical) return `${field.nativeType.toLowerCase()}${listSuffix}`;\n }\n return `${SCALAR_TO_PG[field.type]}${listSuffix}`;\n}\n\n/** True when the field renders as an identity column (autoincrement Int/BigInt). */\nexport function isIdentityColumn(params: { field: FieldIR }): boolean {\n const { field } = params;\n return (\n field.default?.kind === \"autoincrement\" &&\n !field.isList &&\n !isEnumType(field.type) &&\n (field.type === \"Int\" || field.type === \"BigInt\")\n );\n}\n\n// ─── Defaults ─────────────────────────────────────────────────────\n\n/**\n * Normalized fingerprint of a column default for diffing, or `null` when the\n * database carries no default. App-level id generators (uuid / cuid / nanoid /\n * ulid) fingerprint as `null`: the runtime injects them client-side, so the\n * database honestly has no default — this is what keeps introspection\n * round-trips stable for `@default(uuid())` columns.\n */\nexport function defaultFingerprint(params: { field: FieldIR }): string | null {\n const { field } = params;\n const def = field.default;\n if (def === undefined) return null;\n switch (def.kind) {\n case \"autoincrement\":\n return \"autoincrement\";\n case \"now\":\n return \"now\";\n case \"uuid\":\n case \"cuid\":\n case \"nanoid\":\n case \"ulid\":\n return null;\n case \"list\":\n return `list:${JSON.stringify(field.type === \"Json\" ? def.values.map((value) => serializeJsonDefault({ value: POSTGRES_CODECS.Json.decode(value) })) : scalarListDefault({ type: field.type, values: def.values }))}`;\n case \"literal\": {\n const value = def.value;\n if (field.type === \"Json\" && typeof value === \"string\") return `json:${serializeJsonDefault({ value: POSTGRES_CODECS.Json.decode(value) })}`;\n if (typeof value === \"boolean\") return `bool:${value}`;\n if (typeof value === \"number\") return `num:${value}`;\n // A string literal on an enum column is the same default as an enumValue.\n if (isEnumType(field.type)) return `enum:${value}`;\n // A numeric string on a numeric column (`Decimal @default(\"0\")`) is the\n // same default as the number: postgres reports it back as `'0'::numeric`\n // and introspection parses that numerically, so a `str:` fingerprint\n // here would make the in-sync state unreachable — the step re-appears\n // after every push, forever.\n if (isNumericScalar({ type: field.type }) && NUMERIC_LITERAL.test(value)) {\n // Compare the DIGITS, not a rounded double: E4 now carries an exact\n // BigInt default as its decimal string, and `9007199254740993` and\n // `9007199254740992` are different defaults (E4 hand-off, F36).\n return /^-?\\d+$/.test(value) ? `num:${BigInt(value).toString()}` : `num:${Number(value)}`;\n }\n return `str:${value}`;\n }\n case \"enumValue\":\n return `enum:${def.value}`;\n case \"dbgenerated\":\n // SQL expressions are opaque. Even whitespace and case can be literal\n // data (including dollar quotes); false equivalence is unsafe.\n return `db:${def.sql.trim()}`;\n }\n}\n\n/**\n * Render the `DEFAULT` expression for a field, or `undefined` when the column\n * takes no database default (no default declared, app-level generators,\n * autoincrement — which renders as identity instead).\n */\nexport function defaultSql(params: { field: FieldIR }): string | undefined {\n const def = params.field.default;\n if (def === undefined) return undefined;\n switch (def.kind) {\n case \"autoincrement\":\n case \"uuid\":\n case \"cuid\":\n case \"nanoid\":\n case \"ulid\":\n return undefined;\n case \"now\":\n return \"CURRENT_TIMESTAMP\";\n case \"list\":\n return `${quotePgString({ value: toPgArrayLiteral({ values: def.values }) })}::${columnTypeSql({ field: params.field })}`;\n case \"literal\": {\n const value = def.value;\n if (typeof value === \"boolean\") return value ? \"true\" : \"false\";\n if (typeof value === \"number\") return String(value);\n return quotePgString({ value });\n }\n case \"enumValue\":\n return quotePgString({ value: def.value });\n case \"dbgenerated\":\n return def.sql;\n }\n}\n\n/** Integer/decimal literal shape — the same one the introspector accepts. */\nconst NUMERIC_LITERAL: RegExp = /^-?\\d+(\\.\\d+)?$/;\n\n/** True for scalars whose defaults postgres reports back as numeric literals. */\nexport function isNumericScalar(params: { type: ScalarType }): boolean {\n const { type } = params;\n return type === \"Int\" || type === \"BigInt\" || type === \"Float\" || type === \"Decimal\";\n}\n\n// ─── Cascade actions ──────────────────────────────────────────────\n\n/**\n * `pg_constraint.confdeltype` / `confupdtype` single-char codes → IR actions\n * (used by the introspector).\n */\nexport const PG_CHAR_TO_CASCADE_ACTION: Readonly<Record<string, CascadeAction>> = {\n a: \"NoAction\",\n r: \"Restrict\",\n c: \"Cascade\",\n n: \"SetNull\",\n d: \"SetDefault\",\n};\n\n/** CascadeAction → SQL clause body. */\nexport const CASCADE_ACTION_SQL: Readonly<Record<CascadeAction, string>> = {\n Cascade: \"CASCADE\",\n Restrict: \"RESTRICT\",\n NoAction: \"NO ACTION\",\n SetNull: \"SET NULL\",\n SetDefault: \"SET DEFAULT\",\n};\n\n/**\n * Effective onDelete with Prisma's postgres defaults applied (LEARNINGS):\n * required FK → Restrict, optional FK → SetNull.\n */\nexport function resolveOnDelete(params: {\n explicit: CascadeAction | undefined;\n required: boolean;\n}): CascadeAction {\n if (params.explicit !== undefined) return params.explicit;\n return params.required ? \"Restrict\" : \"SetNull\";\n}\n\n/** Effective onUpdate — Prisma's postgres default is Cascade. */\nexport function resolveOnUpdate(params: { explicit: CascadeAction | undefined }): CascadeAction {\n return params.explicit ?? \"Cascade\";\n}\n\n// ─── Small quoting helpers ────────────────────────────────────────\n\n/** Quote a postgres string literal (single quotes, doubled embedded quotes). */\nexport function quotePgString(params: { value: string }): string {\n return `'${params.value.replaceAll(\"'\", \"''\")}'`;\n}\n",
|
|
11
15
|
"/**\n * SQLite column-type mapping (IR → storage class and back), comparison keys,\n * default rendering/fingerprints, and the enum CHECK-constraint convention.\n *\n * dialect-matrix §2: sqlite columns use the four storage classes only —\n * String/DateTime/Decimal/Json → TEXT, Boolean/Int/BigInt → INTEGER,\n * Float → REAL, Bytes → BLOB. Enums are TEXT plus a named CHECK constraint\n * (`CONSTRAINT \"<table>_<column>_enum_<Enum>\" CHECK (\"<column>\" IN (…))`) —\n * the constraint NAME is the marker that lets introspection recover the enum's\n * name, and the IN list recovers its values. Scalar lists are unsupported\n * (refused by the differ; this module throws as the render-time backstop).\n *\n * THE TEXT AMBIGUITY, stated honestly: DateTime, Decimal and Json all live in\n * TEXT, and Boolean/BigInt live in INTEGER — a pulled schema reports such\n * columns as String/Int (there is no marker to say otherwise). Column\n * comparison is therefore STORAGE-CLASS based on sqlite (`sqliteColumnTypeKey`\n * compares what the database actually stores), so `diff(introspect(push(X)),\n * X)` stays [] even though the introspected IR says String where X said\n * DateTime.\n */\n\nimport { VibeError, isEnumType, unsupportedCapability } from \"@vibeorm/schema\";\nimport type { FieldIR, ScalarType } from \"@vibeorm/schema\";\nimport { ParamCollector, sqliteDialect } from \"@vibeorm/sql\";\nimport { resolveEnumValues } from \"./enum-values.ts\";\nimport { defaultFingerprint, quotePgString } from \"./postgres-types.ts\";\nimport type { EnumIR } from \"@vibeorm/schema\";\n\n// ─── Canonical scalar mapping (dialect-matrix §2) ─────────────────\n\n/** IR scalar → sqlite storage class. */\nexport const SCALAR_TO_SQLITE: Readonly<Record<ScalarType, string>> = {\n String: \"TEXT\",\n Boolean: \"INTEGER\",\n Int: \"INTEGER\",\n BigInt: \"INTEGER\",\n Float: \"REAL\",\n Decimal: \"TEXT\",\n DateTime: \"TEXT\",\n Json: \"TEXT\",\n Bytes: \"BLOB\",\n};\n\n/** Render-time backstop for scalar-list columns (the differ refuses earlier). */\nexport function refuseSqliteScalarList(params: { field: FieldIR }): never {\n throw unsupportedCapability({\n dialect: \"sqlite\",\n feature: `scalar list column \"${params.field.name}\"`,\n hint: \"sqlite has no array column type — model the list as a separate table or a Json column\",\n });\n}\n\n/**\n * Storage class for a column. Unsupported columns render their nativeType\n * verbatim (fidelity over guessing); enums are TEXT (the CHECK is separate).\n */\nexport function sqliteStorageType(params: { field: FieldIR }): string {\n const { field } = params;\n if (field.isUnsupported === true) {\n if (field.nativeType === undefined) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `unsupported column \"${field.name}\" carries no native type to render`,\n meta: { field: field.name },\n });\n }\n return field.nativeType;\n }\n if (field.isList) refuseSqliteScalarList({ field });\n if (isEnumType(field.type)) return \"TEXT\";\n return SCALAR_TO_SQLITE[field.type];\n}\n\n// ─── Comparison keys (the differ's sqlite normalization) ──────────\n\n/**\n * Comparison key for a column on sqlite: the STORAGE CLASS, not the IR type —\n * String and DateTime are both `t:TEXT` because the database cannot tell them\n * apart. Enum columns key on their VALUE LIST (`e:A|B`), never their name\n * (the name only lives in our CHECK-constraint convention): adding an enum\n * value changes the key and flows through `alterColumn` → table rebuild with\n * the widened CHECK.\n */\nexport function sqliteColumnTypeKey(params: {\n field: FieldIR;\n enums: ReadonlyMap<string, EnumIR>;\n}): string {\n const { field, enums } = params;\n if (field.isUnsupported === true) {\n return `u:${(field.nativeType ?? \"\").toLowerCase().replace(/\\s+/g, \"\")}`;\n }\n if (isEnumType(field.type)) {\n const values = resolveEnumValues({ name: field.type.enum, enums });\n return values === undefined ? `e:?${field.type.enum}` : `e:${values.join(\"|\")}`;\n }\n const listSuffix = field.isList ? \"[]\" : \"\";\n return `t:${SCALAR_TO_SQLITE[field.type]}${listSuffix}`;\n}\n\n/**\n * Default fingerprint on sqlite: postgres rules, except booleans compare as\n * their INTEGER storage (`true` → `num:1`) — an introspected sqlite schema can\n * only ever report `DEFAULT 1`, and the fingerprint must not churn on that.\n */\nexport function sqliteDefaultFingerprint(params: { field: FieldIR }): string | null {\n const { field } = params;\n const def = field.default;\n if (def?.kind === \"now\") return `db:${sqliteDialect.renderDbNow({ offsetSeconds: 0, collector: new ParamCollector(sqliteDialect) })}`;\n if (def?.kind === \"literal\" && field.type === \"Json\") return defaultFingerprint({ field: { ...field, type: \"String\" } });\n if (def?.kind === \"literal\" && typeof def.value === \"boolean\") {\n return `num:${def.value ? 1 : 0}`;\n }\n return defaultFingerprint({ field });\n}\n\n// ─── Default rendering ────────────────────────────────────────────\n\n/**\n * Render the `DEFAULT` expression for a field on sqlite, or `undefined` when\n * the column takes none (app-level generators, autoincrement — which renders\n * as `INTEGER PRIMARY KEY AUTOINCREMENT` instead). Booleans store as 1/0.\n */\nexport function sqliteDefaultSql(params: { field: FieldIR }): string | undefined {\n const def = params.field.default;\n if (def === undefined) return undefined;\n switch (def.kind) {\n case \"autoincrement\":\n case \"uuid\":\n case \"cuid\":\n case \"nanoid\":\n case \"ulid\":\n return undefined;\n case \"now\":\n return `(${sqliteDialect.renderDbNow({ offsetSeconds: 0, collector: new ParamCollector(sqliteDialect) })})`;\n case \"list\":\n return refuseSqliteScalarList({ field: params.field });\n case \"literal\": {\n const value = def.value;\n if (typeof value === \"boolean\") return value ? \"1\" : \"0\";\n if (typeof value === \"number\") return String(value);\n return quotePgString({ value });\n }\n case \"enumValue\":\n return quotePgString({ value: def.value });\n case \"dbgenerated\":\n return def.sql;\n }\n}\n\n// ─── Enum CHECK-constraint convention ─────────────────────────────\n\n/**\n * Name of the enum CHECK constraint for a column — the `_enum_` infix is the\n * introspection marker that recovers the enum's name from `sqlite_master.sql`.\n */\nexport function sqliteEnumCheckName(params: {\n table: string;\n column: string;\n enumName: string;\n}): string {\n return `${params.table}_${params.column}_enum_${params.enumName}`;\n}\n\n/** One parsed enum CHECK constraint from a table's `sqlite_master.sql`. */\nexport type ParsedEnumCheck = {\n readonly column: string;\n readonly enumName: string;\n readonly values: readonly string[];\n};\n\nconst ENUM_CHECK_PATTERN =\n /CONSTRAINT \"((?:[^\"]|\"\")+)_enum_((?:[^\"]|\"\")+)\" CHECK \\(\"((?:[^\"]|\"\")+)\" IN \\(([^)]*)\\)\\)/g;\n\n/** One parsed NAMED user CHECK from a table's `sqlite_master.sql`. */\nexport type ParsedNamedCheck = {\n readonly name: string;\n readonly expression: string;\n};\n\n/**\n * Every `CONSTRAINT \"name\" CHECK (…)` in a table's `sqlite_master.sql`, with\n * a balanced-paren walk for the expression (a regex capture would stop at the\n * first `)`). The caller filters out the enum-convention names — those are\n * column machinery, not user checks.\n */\nexport function parseSqliteNamedChecks(params: { tableSql: string }): ParsedNamedCheck[] {\n const { tableSql } = params;\n const result: ParsedNamedCheck[] = [];\n for (const match of tableSql.matchAll(/\\bCONSTRAINT\\s+(?:\"((?:[^\"]|\"\")+)\"|`((?:[^`]|``)+)`|\\[([^\\]]+)\\]|([A-Za-z_][A-Za-z_0-9]*))\\s+CHECK\\s*\\(/gi)) {\n const name = match[1]?.replaceAll('\"\"', '\"') ?? match[2]?.replaceAll(\"``\", \"`\") ?? match[3] ?? match[4]!;\n const open = (match.index ?? 0) + match[0].length - 1;\n let depth = 0;\n let close = -1;\n let quote: string | undefined;\n for (let index = open; index < tableSql.length; index++) {\n const char = tableSql[index];\n if (quote !== undefined) {\n if (char === quote) {\n if (tableSql[index + 1] === quote) index++;\n else quote = undefined;\n }\n continue;\n }\n if (char === \"'\" || char === '\"' || char === \"`\") { quote = char; continue; }\n if (char === \"(\") depth += 1;\n else if (char === \")\") {\n depth -= 1;\n if (depth === 0) {\n close = index;\n break;\n }\n }\n }\n if (close === -1) continue;\n result.push({ name, expression: tableSql.slice(open + 1, close) });\n }\n return result;\n}\n\n/**\n * Recover enum columns from a table's `sqlite_master.sql` text. Only checks\n * following OUR naming convention are recognized; foreign CHECK constraints\n * are ignored (and — documented limitation — do not survive a table rebuild).\n */\nexport function parseSqliteEnumChecks(params: { tableSql: string }): ParsedEnumCheck[] {\n const result: ParsedEnumCheck[] = [];\n for (const match of params.tableSql.matchAll(ENUM_CHECK_PATTERN)) {\n const enumName = (match[2] as string).replaceAll('\"\"', '\"');\n const column = (match[3] as string).replaceAll('\"\"', '\"');\n const values: string[] = [];\n for (const value of (match[4] as string).matchAll(/'((?:[^']|'')*)'/g)) {\n values.push((value[1] as string).replaceAll(\"''\", \"'\"));\n }\n result.push({ column, enumName, values });\n }\n return result;\n}\n",
|
|
16
|
+
"/**\n * Enum-value resolution shared by the sqlite/mysql type mappers.\n *\n * On dialects without named enum types (sqlite: TEXT + CHECK, mysql: inline\n * `ENUM(...)`) the enum's NAME does not survive in the database — only its\n * VALUES do. Column comparison keys and DDL rendering therefore resolve a\n * field's enum reference to its value list; the name is presentation only.\n */\n\nimport { isEnumType, unsupportedCapability } from \"@vibeorm/schema\";\nimport type { Dialect, EnumIR, FieldIR } from \"@vibeorm/schema\";\n\n/**\n * Resolve an enum name to its values. The map is keyed by db name\n * (`dbName ?? name`, the normalize.ts convention); a schema-side reference by\n * IR name falls back to a scan so both key styles resolve.\n */\nexport function resolveEnumValues(params: {\n name: string;\n enums: ReadonlyMap<string, EnumIR>;\n}): readonly string[] | undefined {\n const { name, enums } = params;\n const direct = enums.get(name);\n if (direct !== undefined) return direct.values;\n for (const enumDef of enums.values()) {\n if (enumDef.name === name) return enumDef.values;\n }\n return undefined;\n}\n\n/** Storage transitions are detected on physical fields, after normalization. */\nexport function isEnumStringTransition(params: { from: FieldIR; to: FieldIR }): boolean {\n const { from, to } = params;\n return (isEnumType(from.type) && to.type === \"String\") || (from.type === \"String\" && isEnumType(to.type));\n}\n\n/** Shared differ/renderer backstop for storage casts that are not yet lossless. */\nexport function assertEnumStringTransition(params: { from: FieldIR; to: FieldIR; dialect: Dialect; table: string; column: string }): void {\n const { from, to, dialect, table, column } = params;\n if (!isEnumStringTransition({ from, to })) return;\n const reason = from.isList !== to.isList\n ? \"change scalar/list shape separately from enum storage\"\n : from.default?.kind === \"dbgenerated\" || to.default?.kind === \"dbgenerated\"\n ? \"database-expression defaults may depend on the native enum type — migrate the default explicitly first\"\n : dialect === \"mysql\" && isEnumType(to.type)\n ? \"non-strict mysql can silently replace out-of-list strings with '' — validate and migrate this column manually in strict mode\"\n : undefined;\n if (reason !== undefined) {\n throw unsupportedCapability({ dialect, feature: `enum storage conversion on \"${table}\".\"${column}\"`, hint: reason });\n }\n}\n",
|
|
12
17
|
"/**\n * MySQL column-type mapping (IR → column type and back), native-type\n * normalization, comparison keys and default rendering.\n *\n * dialect-matrix §2: String → varchar(191) by default (191 because\n * utf8mb4 × 4 bytes keeps the column inside the 767-byte legacy index-key\n * limit; `@db.Text` opts into TEXT, which we never index), Boolean →\n * tinyint(1) (THE marker that lets introspection recover Boolean),\n * Int → int, BigInt → bigint, Float → double, Decimal → decimal(65,30),\n * DateTime → datetime(3), Json → json, Bytes → longblob, enums → inline\n * `ENUM('A', 'B')` — nameless in the database, so comparison keys use the\n * VALUE LIST (like sqlite) and a pulled schema synthesizes\n * `<Table>_<column>` enum names. Scalar lists are unsupported.\n */\n\nimport { VibeError, isEnumType, unsupportedCapability } from \"@vibeorm/schema\";\nimport { mysqlDialect } from \"@vibeorm/sql\";\nimport type { EnumIR, FieldIR, ScalarType } from \"@vibeorm/schema\";\nimport { resolveEnumValues } from \"./enum-values.ts\";\nimport { defaultFingerprint, quotePgString } from \"./postgres-types.ts\";\n\n// ─── Canonical scalar mapping (dialect-matrix §2) ─────────────────\n\n/** IR scalar → canonical mysql column type (information_schema spelling). */\nexport const SCALAR_TO_MYSQL: Readonly<Record<ScalarType, string>> = {\n String: `varchar(${mysqlDialect.conflictKeyEquality.defaultStringMaxLength})`,\n Boolean: \"tinyint(1)\",\n Int: \"int\",\n BigInt: \"bigint\",\n Float: \"double\",\n Decimal: \"decimal(65,30)\",\n DateTime: \"datetime(3)\",\n Json: \"json\",\n Bytes: \"longblob\",\n};\n\n/** Render-time backstop for scalar-list columns (the differ refuses earlier). */\nexport function refuseMysqlScalarList(params: { field: FieldIR }): never {\n throw unsupportedCapability({\n dialect: \"mysql\",\n feature: `scalar list column \"${params.field.name}\"`,\n hint: \"mysql has no array column type — model the list as a separate table or a JSON column\",\n });\n}\n\n// ─── Native-type normalization ────────────────────────────────────\n\nconst MYSQL_NATIVE_ALIASES: Readonly<Record<string, string>> = {\n integer: \"int\",\n dec: \"decimal\",\n numeric: \"decimal\",\n bool: \"tinyint(1)\",\n boolean: \"tinyint(1)\",\n character: \"char\",\n};\n\n/**\n * Normalize a mysql type string for comparison: lowercase, whitespace\n * stripped, base de-aliased, integer display widths dropped (mysql 8.0.19+\n * omits them; older catalogs report `int(11)`) — EXCEPT `tinyint(1)`, which is\n * the Boolean marker and must survive normalization.\n */\nexport function normalizeMysqlType(params: { raw: string }): string {\n const compact = params.raw.toLowerCase().replace(/\\s+/g, \"\");\n if (compact === \"tinyint(1)\" || compact === \"bool\" || compact === \"boolean\") return \"tinyint(1)\";\n const match = compact.match(/^([a-z_0-9]+)(\\(.*\\))?(.*)$/);\n if (match === null) return compact;\n const base = MYSQL_NATIVE_ALIASES[match[1] as string] ?? (match[1] as string);\n let modifier = match[2] ?? \"\";\n if (/^(tinyint|smallint|mediumint|int|bigint)$/.test(base)) modifier = \"\";\n return `${base}${modifier}${match[3] ?? \"\"}`;\n}\n\n// ─── Comparison keys ──────────────────────────────────────────────\n\n/**\n * Comparison key for a column on mysql. Enum columns key on their VALUE LIST\n * (order-sensitive — mysql ENUM order defines sort order); a native type equal\n * to the scalar's canonical mapping is dropped so `String` and\n * `String @db.VarChar(191)` compare equal.\n */\nexport function mysqlColumnTypeKey(params: {\n field: FieldIR;\n enums: ReadonlyMap<string, EnumIR>;\n}): string {\n const { field, enums } = params;\n if (field.isUnsupported === true) {\n return `u:${normalizeMysqlType({ raw: field.nativeType ?? \"\" })}`;\n }\n if (isEnumType(field.type)) {\n const values = resolveEnumValues({ name: field.type.enum, enums });\n return values === undefined ? `e:?${field.type.enum}` : `e:${values.join(\"|\")}`;\n }\n const listSuffix = field.isList ? \"[]\" : \"\";\n if (field.nativeType !== undefined) {\n const normalized = normalizeMysqlType({ raw: field.nativeType });\n const canonical = normalizeMysqlType({ raw: SCALAR_TO_MYSQL[field.type] });\n if (normalized !== canonical) return `n:${normalized}${listSuffix}`;\n }\n return `t:${normalizeMysqlType({ raw: SCALAR_TO_MYSQL[field.type] })}${listSuffix}`;\n}\n\n/**\n * Default fingerprint on mysql: postgres rules verbatim — tinyint(1) lets the\n * introspector map `DEFAULT '1'` back to a boolean literal, so booleans keep\n * their `bool:` fingerprint (unlike sqlite).\n */\nexport function mysqlDefaultFingerprint(params: { field: FieldIR }): string | null {\n return defaultFingerprint({ field: params.field });\n}\n\n// ─── Column type & default rendering ──────────────────────────────\n\n/** Render the mysql column type for a field (no NOT NULL, no default). */\nexport function mysqlColumnTypeSql(params: {\n field: FieldIR;\n enums: ReadonlyMap<string, EnumIR>;\n}): string {\n const { field, enums } = params;\n if (field.isUnsupported === true) {\n if (field.nativeType === undefined) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `unsupported column \"${field.name}\" carries no native type to render`,\n meta: { field: field.name },\n });\n }\n return field.nativeType;\n }\n if (field.isList) refuseMysqlScalarList({ field });\n if (isEnumType(field.type)) {\n const values = resolveEnumValues({ name: field.type.enum, enums });\n if (values === undefined) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `enum \"${field.type.enum}\" on column \"${field.name}\" is not declared in the schema`,\n meta: { field: field.name, enum: field.type.enum },\n });\n }\n if (values.some((value) => /[\\\\\\x00-\\x1f\\x7f]/.test(value))) throw unsupportedCapability({ dialect: \"mysql\", feature: \"mysqlEnumLiteralEscaping\", hint: \"ENUM labels containing backslashes or control characters require a reviewed SQL-mode-specific migration\" });\n return `ENUM(${values.map((value) => quotePgString({ value })).join(\", \")})`;\n }\n if (field.nativeType !== undefined) {\n const normalized = normalizeMysqlType({ raw: field.nativeType });\n const canonical = normalizeMysqlType({ raw: SCALAR_TO_MYSQL[field.type] });\n if (normalized !== canonical) return field.nativeType.toLowerCase();\n }\n return SCALAR_TO_MYSQL[field.type];\n}\n\n/**\n * Render the `DEFAULT` expression for a field on mysql, or `undefined` when\n * the column takes none. `now()` renders `CURRENT_TIMESTAMP(3)` (precision\n * must match the datetime(3) column); booleans store as 1/0.\n */\nexport function mysqlDefaultSql(params: { field: FieldIR }): string | undefined {\n const def = params.field.default;\n if (def === undefined) return undefined;\n switch (def.kind) {\n case \"autoincrement\":\n case \"uuid\":\n case \"cuid\":\n case \"nanoid\":\n case \"ulid\":\n return undefined;\n case \"now\":\n return \"CURRENT_TIMESTAMP(3)\";\n case \"list\":\n return refuseMysqlScalarList({ field: params.field });\n case \"literal\": {\n const value = def.value;\n if (typeof value === \"string\" && (params.field.type === \"Json\" || /[\\\\\\x00-\\x1f\\x7f]/.test(value))) {\n // Hex text is independent of NO_BACKSLASH_ESCAPES and preserves literal bytes.\n const hex = Array.from(new TextEncoder().encode(value), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n return `(CONVERT(X'${hex}' USING utf8mb4))`;\n }\n if (typeof value === \"boolean\") return value ? \"1\" : \"0\";\n if (typeof value === \"number\") return String(value);\n return quotePgString({ value });\n }\n case \"enumValue\":\n return mysqlDefaultSql({ field: { ...params.field, default: { kind: \"literal\", value: def.value } } });\n case \"dbgenerated\":\n return def.sql;\n }\n}\n\n// ─── COLUMN_TYPE parsing (introspection) ──────────────────────────\n\n/** Parse an information_schema `COLUMN_TYPE` of form `enum('A','B')`. */\nexport function parseMysqlEnumColumnType(params: { columnType: string }): string[] | null {\n const match = params.columnType.trim().match(/^enum\\((.*)\\)$/i);\n if (match === null) return null;\n const values: string[] = [];\n for (const value of (match[1] as string).matchAll(/'((?:[^']|'')*)'/g)) {\n values.push((value[1] as string).replaceAll(\"''\", \"'\"));\n }\n return values;\n}\n",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"/**\n * Dialect dispatcher for DDL rendering — the ONE public entry point. Routes to\n * the per-dialect renderers (ddl/postgres.ts, ddl/sqlite.ts, ddl/mysql.ts) so\n * every SQL-text decision stays in exactly one dialect module.\n */\n\nimport { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR } from \"@vibeorm/schema\";\nimport { renderPostgresSteps } from \"./postgres.ts\";\nimport { renderSqliteSteps, sqliteInvalidatedTables } from \"./sqlite.ts\";\nimport { renderMysqlSteps } from \"./mysql.ts\";\nimport type { MigrationStep } from \"../types.ts\";\n\ntype SqlitePreservation = {\n to?: SchemaIR;\n restore: Map<string, string[]>;\n columns: Map<string, Map<string, { sql: string; generated: boolean }>>;\n};\n\n/** Authored up/down generation uses the same trusted clauses the live planner verifies. */\nfunction declaredSqlitePreservation(params: { steps: readonly MigrationStep[]; from?: SchemaIR; to?: SchemaIR }): SqlitePreservation {\n const restore = new Map<string, string[]>();\n const columns = new Map<string, Map<string, { sql: string; generated: boolean }>>();\n let to = params.to;\n if (params.from === undefined || to === undefined || (params.from.migrationObjects?.length ?? 0) === 0) return { to, restore, columns };\n const invalid = sqliteInvalidatedTables({ steps: params.steps, from: params.from });\n const retained = new Set((to.migrationObjects ?? []).map((object) => sqlObjectKey({ identity: object.identity })));\n for (const object of params.from.migrationObjects ?? []) {\n const identity = object.identity;\n if (!(\"table\" in identity) || identity.table.namespace !== \"main\" || !invalid.rebuilt.has(identity.table.name) || !retained.has(sqlObjectKey({ identity }))) continue;\n const facts = object.expected?.facts;\n if (facts === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"SQLite rebuild requires independently declared preservation definitions\", meta: { reason: \"sqlite-preservation-unavailable\", identity } });\n if (identity.kind === \"trigger\" || identity.kind === \"index\") {\n if (identity.kind === \"index\" && to.models.some((model) => (model.dbName ?? model.name) === identity.table.name && model.indexes.some((index) => index.name === identity.name))) continue;\n if (typeof facts.definition !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Missing SQLite restoration SQL\", meta: { reason: \"sqlite-preservation-unavailable\", identity } });\n const statements = restore.get(identity.table.name) ?? [];\n statements.push(facts.definition);\n restore.set(identity.table.name, statements);\n } else if (identity.kind === \"column\" || identity.kind === \"generatedColumn\") {\n if (typeof facts.columnDefinition !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Missing SQLite column clause\", meta: { reason: \"sqlite-preservation-unavailable\", identity } });\n const fields = columns.get(identity.table.name) ?? new Map<string, { sql: string; generated: boolean }>();\n fields.set(identity.column, { sql: facts.columnDefinition, generated: Number(facts.generated) > 1 });\n columns.set(identity.table.name, fields);\n } else if (identity.kind === \"columnDefault\") {\n if (facts.definition !== null && typeof facts.definition !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Missing SQLite default clause\", meta: { reason: \"sqlite-preservation-unavailable\", identity } });\n const expression = facts.definition;\n to = { ...to, models: to.models.map((model) => (model.dbName ?? model.name) !== identity.table.name ? model : { ...model, fields: model.fields.map((field) => {\n if ((field.dbName ?? field.name) !== identity.column) return field;\n const { default: ignored, ...rest } = field;\n return { ...rest, ...(expression === null ? {} : { default: { kind: \"dbgenerated\" as const, sql: expression } }) };\n }) }) };\n }\n }\n return { to, restore, columns };\n}\n\n/**\n * Render migration steps to SQL statements (one string per statement, in\n * order) for a dialect.\n *\n * `from`/`to` — the schemas the steps were diffed from — are OPTIONAL for\n * postgres (ignored) but needed by sqlite whenever a step compiles to the\n * table-rebuild recipe (the target table shape lives on the schema, not the\n * step) and by sqlite/mysql for enum columns (CHECK / inline ENUM values).\n * `generateMigration` and `push` always pass them; direct callers rendering\n * rebuild-free, enum-free steps may omit them.\n */\nexport function renderSteps(params: {\n steps: readonly MigrationStep[];\n dialect: Dialect;\n from?: SchemaIR;\n to?: SchemaIR;\n /** Captured trigger/index SQL restored inside each SQLite rebuild transaction. */\n sqliteRestore?: ReadonlyMap<string, readonly string[]>;\n /** Verified generated/extra column clauses copied into rebuilt SQLite tables. */\n sqliteColumns?: ReadonlyMap<string, ReadonlyMap<string, { readonly sql: string; readonly generated: boolean }>>;\n}): string[] {\n const { steps, dialect, from, to } = params;\n // @collation (board #36) follows the @db.* native-type precedent: a\n // dialect-specific column annotation, rendered where it has meaning (mysql)\n // and inert elsewhere — NOT a capability refusal, so one portable schema\n // can carry it across the dialect matrix.\n switch (dialect) {\n case \"postgres\":\n return renderPostgresSteps({ steps });\n case \"sqlite\": {\n const preserved = declaredSqlitePreservation({ ...params, ...(from === undefined ? {} : { from }), ...(to === undefined ? {} : { to }) });\n return renderSqliteSteps({\n steps,\n restore: params.sqliteRestore ?? preserved.restore,\n preservedColumns: params.sqliteColumns ?? preserved.columns,\n ...(from === undefined ? {} : { from }),\n ...(preserved.to === undefined ? {} : { to: preserved.to }),\n });\n }\n case \"mysql\":\n return renderMysqlSteps({\n steps,\n ...(from === undefined ? {} : { from }),\n ...(to === undefined ? {} : { to }),\n });\n }\n}\n",
|
|
16
|
-
"/**\n * Postgres DDL renderer: migration steps → SQL statements.\n *\n * Every identifier is quoted through `postgresDialect.quoteIdent` — the ONE\n * quoting decision point (@vibeorm/sql). Choices, each pinned by a renderer\n * test:\n *\n * - autoincrement renders as `GENERATED BY DEFAULT AS IDENTITY` (SQL-standard,\n * no sequence-name coupling; postgres ≥10 and pglite both support it) — not\n * SERIAL. The introspector maps identity columns back to autoincrement.\n * - DROP TABLE is restricted; the differ drops dependent foreign keys first.\n * - Core table, enum and index identities always target the public namespace.\n * - scalar→array type changes carry the LEARNINGS `USING CASE WHEN col IS NULL\n * THEN NULL ELSE ARRAY[col] END` repair clause (postgres cannot implicit-cast).\n * - `ALTER TYPE ... ADD VALUE IF NOT EXISTS` appends at the end of the enum\n * (no BEFORE/AFTER positioning); fine inside a transaction on postgres ≥12.\n * - Unsupported columns render their `nativeType` verbatim and migrate like\n * any other column.\n */\n\nimport { renderExclusionSetup } from \"@vibeorm/sql\";\nimport { VibeError, isEnumType } from \"@vibeorm/schema\";\nimport type { FieldIR } from \"@vibeorm/schema\";\nimport { postgresDialect, renderRlsPolicyPath } from \"@vibeorm/sql\";\nimport {\n CASCADE_ACTION_SQL,\n columnTypeSql,\n defaultSql,\n isIdentityColumn,\n quotePgString,\n} from \"../postgres-types.ts\";\nimport type { MigrationStep } from \"../types.ts\";\nimport { renderRlsStep } from \"./rls.ts\";\nimport { assertEnumStringTransition, isEnumStringTransition } from \"../enum-values.ts\";\n\n// ─── Public API ───────────────────────────────────────────────────\n\n/** Render migration steps to postgres SQL (one string per statement, in order). */\nexport function renderPostgresSteps(params: { steps: readonly MigrationStep[] }): string[] {\n refuseSameTransactionEnumUse({ steps: params.steps });\n return params.steps.flatMap((step) => renderStep({ step }));\n}\n\n/**\n * PostgreSQL refuses to USE an enum member that was added in the same\n * transaction (\"unsafe use of new value of enum type\") — the member exists but\n * is not committed, so a DEFAULT or a backfill referring to it fails AT APPLY\n * TIME, after part of the migration already ran. Migrations run in one\n * transaction here (`push`, `runTransactional`), so this combination can never\n * succeed: refuse while rendering, naming the split, instead of shipping a\n * migration that cannot be applied (F34).\n *\n * Only NATIVE enums reach this: string-backed enums produce no `addEnumValue`\n * step, and sqlite/mysql inline their enums into the column.\n */\nfunction refuseSameTransactionEnumUse(params: { steps: readonly MigrationStep[] }): void {\n const added = new Map<string, Set<string>>();\n for (const step of params.steps) {\n if (step.kind !== \"addEnumValue\") continue;\n const values = added.get(step.enumName) ?? new Set<string>();\n values.add(step.value);\n added.set(step.enumName, values);\n }\n if (added.size === 0) return;\n\n const use = (field: FieldIR): { enumName: string; value: string } | undefined => {\n if (!isEnumType(field.type)) return undefined;\n const enumName = field.type.enum;\n const def = field.default;\n const candidates = def?.kind === \"list\" ? def.values : def?.kind === \"enumValue\" || def?.kind === \"literal\" ? [def.value] : [];\n const value = candidates.find((entry): entry is string => typeof entry === \"string\" && added.get(enumName)?.has(entry) === true);\n return value === undefined ? undefined : { enumName, value };\n };\n\n for (const step of params.steps) {\n if (step.kind !== \"createTable\" && step.kind !== \"addColumn\" && step.kind !== \"alterColumn\") {\n continue;\n }\n const fields: readonly FieldIR[] =\n step.kind === \"createTable\" ? step.columns : step.kind === \"addColumn\" ? [step.column] : [step.to];\n for (const field of fields) {\n const found = use(field);\n if (found === undefined) continue;\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `enum value \"${found.value}\" is added to \"${found.enumName}\" and used as a default on \"${step.table}\".\"${field.dbName ?? field.name}\" in the same migration — PostgreSQL cannot use an enum member before the transaction that added it commits. Split this into two migrations: the first containing only the ALTER TYPE ... ADD VALUE, the second the column change`,\n meta: { enum: found.enumName, value: found.value, table: step.table, column: field.dbName ?? field.name, rule: \"enum-value-used-in-adding-transaction\" },\n });\n }\n }\n}\n\n// ─── Per-step rendering ───────────────────────────────────────────\n\nfunction renderStep(params: { step: MigrationStep }): string[] {\n const { step } = params;\n switch (step.kind) {\n case \"addExclusion\":\n return [...renderExclusionSetup({ dialect: postgresDialect, exclusion: step.exclusion }), `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(step.exclusion.name)} ${step.exclusion.definition};`];\n case \"dropExclusion\":\n return [`ALTER TABLE ${publicName(step.table)} DROP CONSTRAINT ${q(step.exclusion.name)};`];\n case \"enableRls\":\n case \"forceRls\":\n case \"disableRls\":\n case \"noForceRls\":\n case \"createPolicy\":\n case \"dropPolicy\":\n return step.kind === \"createPolicy\"\n ? [renderRlsPolicyPath({ dialect: postgresDialect, stage: \"save\" }).text, renderRlsPolicyPath({ dialect: postgresDialect, stage: \"empty\" }).text, ...renderRlsStep({ step, dialect: \"postgres\" }), renderRlsPolicyPath({ dialect: postgresDialect, stage: \"restore\" }).text]\n : renderRlsStep({ step, dialect: \"postgres\" });\n case \"createEnum\": {\n const name = step.enumDef.dbName ?? step.enumDef.name;\n const values = step.enumDef.values.map((value) => quotePgString({ value })).join(\", \");\n return [`CREATE TYPE ${publicName(name)} AS ENUM (${values});`];\n }\n case \"dropEnum\":\n return [`DROP TYPE ${publicName(step.enumName)};`];\n case \"addEnumValue\":\n return [\n `ALTER TYPE ${publicName(step.enumName)} ADD VALUE IF NOT EXISTS ${quotePgString({ value: step.value })};`,\n ];\n case \"createTable\": {\n const lines = step.columns.map((column) => ` ${columnDefSql({ field: column })}`);\n if (step.primaryKey.length > 0) {\n const pkCols = step.primaryKey.map((column) => q(column)).join(\", \");\n lines.push(` CONSTRAINT ${q(step.primaryKeyConstraintName ?? `${step.table}_pkey`)} PRIMARY KEY (${pkCols})`);\n }\n for (const check of step.checks ?? []) {\n lines.push(` CONSTRAINT ${q(check.name)} CHECK (${check.expression})`);\n }\n return [`CREATE TABLE ${publicName(step.table)} (\\n${lines.join(\",\\n\")}\\n);`];\n }\n case \"dropTable\":\n case \"dropJoinTable\":\n return [`DROP TABLE ${publicName(step.table)};`];\n case \"dropView\":\n // No CASCADE: a view-on-view dependency fails LOUDLY instead of silently\n // taking a surviving dependent view with it (#26).\n return [`DROP VIEW IF EXISTS ${publicName(step.table)};`];\n case \"addColumn\":\n return [`ALTER TABLE ${publicName(step.table)} ADD COLUMN ${columnDefSql({ field: step.column })};`];\n case \"dropColumn\":\n return [`ALTER TABLE ${publicName(step.table)} DROP COLUMN ${q(step.column)};`];\n case \"alterColumn\":\n return renderAlterColumn({ step });\n case \"createIndex\": {\n const unique = step.unique ? \"UNIQUE \" : \"\";\n const using = !step.unique && step.indexKind !== \"btree\" ? ` USING ${step.indexKind}` : \"\";\n const cols = step.columns\n .map((column) => `${q(column.name)}${column.desc ? \" DESC\" : \"\"}`)\n .join(\", \");\n // pg 15+ clause; the flag sits between the column list and WHERE.\n const nulls = step.nullsNotDistinct === true ? \" NULLS NOT DISTINCT\" : \"\";\n const where = step.where === undefined ? \"\" : ` WHERE ${step.where}`;\n return [\n `CREATE ${unique}INDEX ${q(step.name)} ON ${publicName(step.table)}${using} (${cols})${nulls}${where};`,\n ];\n }\n case \"dropIndex\":\n if (step.constraintName !== undefined) {\n if (step.table === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Constraint-backed index removal requires its owning table\" });\n return [`ALTER TABLE ${publicName(step.table)} DROP CONSTRAINT ${q(step.constraintName)};`];\n }\n return [`DROP INDEX ${publicName(step.name)};`];\n case \"addCheck\":\n return [\n `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(step.name)} CHECK (${step.expression});`,\n ];\n case \"dropCheck\":\n return [`ALTER TABLE ${publicName(step.table)} DROP CONSTRAINT ${q(step.name)};`];\n case \"addForeignKey\": {\n const cols = step.columns.map((column) => q(column)).join(\", \");\n const refCols = step.refColumns.map((column) => q(column)).join(\", \");\n return [\n `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(step.constraintName)} FOREIGN KEY (${cols}) REFERENCES ${publicName(step.refTable)} (${refCols}) ON DELETE ${CASCADE_ACTION_SQL[step.onDelete]} ON UPDATE ${CASCADE_ACTION_SQL[step.onUpdate]};`,\n ];\n }\n case \"addForeignKeyNotValid\": {\n // NOT VALID skips the scan of existing rows, so the ACCESS EXCLUSIVE lock\n // is held for a catalog write instead of a full table read. New and\n // changed rows are enforced immediately; the existing ones are only\n // proven by the separate VALIDATE CONSTRAINT step below.\n const cols = step.columns.map((column) => q(column)).join(\", \");\n const refCols = step.refColumns.map((column) => q(column)).join(\", \");\n return [\n `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(step.constraintName)} FOREIGN KEY (${cols}) REFERENCES ${publicName(step.refTable)} (${refCols}) ON DELETE ${CASCADE_ACTION_SQL[step.onDelete]} ON UPDATE ${CASCADE_ACTION_SQL[step.onUpdate]} NOT VALID;`,\n ];\n }\n case \"addCheckNotValid\":\n return [\n `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(step.name)} CHECK (${step.expression}) NOT VALID;`,\n ];\n case \"validateConstraint\":\n // SHARE UPDATE EXCLUSIVE: concurrent reads and writes continue while the\n // scan runs. Cheaper than the combined ADD, not free.\n return [`ALTER TABLE ${publicName(step.table)} VALIDATE CONSTRAINT ${q(step.name)};`];\n case \"renameTable\":\n // Rows, defaults, indexes, constraints, inbound foreign keys and policy\n // expressions all follow the object: PostgreSQL stores them against its\n // identity, not its name.\n return [`ALTER TABLE ${publicName(step.from)} RENAME TO ${q(step.to)};`];\n case \"renameColumn\":\n return [`ALTER TABLE ${publicName(step.table)} RENAME COLUMN ${q(step.from)} TO ${q(step.to)};`];\n case \"dropForeignKey\":\n return [`ALTER TABLE ${publicName(step.table)} DROP CONSTRAINT ${q(step.constraintName)};`];\n case \"createJoinTable\": {\n // Prisma's implicit join-table shape: columns \"A\"/\"B\", a unique index on\n // (A, B), an index on B, both FKs cascading (see @vibeorm/schema m2m.ts).\n const aType = columnTypeSql({ field: { ...step.a.field, isList: false } });\n const bType = columnTypeSql({ field: { ...step.b.field, isList: false } });\n return [\n `CREATE TABLE ${publicName(step.table)} (\\n \"A\" ${aType} NOT NULL,\\n \"B\" ${bType} NOT NULL\\n);`,\n `CREATE UNIQUE INDEX ${q(`${step.table}_AB_unique`)} ON ${publicName(step.table)} (\"A\", \"B\");`,\n `CREATE INDEX ${q(`${step.table}_B_index`)} ON ${publicName(step.table)} (\"B\");`,\n `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(`${step.table}_A_fkey`)} FOREIGN KEY (\"A\") REFERENCES ${publicName(step.a.table)} (${q(step.a.column)}) ON DELETE CASCADE ON UPDATE CASCADE;`,\n `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(`${step.table}_B_fkey`)} FOREIGN KEY (\"B\") REFERENCES ${publicName(step.b.table)} (${q(step.b.column)}) ON DELETE CASCADE ON UPDATE CASCADE;`,\n ];\n }\n case \"addPrimaryKey\": {\n const cols = step.columns.map((column) => q(column)).join(\", \");\n return [\n `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(step.constraintName ?? `${step.table}_pkey`)} PRIMARY KEY (${cols});`,\n ];\n }\n case \"dropPrimaryKey\":\n return [`ALTER TABLE ${publicName(step.table)} DROP CONSTRAINT ${q(step.constraintName ?? `${step.table}_pkey`)};`];\n }\n}\n\n// ─── Column pieces ────────────────────────────────────────────────\n\nfunction columnDefSql(params: { field: FieldIR }): string {\n const { field } = params;\n const name = q(field.dbName ?? field.name);\n\n if (field.default?.kind === \"autoincrement\" && !isIdentityColumn({ field })) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `autoincrement default on \"${field.name}\" requires a non-list Int or BigInt column`,\n meta: { field: field.name },\n });\n }\n\n let def = `${name} ${columnTypeSql({ field })}`;\n if (isIdentityColumn({ field })) def += \" GENERATED BY DEFAULT AS IDENTITY\";\n if (!field.isOptional) def += \" NOT NULL\";\n const defaultExpr = defaultSql({ field });\n if (defaultExpr !== undefined) def += ` DEFAULT ${defaultExpr}`;\n return def;\n}\n\nfunction renderAlterColumn(params: {\n step: Extract<MigrationStep, { kind: \"alterColumn\" }>;\n}): string[] {\n const { step } = params;\n const statements: string[] = [];\n const column = q(step.column);\n const alterPrefix = `ALTER TABLE ${publicName(step.table)} ALTER COLUMN ${column}`;\n\n const storageChange = step.changes.includes(\"type\") && isEnumStringTransition({ from: step.from, to: step.to });\n if (storageChange) assertEnumStringTransition({ from: step.from, to: step.to, dialect: \"postgres\", table: step.table, column: step.column });\n // USING only casts stored rows, not the default expression. Drop a text\n // default before casting to a native enum, then restore the target default.\n const droppedDefault = storageChange && isEnumType(step.to.type) && defaultSql({ field: step.from }) !== undefined;\n if (droppedDefault) statements.push(`${alterPrefix} DROP DEFAULT;`);\n\n if (step.changes.includes(\"type\")) {\n // LEARNINGS: scalar→array of the same base type needs a USING repair —\n // postgres cannot implicit-cast a scalar into a one-element array.\n const scalarToArray =\n step.to.isList && !step.from.isList\n ? ` USING CASE WHEN ${column} IS NULL THEN NULL ELSE ARRAY[${column}] END`\n : \"\";\n statements.push(\n `${alterPrefix} SET DATA TYPE ${columnTypeSql({ field: step.to })}${storageChange ? ` USING ${column}::${columnTypeSql({ field: step.to })}` : scalarToArray};`,\n );\n }\n\n if (step.changes.includes(\"nullability\")) {\n statements.push(`${alterPrefix} ${step.to.isOptional ? \"DROP\" : \"SET\"} NOT NULL;`);\n }\n\n if (step.changes.includes(\"default\") || droppedDefault) {\n if (step.to.default?.kind === \"autoincrement\") {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `cannot add autoincrement to existing column \"${step.table}\".\"${step.column}\" — drop and recreate the column instead`,\n meta: { table: step.table, column: step.column },\n });\n }\n const defaultExpr = defaultSql({ field: step.to });\n statements.push(\n defaultExpr === undefined\n ? `${alterPrefix} DROP DEFAULT;`\n : `${alterPrefix} SET DEFAULT ${defaultExpr};`,\n );\n }\n\n return statements;\n}\n\n// ─── Quoting ──────────────────────────────────────────────────────\n\nfunction publicName(name: string): string {\n return `${q(\"public\")}.${q(name)}`;\n}\n\nfunction q(name: string): string {\n return postgresDialect.quoteIdent({ name });\n}\n",
|
|
17
|
-
"/**\n * SQLite DDL renderer: migration steps → SQL statements, including THE TABLE\n * REBUILD — sqlite has no ALTER COLUMN, cannot add/drop constraints, and its\n * DROP COLUMN is heavily restricted, so any such step compiles to the\n * documented 12-step recipe (https://sqlite.org/lang_altertable.html §7),\n * emitted as an ordered, self-contained statement block:\n *\n * PRAGMA foreign_keys=OFF;\n * BEGIN;\n * CREATE TABLE \"T_new\" (…target shape: columns, PK, FKs, enum CHECKs…);\n * INSERT INTO \"T_new\" (common cols) SELECT common cols FROM \"T\";\n * DROP TABLE \"T\";\n * ALTER TABLE \"T_new\" RENAME TO \"T\";\n * CREATE …INDEX… (every index of the target table);\n * PRAGMA foreign_key_check;\n * COMMIT;\n * PRAGMA foreign_keys=ON;\n *\n * Because the block manages its own transaction (PRAGMA foreign_keys is a\n * no-op inside one), callers must NOT wrap scripts containing it — push and\n * the runner detect this via `usesSelfManagedTransactions` (execute.ts).\n * Rebuild blocks are emitted AFTER all other statements so a rebuilt table's\n * new FKs can reference tables created earlier in the same script — EXCEPT a\n * rebuild that removes an FK to a table this migration drops, which is hoisted\n * ahead of the drops: sqlite's DROP TABLE cascades into surviving child rows\n * while the FK is still installed (F27).\n *\n * Cheap paths are preferred wherever sqlite's plain ALTER suffices:\n * `ADD COLUMN` (unless the column is required without a literal default, or\n * defaults to CURRENT_TIMESTAMP / an expression — both forbidden in ADD\n * COLUMN) and `DROP COLUMN` (unless the column is in the PK, any index or\n * partial-index predicate, an FK on either side, or carries an enum CHECK).\n *\n * Column-value transfer on rebuild: dropped columns are omitted, added\n * columns take their default (or NULL), type-changed columns are a PLAIN COPY\n * — sqlite's flexible typing keeps the stored values as-is, so e.g. non-numeric\n * TEXT survives verbatim inside an INTEGER column (documented lossy-ness:\n * nothing is coerced, nothing is validated beyond the new CHECK constraints).\n *\n * Other pinned choices:\n * - autoincrement renders `INTEGER PRIMARY KEY AUTOINCREMENT` (monotonic ids,\n * Prisma parity) — plain `INTEGER PRIMARY KEY` would reuse rowids after\n * deletes. The `PRIMARY KEY AUTOINCREMENT` text is also the introspection\n * marker. Costs the `sqlite_sequence` bookkeeping table (skipped on pull).\n * - Composite / non-autoincrement PKs render as an unnamed table-level\n * `PRIMARY KEY (…)` (sqlite keeps constraint names only as noise).\n * - Enums render TEXT + a NAMED column-level CHECK (see sqlite-types.ts) —\n * the name (`<table>_<column>_enum_<Enum>`) is how pull recovers the enum.\n * - `DROP TABLE` has no CASCADE on sqlite; table drops are topologically\n * ordered (referencing tables first) using the `from` schema.\n * - Index kinds other than btree/unique throw VIBE_UNSUPPORTED_CAPABILITY.\n */\n\nimport { VibeError, isEnumType, unsupportedCapability } from \"@vibeorm/schema\";\nimport type { EnumIR, FieldIR, SchemaIR } from \"@vibeorm/schema\";\nimport { sqliteDialect } from \"@vibeorm/sql\";\nimport { resolveEnumValues } from \"../enum-values.ts\";\nimport { orderDropsChildrenFirst } from \"./drop-order.ts\";\nimport { normalizeSchema } from \"../normalize.ts\";\nimport type { NormalizedSchema, NormalizedTable } from \"../normalize.ts\";\nimport { CASCADE_ACTION_SQL, quotePgString } from \"../postgres-types.ts\";\nimport {\n sqliteDefaultSql,\n sqliteEnumCheckName,\n sqliteStorageType,\n} from \"../sqlite-types.ts\";\nimport { describeStep } from \"../types.ts\";\nimport type { IndexColumn, MigrationStep, SqlExecutor } from \"../types.ts\";\nimport { isRlsStep, renderRlsStep } from \"./rls.ts\";\n\n// ─── Public API ───────────────────────────────────────────────────\n\n/**\n * Render migration steps to sqlite SQL. `from`/`to` (the schemas that produced\n * the steps) are required whenever a step triggers a table rebuild or renders\n * an enum column — `generateMigration` and `push` always pass them.\n */\nexport function renderSqliteSteps(params: {\n steps: readonly MigrationStep[];\n from?: SchemaIR;\n to?: SchemaIR;\n restore?: ReadonlyMap<string, readonly string[]>;\n preservedColumns?: ReadonlyMap<string, ReadonlyMap<string, { readonly sql: string; readonly generated: boolean }>>;\n}): string[] {\n const { steps } = params;\n for (const step of steps) if (isRlsStep({ step })) renderRlsStep({ step, dialect: \"sqlite\" });\n const fromNorm = params.from === undefined\n ? undefined\n : normalizeSchema({ schema: params.from, dialect: \"sqlite\" });\n const toNorm = params.to === undefined\n ? undefined\n : normalizeSchema({ schema: params.to, dialect: \"sqlite\" });\n const enums: ReadonlyMap<string, EnumIR> = toNorm?.enums ?? new Map();\n\n // ── Classification: which tables need the rebuild recipe? ──\n const { createdTables, foldedFks, rebuildTables } = classifyRebuilds({ steps, fromNorm });\n const rebuildSet = new Set(rebuildTables);\n\n // ── Topological drop order (referencing tables first — no CASCADE). ──\n const dropNames = steps\n .filter((step) => step.kind === \"dropTable\" || step.kind === \"dropJoinTable\")\n .map((step) => (step as Extract<MigrationStep, { kind: \"dropTable\" }>).table);\n const orderedDrops = orderDropsChildrenFirst({ names: dropNames, fromNorm });\n let dropCursor = 0;\n\n // ── Drop-order safety (F27) ──\n // With `PRAGMA foreign_keys=ON` (what every shipped adapter forces) sqlite's\n // DROP TABLE runs an implicit DELETE FROM first, and that fires the child\n // side's ON DELETE CASCADE. A surviving child whose FK this very migration\n // removes would therefore lose its rows — silently — because the FK removal\n // is a rebuild and rebuilds are emitted last. Such a rebuild is HOISTED to\n // run before the first drop; afterwards the parent has no referencing child\n // and its drop deletes nothing but itself.\n const droppedTables = new Set(dropNames);\n const hoistedRebuilds: string[] = [];\n if (droppedTables.size > 0 && fromNorm !== undefined) {\n for (const table of rebuildTables) {\n const releasesDroppedParent = [...(fromNorm.tables.get(table)?.fks.values() ?? [])].some(\n (fk) => droppedTables.has(fk.refTable),\n );\n if (!releasesDroppedParent) continue;\n // The one shape that cannot be ordered: the same rebuild also gains an FK\n // to a table this migration creates (creates come after drops). Refuse\n // instead of choosing between a broken FK and deleted rows.\n const awaitsNewParent = [...(toNorm?.tables.get(table)?.fks.values() ?? [])].some((fk) =>\n createdTables.has(fk.refTable),\n );\n if (awaitsNewParent) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `cannot order this sqlite migration safely: rebuilding \"${table}\" must happen BEFORE the dropped table(s) it references (${[\n ...droppedTables,\n ].join(\", \")}) so their cascade cannot delete its rows, but AFTER the table(s) its new foreign keys reference, which this same migration creates — split it into two migrations`,\n meta: { table, dropped: [...droppedTables] },\n });\n }\n hoistedRebuilds.push(table);\n }\n }\n const hoisted = new Set(hoistedRebuilds);\n let hoistedFlushed = false;\n\n // ── Emission: step order, rebuild-triggering steps absorbed. ──\n const statements: string[] = [];\n const renderRebuildBlock = (table: string): string[] => {\n const step = steps.find(\n (candidate) => \"table\" in candidate && candidate.table === table,\n ) as MigrationStep;\n requireSchemas({ step, fromNorm, toNorm });\n return renderTableRebuild({\n table,\n from: fromNorm as NormalizedSchema,\n to: toNorm as NormalizedSchema,\n restore: params.restore?.get(table) ?? [],\n preservedColumns: params.preservedColumns?.get(table) ?? new Map(),\n });\n };\n for (const step of steps) {\n switch (step.kind) {\n case \"addExclusion\": case \"dropExclusion\": throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: \"Exclusion constraints require PostgreSQL\", meta: { dialect: \"sqlite\", feature: \"exclusionConstraints\" } });\n case \"createEnum\":\n case \"dropEnum\":\n case \"addEnumValue\":\n break; // No standalone enum objects on sqlite — enums live in columns.\n case \"createTable\":\n statements.push(\n createTableSql({\n table: step.table,\n constraintTable: step.table,\n columns: step.columns,\n primaryKey: step.primaryKey,\n checks: step.checks ?? [],\n fks: (foldedFks.get(step.table) ?? []).map((fk) => ({\n constraintName: fk.constraintName,\n columns: fk.columns,\n refTable: fk.refTable,\n refColumns: fk.refColumns,\n onDelete: CASCADE_ACTION_SQL[fk.onDelete],\n onUpdate: CASCADE_ACTION_SQL[fk.onUpdate],\n })),\n enums,\n }),\n );\n break;\n case \"addCheck\":\n case \"dropCheck\":\n break; // Absorbed by the table rebuild classified above.\n case \"createJoinTable\": {\n const aType = sqliteStorageType({ field: { ...step.a.field, isList: false } });\n const bType = sqliteStorageType({ field: { ...step.b.field, isList: false } });\n statements.push(\n `CREATE TABLE ${q(step.table)} (\\n \"A\" ${aType} NOT NULL,\\n \"B\" ${bType} NOT NULL,\\n CONSTRAINT ${q(`${step.table}_A_fkey`)} FOREIGN KEY (\"A\") REFERENCES ${q(step.a.table)} (${q(step.a.column)}) ON DELETE CASCADE ON UPDATE CASCADE,\\n CONSTRAINT ${q(`${step.table}_B_fkey`)} FOREIGN KEY (\"B\") REFERENCES ${q(step.b.table)} (${q(step.b.column)}) ON DELETE CASCADE ON UPDATE CASCADE\\n);`,\n `CREATE UNIQUE INDEX ${q(`${step.table}_AB_unique`)} ON ${q(step.table)} (\"A\", \"B\");`,\n `CREATE INDEX ${q(`${step.table}_B_index`)} ON ${q(step.table)} (\"B\");`,\n );\n break;\n }\n case \"addColumn\":\n if (!rebuildSet.has(step.table)) {\n statements.push(\n `ALTER TABLE ${q(step.table)} ADD COLUMN ${columnDefSql({\n field: step.column,\n constraintTable: step.table,\n enums,\n inlinePkAutoincrement: false,\n })};`,\n );\n }\n break;\n case \"dropColumn\":\n if (!rebuildSet.has(step.table)) {\n statements.push(`ALTER TABLE ${q(step.table)} DROP COLUMN ${q(step.column)};`);\n }\n break;\n case \"createIndex\":\n if (!rebuildSet.has(step.table)) {\n statements.push(\n createIndexSql({\n table: step.table,\n name: step.name,\n unique: step.unique,\n kind: step.indexKind,\n columns: step.columns,\n where: step.where,\n nullsNotDistinct: step.nullsNotDistinct,\n }),\n );\n }\n break;\n case \"dropIndex\":\n // Always emitted — dropping an index of a soon-rebuilt table early is\n // harmless (the rebuild recreates the target set) and keeps the\n // GLOBAL index namespace clean for later creates.\n statements.push(`DROP INDEX ${q(step.name)};`);\n break;\n case \"dropTable\":\n case \"dropJoinTable\":\n if (!hoistedFlushed) {\n hoistedFlushed = true;\n for (const table of hoistedRebuilds) statements.push(...renderRebuildBlock(table));\n }\n statements.push(`DROP TABLE ${q(orderedDrops[dropCursor] as string)};`);\n dropCursor += 1;\n break;\n case \"dropView\":\n // Ordered first by the differ (#26) — a leftover view would otherwise\n // block the column drops (or rebuilds) beneath it.\n statements.push(`DROP VIEW IF EXISTS ${q(step.table)};`);\n break;\n case \"renameTable\":\n case \"renameColumn\": {\n // sqlite renames are real ALTERs (3.25+) and preserve rows, defaults\n // and indexes. They cannot be combined with a rebuild of the same\n // table in one migration: the rebuild recipe is written against one\n // table name, so the order would decide the outcome. Split them.\n const renamed = step.kind === \"renameTable\" ? step.from : step.table;\n if (rebuildSet.has(renamed) || (step.kind === \"renameTable\" && rebuildSet.has(step.to))) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `sqlite cannot rename \"${renamed}\" in the same migration that rebuilds it — the table-rebuild recipe is written against a single table name. Split the rename and the column/constraint change into two migrations`,\n meta: { reason: \"rename-ambiguous\", table: renamed, dialect: \"sqlite\" },\n });\n }\n statements.push(\n step.kind === \"renameTable\"\n ? `ALTER TABLE ${q(step.from)} RENAME TO ${q(step.to)};`\n : `ALTER TABLE ${q(step.table)} RENAME COLUMN ${q(step.from)} TO ${q(step.to)};`,\n );\n break;\n }\n case \"addForeignKeyNotValid\":\n case \"addCheckNotValid\":\n case \"validateConstraint\":\n // sqlite has no NOT VALID / VALIDATE split, and its constraint changes\n // go through a full table rebuild anyway — there is no staged path to\n // offer, so it refuses instead of pretending.\n throw unsupportedCapability({\n dialect: \"sqlite\",\n feature: \"stagedConstraints\",\n hint: \"sqlite applies constraint changes by rebuilding the table; add the constraint in one step\",\n });\n case \"alterColumn\":\n case \"addForeignKey\":\n case \"dropForeignKey\":\n case \"addPrimaryKey\":\n case \"dropPrimaryKey\":\n if (\n (step.kind === \"addForeignKey\" && createdTables.has(step.table)) ||\n !rebuildSet.has(step.table)\n ) {\n break; // Folded into CREATE TABLE, or absorbed by that table's rebuild.\n }\n requireSchemas({ step, fromNorm, toNorm });\n break;\n }\n }\n\n // ── Rebuild blocks last (new FK targets already exist by now). ──\n for (const table of rebuildTables) {\n if (hoisted.has(table)) continue; // Already emitted ahead of the drops.\n statements.push(...renderRebuildBlock(table));\n }\n\n return statements;\n}\n\n// ─── Rebuild classification ───────────────────────────────────────\n\ntype RebuildClassification = {\n readonly createdTables: ReadonlySet<string>;\n readonly foldedFks: ReadonlyMap<string, Extract<MigrationStep, { kind: \"addForeignKey\" }>[]>;\n /** Insertion order = deterministic block order. */\n readonly rebuildTables: readonly string[];\n};\n\nfunction classifyRebuilds(params: {\n steps: readonly MigrationStep[];\n fromNorm: NormalizedSchema | undefined;\n}): RebuildClassification {\n const { steps, fromNorm } = params;\n const createdTables = new Set<string>();\n for (const step of steps) {\n if (step.kind === \"createTable\" || step.kind === \"createJoinTable\") {\n createdTables.add(step.table);\n }\n }\n\n const foldedFks = new Map<string, Extract<MigrationStep, { kind: \"addForeignKey\" }>[]>();\n const rebuildTables: string[] = [];\n const markRebuild = (table: string): void => {\n if (!rebuildTables.includes(table)) rebuildTables.push(table);\n };\n\n for (const step of steps) {\n switch (step.kind) {\n case \"addExclusion\": case \"dropExclusion\": throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: \"Exclusion constraints require PostgreSQL\", meta: { dialect: \"sqlite\", feature: \"exclusionConstraints\" } });\n case \"alterColumn\":\n case \"dropForeignKey\":\n case \"addPrimaryKey\":\n case \"dropPrimaryKey\":\n // sqlite has no ALTER for CHECK constraints — both directions rebuild.\n case \"addCheck\":\n case \"dropCheck\":\n markRebuild(step.table);\n break;\n case \"addColumn\":\n if (!isCheapAddColumn({ field: step.column })) markRebuild(step.table);\n break;\n case \"dropColumn\":\n if (!canCheapDropColumn({ table: step.table, column: step.column, fromNorm })) {\n markRebuild(step.table);\n }\n break;\n case \"addForeignKey\":\n if (createdTables.has(step.table)) {\n const list = foldedFks.get(step.table);\n if (list === undefined) foldedFks.set(step.table, [step]);\n else list.push(step);\n } else {\n markRebuild(step.table);\n }\n break;\n default:\n break;\n }\n }\n return { createdTables, foldedFks, rebuildTables };\n}\n\n/**\n * Tables whose sqlite DDL will DROP and re-create them (the rebuild recipe) or\n * drop them outright — i.e. every table that loses its attached objects.\n * SQLite's `DROP TABLE` takes the table's triggers with it, and the rebuild\n * restores only the core indexes, so callers holding extension artifacts (FTS\n * synchronization triggers) must re-create theirs afterwards (F31).\n */\nexport function sqliteInvalidatedTables(params: {\n steps: readonly MigrationStep[];\n from?: SchemaIR;\n}): { rebuilt: Set<string>; dropped: Set<string> } {\n const fromNorm = params.from === undefined\n ? undefined\n : normalizeSchema({ schema: params.from, dialect: \"sqlite\" });\n const rebuilt = new Set(classifyRebuilds({ steps: params.steps, fromNorm }).rebuildTables);\n const dropped = new Set<string>();\n for (const step of params.steps) {\n if (step.kind === \"dropTable\" || step.kind === \"dropJoinTable\") dropped.add(step.table);\n }\n return { rebuilt, dropped };\n}\n\n/** Refuse live rebuilds whose table-level guarantees the IR cannot reproduce. */\nexport async function assertSqliteRebuildTableOptions(params: {\n executor: SqlExecutor;\n tables: ReadonlySet<string>;\n}): Promise<void> {\n if (params.tables.size === 0) return;\n const rows = await params.executor({ text: \"PRAGMA main.table_list;\", values: [] });\n for (const table of params.tables) {\n const row = rows.find((entry) => entry.schema === \"main\" && entry.name === table);\n if (row === undefined || Number(row.strict) !== 0 || Number(row.wr) !== 0) {\n throw unsupportedCapability({ dialect: \"sqlite\", feature: \"sqliteRebuildTableOptions\", hint: `Cannot reproduce the existing table options of \"${table}\"; use a reviewed migration that preserves STRICT and WITHOUT ROWID` });\n }\n }\n}\n\n// ─── The table rebuild ────────────────────────────────────────────\n\nfunction renderTableRebuild(params: {\n table: string;\n from: NormalizedSchema;\n to: NormalizedSchema;\n restore: readonly string[];\n preservedColumns: ReadonlyMap<string, { readonly sql: string; readonly generated: boolean }>;\n}): string[] {\n const { table, from, to } = params;\n const source = from.tables.get(table);\n const target = to.tables.get(table);\n if (source === undefined || target === undefined) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `cannot rebuild \"${table}\" — the table is missing from the ${source === undefined ? \"from\" : \"to\"} schema`,\n meta: { table },\n });\n }\n\n const tmp = `${table}_new`;\n const statements: string[] = [\"PRAGMA foreign_keys=OFF;\", \"BEGIN;\"];\n\n statements.push(\n createTableSql({\n table: tmp,\n // CHECK-constraint names carry the FINAL table name so introspection\n // recovers enums after the RENAME.\n constraintTable: table,\n columns: [...target.columns.values()].map((column) => column.field),\n primaryKey: target.pk,\n checks: [...target.checks].map(([name, expression]) => ({ name, expression })),\n fks: [...target.fks.values()].map((fk) => ({\n constraintName: fk.constraintName,\n columns: fk.columns,\n refTable: fk.refTable,\n refColumns: fk.refColumns,\n onDelete: CASCADE_ACTION_SQL[fk.onDelete],\n onUpdate: CASCADE_ACTION_SQL[fk.onUpdate],\n })),\n enums: to.enums,\n preservedColumns: params.preservedColumns,\n }),\n );\n\n // Transfer: target-order intersection of the two column sets. Dropped\n // columns are omitted; added columns take their default/NULL; type changes\n // copy values verbatim (see module doc for the lossy-ness contract).\n const common = [...new Set([...target.columns.keys(), ...params.preservedColumns.keys()])].filter((name) => params.preservedColumns.get(name)?.generated !== true && (source.columns.has(name) || params.preservedColumns.has(name)));\n if (common.length === 0) {\n throw unsupportedCapability({ dialect: \"sqlite\", feature: \"sqliteRebuildWithoutRowTransfer\", hint: `Rebuilding \"${table}\" has no transferable columns and would discard every row; use explicit renames or a reviewed data migration` });\n }\n const cols = common.map((name) => q(name)).join(\", \");\n statements.push(`INSERT INTO ${q(tmp)} (${cols}) SELECT ${cols} FROM ${q(table)};`);\n\n // Preserve deleted-ID history, including empty sources. The replacement's\n // sequence row might not exist yet; never lower a value advanced by the copy.\n const sourceAuto = autoincrementPkColumn({ columns: [...source.columns.values()].map((column) => column.field), primaryKey: source.pk });\n const targetAuto = autoincrementPkColumn({ columns: [...target.columns.values()].map((column) => column.field), primaryKey: target.pk });\n if (sourceAuto !== undefined && targetAuto !== undefined) {\n const sourceName = quotePgString({ value: table });\n const targetName = quotePgString({ value: tmp });\n statements.push(\n `INSERT INTO \"sqlite_sequence\" (\"name\", \"seq\") SELECT ${targetName}, \"seq\" FROM \"sqlite_sequence\" WHERE \"name\" = ${sourceName} AND NOT EXISTS (SELECT 1 FROM \"sqlite_sequence\" WHERE \"name\" = ${targetName});`,\n `UPDATE \"sqlite_sequence\" SET \"seq\" = MAX(\"seq\", COALESCE((SELECT \"seq\" FROM \"sqlite_sequence\" WHERE \"name\" = ${sourceName}), 0)) WHERE \"name\" = ${targetName};`,\n );\n }\n\n statements.push(`DROP TABLE ${q(table)};`, `ALTER TABLE ${q(tmp)} RENAME TO ${q(table)};`);\n\n for (const index of target.indexes.values()) {\n statements.push(\n createIndexSql({\n table,\n name: index.name,\n unique: index.unique,\n kind: index.kind,\n columns: index.columns,\n where: index.where,\n nullsNotDistinct: index.nullsNotDistinct,\n }),\n );\n }\n\n statements.push(...params.restore, \"PRAGMA foreign_key_check;\", \"COMMIT;\", \"PRAGMA foreign_keys=ON;\");\n return statements;\n}\n\n// ─── Cheap-path detection ─────────────────────────────────────────\n\n/**\n * `ALTER TABLE … ADD COLUMN` suffices unless sqlite forbids the shape: the\n * new column may not default to CURRENT_* or an expression, and a NOT NULL\n * column needs a literal default (app-level id generators provide none).\n */\nfunction isCheapAddColumn(params: { field: FieldIR }): boolean {\n const { field } = params;\n const kind = field.default?.kind;\n if (kind === \"autoincrement\" || kind === \"now\" || kind === \"dbgenerated\") return false;\n const hasLiteralDefault = kind === \"literal\" || kind === \"enumValue\";\n if (!field.isOptional && !hasLiteralDefault) return false;\n return true;\n}\n\n/**\n * `ALTER TABLE … DROP COLUMN` works only when nothing references the column:\n * not the PK, no index (or partial-index predicate), no FK on either side, no\n * enum CHECK. Without the `from` schema the answer is unknowable → rebuild.\n */\nfunction canCheapDropColumn(params: {\n table: string;\n column: string;\n fromNorm: NormalizedSchema | undefined;\n}): boolean {\n const { table, column, fromNorm } = params;\n if (fromNorm === undefined) return false;\n const fromTable = fromNorm.tables.get(table);\n if (fromTable === undefined) return false;\n\n if (fromTable.pk.includes(column)) return false;\n const normalized = fromTable.columns.get(column);\n if (normalized !== undefined && isEnumType(normalized.field.type)) return false;\n for (const index of fromTable.indexes.values()) {\n if (index.columns.some((indexColumn) => indexColumn.name === column)) return false;\n if (index.where !== undefined && index.where.includes(column)) return false;\n }\n for (const fk of fromTable.fks.values()) {\n if (fk.columns.includes(column)) return false;\n }\n for (const other of fromNorm.tables.values()) {\n for (const fk of other.fks.values()) {\n if (fk.refTable === table && fk.refColumns.includes(column)) return false;\n }\n }\n return true;\n}\n\n// ─── Table & column pieces ────────────────────────────────────────\n\ntype InlineFk = {\n readonly constraintName: string;\n readonly columns: readonly string[];\n readonly refTable: string;\n readonly refColumns: readonly string[];\n readonly onDelete: string;\n readonly onUpdate: string;\n};\n\nfunction createTableSql(params: {\n table: string;\n /** Table name used in CHECK-constraint names (the FINAL name on rebuilds). */\n constraintTable: string;\n columns: readonly FieldIR[];\n primaryKey: readonly string[];\n /** User-declared named CHECK constraints (raw expressions, verbatim). */\n checks: readonly { readonly name: string; readonly expression: string }[];\n fks: readonly InlineFk[];\n enums: ReadonlyMap<string, EnumIR>;\n preservedColumns?: ReadonlyMap<string, { readonly sql: string; readonly generated: boolean }>;\n}): string {\n const { table, constraintTable, columns, primaryKey, fks, enums } = params;\n\n const autoincrementPk = autoincrementPkColumn({ columns, primaryKey });\n const lines = columns.map(\n (field) =>\n ` ${params.preservedColumns?.get(field.dbName ?? field.name)?.sql ?? columnDefSql({\n field,\n constraintTable,\n enums,\n inlinePkAutoincrement: (field.dbName ?? field.name) === autoincrementPk,\n })}`,\n );\n\n for (const [name, column] of params.preservedColumns ?? []) {\n if (!columns.some((field) => (field.dbName ?? field.name) === name)) lines.push(` ${column.sql}`);\n }\n if (primaryKey.length > 0 && autoincrementPk === undefined) {\n lines.push(` PRIMARY KEY (${primaryKey.map((column) => q(column)).join(\", \")})`);\n }\n for (const check of params.checks) {\n lines.push(` CONSTRAINT ${q(check.name)} CHECK (${check.expression})`);\n }\n for (const fk of fks) {\n lines.push(\n ` CONSTRAINT ${q(fk.constraintName)} FOREIGN KEY (${fk.columns.map((column) => q(column)).join(\", \")}) REFERENCES ${q(fk.refTable)} (${fk.refColumns.map((column) => q(column)).join(\", \")}) ON DELETE ${fk.onDelete} ON UPDATE ${fk.onUpdate}`,\n );\n }\n\n return `CREATE TABLE ${q(table)} (\\n${lines.join(\",\\n\")}\\n);`;\n}\n\n/**\n * The db name of the single autoincrement Int/BigInt PK column — the one\n * column rendered inline as `INTEGER PRIMARY KEY AUTOINCREMENT` — or\n * undefined when the table has no such PK.\n */\nfunction autoincrementPkColumn(params: {\n columns: readonly FieldIR[];\n primaryKey: readonly string[];\n}): string | undefined {\n const { columns, primaryKey } = params;\n if (primaryKey.length !== 1) return undefined;\n const pkName = primaryKey[0] as string;\n const field = columns.find((candidate) => (candidate.dbName ?? candidate.name) === pkName);\n if (field === undefined) return undefined;\n const eligible =\n field.default?.kind === \"autoincrement\" &&\n !field.isList &&\n !isEnumType(field.type) &&\n (field.type === \"Int\" || field.type === \"BigInt\");\n return eligible ? pkName : undefined;\n}\n\nfunction columnDefSql(params: {\n field: FieldIR;\n constraintTable: string;\n enums: ReadonlyMap<string, EnumIR>;\n inlinePkAutoincrement: boolean;\n}): string {\n const { field, constraintTable, enums, inlinePkAutoincrement } = params;\n const name = field.dbName ?? field.name;\n\n if (field.default?.kind === \"autoincrement\" && !inlinePkAutoincrement) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `autoincrement on sqlite requires \"${field.name}\" to be the single-column Int or BigInt primary key`,\n meta: { field: field.name },\n });\n }\n if (inlinePkAutoincrement) {\n return `${q(name)} INTEGER PRIMARY KEY AUTOINCREMENT`;\n }\n\n let def = `${q(name)} ${sqliteStorageType({ field })}`;\n if (!field.isOptional) def += \" NOT NULL\";\n const defaultExpr = sqliteDefaultSql({ field });\n if (defaultExpr !== undefined) def += ` DEFAULT ${defaultExpr}`;\n\n if (isEnumType(field.type) && field.isUnsupported !== true) {\n const enumName = field.type.enum;\n const values = resolveEnumValues({ name: enumName, enums });\n if (values === undefined) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `enum \"${enumName}\" on column \"${field.name}\" is not declared in the schema — sqlite rendering needs the target schema's enums for the CHECK constraint`,\n meta: { field: field.name, enum: enumName },\n });\n }\n const check = sqliteEnumCheckName({ table: constraintTable, column: name, enumName });\n def += ` CONSTRAINT ${q(check)} CHECK (${q(name)} IN (${values\n .map((value) => quotePgString({ value }))\n .join(\", \")}))`;\n }\n\n return def;\n}\n\nfunction createIndexSql(params: {\n table: string;\n name: string;\n unique: boolean;\n kind: string;\n columns: readonly IndexColumn[];\n where: string | undefined;\n nullsNotDistinct?: boolean | undefined;\n}): string {\n const { table, name, unique, kind, columns, where } = params;\n if (params.nullsNotDistinct === true) {\n throw unsupportedCapability({\n dialect: \"sqlite\",\n feature: `UNIQUE NULLS NOT DISTINCT (index \"${name}\")`,\n hint: \"sqlite treats NULLs as distinct in unique indexes and has no switch — gate the flag per dialect\",\n });\n }\n if (!unique && kind !== \"btree\") {\n throw unsupportedCapability({\n dialect: \"sqlite\",\n feature: `index kind \"${kind}\" (index \"${name}\")`,\n hint: \"sqlite indexes are btree only; use an extension-specific virtual table for others\",\n });\n }\n // SQLITE-2: a Decimal column stores as TEXT and every compare/order site\n // reads CAST(col AS REAL) (B4) — a plain-column index can never serve those\n // (EQP-proven SCAN with the index present). Index the same expression, so\n // sqlite's expression-index matching kicks in.\n const cols = columns\n .map(\n (column) =>\n `${column.decimal === true ? `CAST(${q(column.name)} AS REAL)` : q(column.name)}${column.desc ? \" DESC\" : \"\"}`,\n )\n .join(\", \");\n const whereClause = where === undefined ? \"\" : ` WHERE ${where}`;\n return `CREATE ${unique ? \"UNIQUE \" : \"\"}INDEX ${q(name)} ON ${q(table)} (${cols})${whereClause};`;\n}\n\n// ─── Drop ordering ────────────────────────────────────────────────\n\n\n// ─── Context guard & quoting ──────────────────────────────────────\n\nfunction requireSchemas(params: {\n step: MigrationStep;\n fromNorm: NormalizedSchema | undefined;\n toNorm: NormalizedSchema | undefined;\n}): void {\n const { step, fromNorm, toNorm } = params;\n if (fromNorm !== undefined && toNorm !== undefined) return;\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `sqlite step \"${describeStep({ step })}\" requires a table rebuild — renderSteps needs the { from, to } schemas to construct it`,\n meta: { step: step.kind },\n });\n}\n\nfunction q(name: string): string {\n return sqliteDialect.quoteIdent({ name });\n}\n",
|
|
18
|
-
"/**\n * Topological ordering for DROP TABLE statements — children (referencing\n * tables) first.\n *\n * postgres never needs this: `DROP TABLE … CASCADE` takes inbound FK\n * constraints with it. sqlite and mysql have no working cascade for inbound\n * foreign keys — mysql refuses outright (errno 3730\n * `ER_FK_CANNOT_DROP_PARENT`, observed live on 8.4 when a fixture switch\n * dropped `Project` while the also-being-dropped `ProjectMember` still\n * referenced it). ONE shared implementation, consumed by both renderers —\n * the LEARNINGS rule: a structural rule is never re-implemented per consumer.\n */\n\nimport type { NormalizedSchema } from \"../normalize.ts\";\n\n/**\n * Order the tables in `names` so that no table is dropped while another\n * to-be-dropped table still references it. Tables unknown to `fromNorm` (or a\n * missing `fromNorm`, or a reference cycle) fall back to the given order —\n * rendering proceeds and the server reports what it cannot do (dialect\n * honesty beats silently dropping statements).\n */\nexport function orderDropsChildrenFirst(params: {\n names: readonly string[];\n fromNorm: NormalizedSchema | undefined;\n}): string[] {\n const { names, fromNorm } = params;\n if (fromNorm === undefined || names.length < 2) return [...names];\n\n const references = new Map<string, ReadonlySet<string>>();\n for (const name of names) {\n const table = fromNorm.tables.get(name);\n if (table !== undefined) {\n references.set(name, new Set([...table.fks.values()].map((fk) => fk.refTable)));\n continue;\n }\n const joinTable = fromNorm.joinTables.get(name);\n if (joinTable !== undefined) {\n references.set(name, new Set([joinTable.a.table, joinTable.b.table]));\n continue;\n }\n references.set(name, new Set());\n }\n\n const remaining = new Set(names);\n const result: string[] = [];\n while (remaining.size > 0) {\n let progressed = false;\n for (const name of names) {\n if (!remaining.has(name)) continue;\n const stillReferenced = [...remaining].some(\n (other) => other !== name && (references.get(other) ?? new Set()).has(name),\n );\n if (!stillReferenced) {\n result.push(name);\n remaining.delete(name);\n progressed = true;\n }\n }\n if (!progressed) {\n for (const name of names) if (remaining.has(name)) result.push(name);\n break;\n }\n }\n return result;\n}\n",
|
|
19
|
-
"/**\n * MySQL DDL renderer: migration steps → SQL statements.\n *\n * Every identifier is backtick-quoted through `mysqlDialect.quoteIdent` — the\n * ONE quoting decision point. Pinned choices:\n *\n * - String → varchar(191): utf8mb4 × 4 bytes keeps indexed String columns\n * inside the 767-byte legacy InnoDB index-key limit (`@db.Text` opts out —\n * TEXT columns are never indexed by us; indexing one would need a prefix\n * length we do not emit).\n * - autoincrement renders `AUTO_INCREMENT` (the column must be a key — the\n * PRIMARY KEY clause in the same CREATE TABLE satisfies that; ALTERing one\n * onto an existing column is refused, pg parity).\n * - Enums are inline `ENUM('A', 'B')` column types; the standalone enum steps\n * (createEnum/dropEnum/addEnumValue) render NOTHING — value changes arrive\n * as alterColumn steps (value-based type keys) and render as MODIFY COLUMN\n * with the widened list.\n * - alterColumn type/nullability → one `MODIFY COLUMN` with the full target\n * definition (mysql redefines the column wholesale); default-only changes\n * use `ALTER COLUMN … SET/DROP DEFAULT`.\n * - No partial indexes on mysql → VIBE_UNSUPPORTED_CAPABILITY naming the\n * index. Index kinds other than btree are refused the same way.\n * - `DROP INDEX … ON table` needs the table — the differ's dropIndex steps\n * carry it; a step without one is a VIBE_MIGRATION error.\n * - `DROP TABLE` has no cascade (mysql parses `CASCADE` and ignores it), and\n * dropping a parent still referenced by another to-be-dropped table fails\n * with errno 3730 `ER_FK_CANNOT_DROP_PARENT` (observed live on 8.4). FK\n * drops on SURVIVING tables come from the differ's bucket order; drops of\n * whole dependent groups are topologically reordered children-first here\n * (the shared `orderDropsChildrenFirst`, same rule as sqlite).\n */\n\nimport { VibeError, unsupportedCapability } from \"@vibeorm/schema\";\nimport type { EnumIR, FieldIR, SchemaIR } from \"@vibeorm/schema\";\nimport { mysqlDialect } from \"@vibeorm/sql\";\nimport { orderDropsChildrenFirst } from \"./drop-order.ts\";\nimport { normalizeSchema } from \"../normalize.ts\";\nimport { CASCADE_ACTION_SQL } from \"../postgres-types.ts\";\nimport { mysqlColumnTypeSql, mysqlDefaultSql } from \"../mysql-types.ts\";\nimport type { MigrationStep } from \"../types.ts\";\nimport { isRlsStep, renderRlsStep } from \"./rls.ts\";\nimport { assertEnumStringTransition } from \"../enum-values.ts\";\n\n// ─── Public API ───────────────────────────────────────────────────\n\n/**\n * Render migration steps to mysql SQL. `to` (the target schema) is required\n * whenever an enum column is rendered — the inline `ENUM(…)` type needs the\n * enum's values, which live on the schema, not the step. `from` enables the\n * topological drop order (children before referenced parents); without it,\n * drops render in step order.\n */\nexport function renderMysqlSteps(params: {\n steps: readonly MigrationStep[];\n from?: SchemaIR;\n to?: SchemaIR;\n}): string[] {\n for (const step of params.steps) {\n if (isRlsStep({ step })) renderRlsStep({ step, dialect: \"mysql\" });\n if (step.kind !== \"alterColumn\" || !step.changes.some((change) => change === \"type\" || change === \"nullability\" || change === \"collation\")) continue;\n const owner = [...(params.from?.migrationObjects ?? []), ...(params.to?.migrationObjects ?? [])].find((object) => {\n const identity = object.identity;\n return object.dialect === \"mysql\" && (identity.kind === \"columnDefault\" || identity.kind === \"generatedColumn\" || identity.kind === \"column\") && identity.table.name === step.table && identity.column === step.column;\n });\n if (owner !== undefined) throw unsupportedCapability({ dialect: \"mysql\", feature: \"mysqlOwnedColumnRewrite\", hint: `MODIFY COLUMN would overwrite migration-owned ${owner.id}; use a reviewed migration that preserves the complete column definition` });\n }\n const enums = new Map<string, EnumIR>();\n for (const enumDef of params.to?.enums ?? []) {\n enums.set(enumDef.dbName ?? enumDef.name, enumDef);\n }\n\n // Topological drop order — mysql refuses to drop a parent that another\n // to-be-dropped table still references (no cascade; see module doc).\n const dropNames = params.steps\n .filter((step) => step.kind === \"dropTable\" || step.kind === \"dropJoinTable\")\n .map((step) => (step as Extract<MigrationStep, { kind: \"dropTable\" }>).table);\n const fromNorm =\n params.from === undefined ? undefined : normalizeSchema({ schema: params.from, dialect: \"mysql\" });\n const orderedDrops = orderDropsChildrenFirst({ names: dropNames, fromNorm });\n for (const step of params.steps) {\n if (step.kind !== \"dropPrimaryKey\") continue;\n const table = fromNorm?.tables.get(step.table);\n if (table === undefined) continue;\n const auto = [...table.columns].find(([, column]) => column.field.default?.kind === \"autoincrement\")?.[0];\n if (auto === undefined) continue;\n const retainedIndex = [...table.indexes.values()].some((index) => index.columns[0]?.name === auto && !params.steps.some((candidate) => candidate.kind === \"dropIndex\" && candidate.table === step.table && candidate.name === index.name));\n if (!retainedIndex) throw unsupportedCapability({ dialect: \"mysql\", feature: \"mysqlAutoIncrementKeyRemoval\", hint: `Removing the last leading key of AUTO_INCREMENT column \"${step.table}.${auto}\" requires a reviewed combined ALTER` });\n }\n let dropCursor = 0;\n\n const inlineIndexes = new Map<MigrationStep, Extract<MigrationStep, { kind: \"createIndex\" }>>();\n const consumed = new Set<MigrationStep>();\n for (const step of params.steps) {\n const columns = step.kind === \"createTable\" ? step.columns : step.kind === \"addColumn\" ? [step.column] : [];\n const counters = columns.filter((field) => field.default?.kind === \"autoincrement\");\n if (counters.length > 1) throw unsupportedCapability({ dialect: \"mysql\", feature: \"multiple auto-increment columns\" });\n for (const column of counters) {\n const name = column.dbName ?? column.name;\n if (step.kind === \"createTable\" && step.primaryKey[0] === name) continue;\n if (step.kind !== \"createTable\" && step.kind !== \"addColumn\") continue;\n const key = params.steps.find((candidate): candidate is Extract<MigrationStep, { kind: \"createIndex\" }> => candidate.kind === \"createIndex\" && candidate.table === step.table && candidate.columns[0]?.name === name && !candidate.columns[0]?.desc && candidate.where === undefined && candidate.nullsNotDistinct !== true && (candidate.unique || candidate.indexKind === \"btree\"));\n if (key === undefined) throw unsupportedCapability({ dialect: \"mysql\", feature: `auto-increment column ${step.table}.${name} without an accompanying leading index` });\n inlineIndexes.set(step, key);\n consumed.add(key);\n }\n }\n return params.steps.flatMap((step) => {\n if (consumed.has(step)) return [];\n if (step.kind === \"dropTable\" || step.kind === \"dropJoinTable\") {\n const table = orderedDrops[dropCursor] as string;\n dropCursor += 1;\n return [`DROP TABLE ${q(table)};`];\n }\n return renderStep({ step, enums, inlineIndex: inlineIndexes.get(step) });\n });\n}\n\n// ─── Per-step rendering ───────────────────────────────────────────\n\nfunction renderStep(params: {\n step: MigrationStep;\n enums: ReadonlyMap<string, EnumIR>;\n inlineIndex?: Extract<MigrationStep, { kind: \"createIndex\" }>;\n}): string[] {\n const { step, enums } = params;\n switch (step.kind) {\n case \"enableRls\":\n case \"forceRls\":\n case \"disableRls\":\n case \"noForceRls\":\n case \"createPolicy\":\n case \"dropPolicy\":\n return renderRlsStep({ step, dialect: \"mysql\" });\n case \"createEnum\":\n case \"dropEnum\":\n case \"addEnumValue\":\n return []; // Enums are inline column types on mysql.\n case \"createTable\": {\n const lines = step.columns.map((column) => ` ${columnDefSql({ field: column, enums })}`);\n if (step.primaryKey.length > 0) {\n lines.push(` PRIMARY KEY (${step.primaryKey.map((column) => q(column)).join(\", \")})`);\n }\n if (params.inlineIndex !== undefined) lines.push(` ${inlineIndexSql({ index: params.inlineIndex })}`);\n for (const check of step.checks ?? []) {\n lines.push(` CONSTRAINT ${q(check.name)} CHECK (${check.expression})`);\n }\n return [`CREATE TABLE ${q(step.table)} (\\n${lines.join(\",\\n\")}\\n);`];\n }\n case \"dropTable\":\n case \"dropJoinTable\":\n return [`DROP TABLE ${q(step.table)};`];\n case \"dropView\":\n return [`DROP VIEW IF EXISTS ${q(step.table)};`];\n case \"addColumn\":\n return [\n `ALTER TABLE ${q(step.table)} ADD COLUMN ${columnDefSql({ field: step.column, enums })}${params.inlineIndex === undefined ? \"\" : `, ADD ${inlineIndexSql({ index: params.inlineIndex })}`};`,\n ];\n case \"dropColumn\":\n return [`ALTER TABLE ${q(step.table)} DROP COLUMN ${q(step.column)};`];\n case \"alterColumn\":\n return renderAlterColumn({ step, enums });\n case \"createIndex\": {\n if (step.where !== undefined) {\n throw unsupportedCapability({\n dialect: \"mysql\",\n feature: `partial index \"${step.name}\"`,\n hint: \"mysql has no partial indexes — drop the WHERE predicate or gate the index per dialect\",\n });\n }\n if (step.nullsNotDistinct === true) {\n throw unsupportedCapability({\n dialect: \"mysql\",\n feature: `UNIQUE NULLS NOT DISTINCT (index \"${step.name}\")`,\n hint: \"mysql treats NULLs as distinct in unique indexes and has no switch — gate the flag per dialect\",\n });\n }\n if (!step.unique && step.indexKind !== \"btree\") {\n throw unsupportedCapability({\n dialect: \"mysql\",\n feature: `index kind \"${step.indexKind}\" (index \"${step.name}\")`,\n hint: \"mysql secondary indexes are btree only\",\n });\n }\n const cols = step.columns\n .map((column) => `${q(column.name)}${column.desc ? \" DESC\" : \"\"}`)\n .join(\", \");\n return [\n `CREATE ${step.unique ? \"UNIQUE \" : \"\"}INDEX ${q(step.name)} ON ${q(step.table)} (${cols});`,\n ];\n }\n case \"addCheck\":\n // MySQL 8.0.16+ parses AND enforces CHECK constraints.\n return [\n `ALTER TABLE ${q(step.table)} ADD CONSTRAINT ${q(step.name)} CHECK (${step.expression});`,\n ];\n case \"addExclusion\": case \"dropExclusion\": throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: \"Exclusion constraints require PostgreSQL\", meta: { dialect: \"mysql\", feature: \"exclusionConstraints\" } });\n case \"dropCheck\":\n return [`ALTER TABLE ${q(step.table)} DROP CHECK ${q(step.name)};`];\n case \"dropIndex\": {\n if (step.table === undefined) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `dropIndex \"${step.name}\" carries no table — mysql's DROP INDEX requires one`,\n meta: { index: step.name },\n });\n }\n return [`DROP INDEX ${q(step.name)} ON ${q(step.table)};`];\n }\n case \"addForeignKey\": {\n const cols = step.columns.map((column) => q(column)).join(\", \");\n const refCols = step.refColumns.map((column) => q(column)).join(\", \");\n return [\n `ALTER TABLE ${q(step.table)} ADD CONSTRAINT ${q(step.constraintName)} FOREIGN KEY (${cols}) REFERENCES ${q(step.refTable)} (${refCols}) ON DELETE ${CASCADE_ACTION_SQL[step.onDelete]} ON UPDATE ${CASCADE_ACTION_SQL[step.onUpdate]};`,\n ];\n }\n case \"renameTable\":\n return [`ALTER TABLE ${q(step.from)} RENAME TO ${q(step.to)};`];\n case \"renameColumn\":\n // MySQL 8.0.0+. The column keeps its type, default, indexes and inbound\n // foreign keys; only the name moves.\n return [`ALTER TABLE ${q(step.table)} RENAME COLUMN ${q(step.from)} TO ${q(step.to)};`];\n case \"addForeignKeyNotValid\":\n case \"addCheckNotValid\":\n case \"validateConstraint\":\n // MySQL has no NOT VALID / VALIDATE split: a constraint is checked when\n // it is added, full stop. Refusing is the honest answer — silently\n // emitting the ordinary ADD would promise a staged rollout that is not\n // happening. (`ALTER TABLE ... WITHOUT VALIDATION` exists only for\n // partition exchange, not for constraints.)\n throw unsupportedCapability({\n dialect: \"mysql\",\n feature: \"stagedConstraints\",\n hint: \"MySQL validates a constraint when it is added; add it in one step, or take the outage window that scan needs\",\n });\n case \"dropForeignKey\":\n return [`ALTER TABLE ${q(step.table)} DROP FOREIGN KEY ${q(step.constraintName)};`];\n case \"createJoinTable\": {\n const aType = mysqlColumnTypeSql({ field: { ...step.a.field, isList: false }, enums });\n const bType = mysqlColumnTypeSql({ field: { ...step.b.field, isList: false }, enums });\n return [\n `CREATE TABLE ${q(step.table)} (\\n \\`A\\` ${aType} NOT NULL,\\n \\`B\\` ${bType} NOT NULL\\n);`,\n `CREATE UNIQUE INDEX ${q(`${step.table}_AB_unique`)} ON ${q(step.table)} (\\`A\\`, \\`B\\`);`,\n `CREATE INDEX ${q(`${step.table}_B_index`)} ON ${q(step.table)} (\\`B\\`);`,\n `ALTER TABLE ${q(step.table)} ADD CONSTRAINT ${q(`${step.table}_A_fkey`)} FOREIGN KEY (\\`A\\`) REFERENCES ${q(step.a.table)} (${q(step.a.column)}) ON DELETE CASCADE ON UPDATE CASCADE;`,\n `ALTER TABLE ${q(step.table)} ADD CONSTRAINT ${q(`${step.table}_B_fkey`)} FOREIGN KEY (\\`B\\`) REFERENCES ${q(step.b.table)} (${q(step.b.column)}) ON DELETE CASCADE ON UPDATE CASCADE;`,\n ];\n }\n case \"addPrimaryKey\":\n return [\n `ALTER TABLE ${q(step.table)} ADD PRIMARY KEY (${step.columns.map((column) => q(column)).join(\", \")});`,\n ];\n case \"dropPrimaryKey\":\n return [`ALTER TABLE ${q(step.table)} DROP PRIMARY KEY;`];\n }\n}\n\n// ─── Column pieces ────────────────────────────────────────────────\n\nfunction columnDefSql(params: { field: FieldIR; enums: ReadonlyMap<string, EnumIR> }): string {\n const { field, enums } = params;\n const name = q(field.dbName ?? field.name);\n\n const autoincrement = field.default?.kind === \"autoincrement\";\n if (autoincrement && field.type !== \"Int\" && field.type !== \"BigInt\") {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `autoincrement default on \"${field.name}\" requires a non-list Int or BigInt column`,\n meta: { field: field.name },\n });\n }\n\n let def = `${name} ${mysqlColumnTypeSql({ field, enums })}`;\n if (field.collation !== undefined) def += ` COLLATE ${q(field.collation)}`;\n if (!field.isOptional) def += \" NOT NULL\";\n if (autoincrement) def += \" AUTO_INCREMENT\";\n const defaultExpr = mysqlDefaultSql({ field });\n if (defaultExpr !== undefined) def += ` DEFAULT ${defaultExpr}`;\n return def;\n}\n\nfunction renderAlterColumn(params: {\n step: Extract<MigrationStep, { kind: \"alterColumn\" }>;\n enums: ReadonlyMap<string, EnumIR>;\n}): string[] {\n const { step, enums } = params;\n assertEnumStringTransition({ from: step.from, to: step.to, dialect: \"mysql\", table: step.table, column: step.column });\n\n if (step.to.default?.kind === \"autoincrement\" && step.from.default?.kind !== \"autoincrement\") {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `cannot add autoincrement to existing column \"${step.table}\".\"${step.column}\" — drop and recreate the column instead`,\n meta: { table: step.table, column: step.column },\n });\n }\n\n // Type or nullability changes redefine the whole column (MODIFY COLUMN\n // carries type + nullability + default in one definition).\n if (step.changes.includes(\"type\") || step.changes.includes(\"nullability\") || step.changes.includes(\"collation\")) {\n const field = step.to.type === \"String\" && step.to.collation === undefined && step.from.collation !== undefined\n ? { ...step.to, collation: step.from.collation }\n : step.to;\n return [\n `ALTER TABLE ${q(step.table)} MODIFY COLUMN ${columnDefSql({ field, enums })};`,\n ];\n }\n\n // Default-only change.\n const defaultExpr = mysqlDefaultSql({ field: step.to });\n return [\n defaultExpr === undefined\n ? `ALTER TABLE ${q(step.table)} ALTER COLUMN ${q(step.column)} DROP DEFAULT;`\n : `ALTER TABLE ${q(step.table)} ALTER COLUMN ${q(step.column)} SET DEFAULT ${defaultExpr};`,\n ];\n}\n\n// ─── Quoting ──────────────────────────────────────────────────────\n\nfunction q(name: string): string {\n return mysqlDialect.quoteIdent({ name });\n}\n\nfunction inlineIndexSql(params: { index: Extract<MigrationStep, { kind: \"createIndex\" }> }): string {\n const { index } = params;\n return `${index.unique ? \"UNIQUE \" : \"\"}INDEX ${q(index.name)} (${index.columns.map((column) => `${q(column.name)}${column.desc ? \" DESC\" : \"\"}`).join(\", \")})`;\n}\n",
|
|
20
|
-
"/**\n * Postgres / PGlite introspection: live database → SchemaIR.\n *\n * Representation contract (the differ's round-trip depends on it, LEARNINGS):\n *\n * - Type mapping is the REVERSE of dialect-matrix §2; `nativeType` is set only\n * when the column's type is NOT the canonical mapping for its scalar.\n * - Identity columns and `nextval(...)` defaults → `@default(autoincrement())`.\n * - Enum ARRAY columns (`data_type = 'ARRAY'`, `udt_name = '_EnumName'`) are\n * enum lists — never `String[]`.\n * - Unknown column types (tsvector, geometry, …) become `isUnsupported` fields\n * with the raw type in `nativeType` — kept, not dropped.\n * - FK/join-table representation comes from introspect/shared.ts — the ONE\n * structural rule every dialect introspector uses.\n * - Views (`isView: true`) are returned with their columns only.\n * - The `_vibe_migrations` bookkeeping table is skipped.\n * - Hardcoded to the `public` schema (v1 parity).\n */\n\nimport { renderExclusionCatalog } from \"@vibeorm/sql\";\nimport { parsePgArrayLiteral } from \"@vibeorm/sql\";\nimport { scalarListDefault } from \"@vibeorm/schema\";\nimport { exactIntegerLiteral } from \"@vibeorm/schema\";\nimport { postgresDialect, renderRlsReadinessQuery } from \"@vibeorm/sql\";\n\nimport { VibeError } from \"@vibeorm/schema\";\nimport type {\n CheckIR,\n DefaultValueIR,\n EnumIR,\n FieldIR,\n FieldType,\n IndexIR,\n ModelIR,\n ScalarType,\n SchemaIR,\n} from \"@vibeorm/schema\";\nimport { PG_CHAR_TO_CASCADE_ACTION, isNumericScalar, normalizeNativeType } from \"../postgres-types.ts\";\nimport { MIGRATIONS_TABLE_NAME } from \"../journal-table.ts\";\nimport {\n addFkRelations,\n addJoinTableRelations,\n detectJoinTable,\n} from \"./shared.ts\";\nimport type { FkGroup, IntrospectedIndex, JoinTableInfo } from \"./shared.ts\";\nimport type { SqlExecutor } from \"../types.ts\";\nimport { projectPostgresRls, verifyPostgresRls } from \"./postgres-rls.ts\";\n\n// ─── Catalog queries ──────────────────────────────────────────────\n\n/**\n * Relations that BELONG to an installed postgres extension (pg_depend\n * deptype 'e': postgis's spatial_ref_sys, its geometry_columns view, …) are\n * not user tables: they are created and dropped WITH the extension, and a\n * DROP TABLE on them fails. Excluding them here keeps push/migrate from ever\n * scheduling their drop — first surfaced live on ParadeDB, whose image\n * pre-installs postgis.\n */\nconst EXTENSION_OWNED_FILTER = `NOT EXISTS (\n SELECT 1\n FROM pg_catalog.pg_depend d\n JOIN pg_catalog.pg_class c ON c.oid = d.objid\n JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n WHERE d.classid = 'pg_class'::regclass\n AND d.deptype = 'e'\n AND n.nspname = 'public'\n AND c.relname = table_name\n )`;\n\nconst TABLES_QUERY = `\n SELECT table_name\n FROM information_schema.tables\n WHERE table_schema = 'public'\n AND table_type = 'BASE TABLE'\n AND table_name <> '${MIGRATIONS_TABLE_NAME}'\n AND ${EXTENSION_OWNED_FILTER}\n ORDER BY table_name;\n`;\n\nconst VIEWS_QUERY = `\n SELECT table_name\n FROM information_schema.views\n WHERE table_schema = 'public'\n AND ${EXTENSION_OWNED_FILTER}\n ORDER BY table_name;\n`;\n\nconst COLUMNS_QUERY = `\n SELECT\n table_name,\n column_name,\n data_type,\n udt_name,\n is_nullable,\n is_identity,\n is_generated,\n collation_name,\n column_default,\n datetime_precision,\n character_maximum_length,\n numeric_precision,\n numeric_scale,\n ordinal_position,\n (\n SELECT format_type(a.atttypid, a.atttypmod)\n FROM pg_attribute a\n JOIN pg_class c ON c.oid = a.attrelid\n JOIN pg_namespace n ON n.oid = c.relnamespace\n WHERE n.nspname = 'public'\n AND c.relname = columns.table_name\n AND a.attname = columns.column_name\n ) AS full_type\n FROM information_schema.columns AS columns\n WHERE table_schema = 'public'\n ORDER BY table_name, ordinal_position;\n`;\n\n/**\n * PK/unique constraints via pg_catalog, NOT information_schema:\n * `information_schema.table_constraints` / `key_column_usage` only show\n * constraints on tables the current user owns or holds some privilege OTHER\n * than SELECT on, so a read-only role would silently lose every `@id` while\n * the (already catalog-based) FK query still returns relations — the most\n * confusing possible failure. `unnest WITH ORDINALITY` preserves composite-key\n * column order, matching the FK query below.\n */\nconst CONSTRAINTS_QUERY = `\n SELECT\n c.conname AS constraint_name,\n CASE c.contype WHEN 'p' THEN 'PRIMARY KEY' ELSE 'UNIQUE' END AS constraint_type,\n cl.relname AS table_name,\n att.attname AS column_name\n FROM pg_catalog.pg_constraint c\n JOIN pg_catalog.pg_class cl ON cl.oid = c.conrelid\n JOIN pg_catalog.pg_namespace n ON n.oid = cl.relnamespace\n JOIN unnest(c.conkey) WITH ORDINALITY AS k(attnum, ord) ON true\n JOIN pg_catalog.pg_attribute att ON att.attrelid = c.conrelid AND att.attnum = k.attnum\n WHERE c.contype IN ('p', 'u')\n AND n.nspname = 'public'\n ORDER BY cl.relname, c.conname, k.ord;\n`;\n\n/**\n * Explicit CHECK constraints (contype 'c'), with their re-serialized\n * definition. NAME keys the diff; the expression only matters for `db pull`\n * output — postgres re-serializes it (extra parens, casts), which is exactly\n * why the differ never compares expression text.\n */\nconst CHECKS_QUERY = `\n SELECT\n cl.relname AS table_name,\n c.conname AS constraint_name,\n pg_get_constraintdef(c.oid) AS definition\n FROM pg_catalog.pg_constraint c\n JOIN pg_catalog.pg_class cl ON cl.oid = c.conrelid\n JOIN pg_catalog.pg_namespace n ON n.oid = cl.relnamespace\n WHERE c.contype = 'c'\n AND n.nspname = 'public'\n ORDER BY cl.relname, c.conname;\n`;\n\n/**\n * FKs via pg_catalog (not information_schema): `unnest(...) WITH ORDINALITY`\n * preserves composite-FK column order across server versions, and\n * `confdeltype` / `confupdtype` surface the cascade actions directly (v1\n * lesson).\n */\nconst FOREIGN_KEYS_QUERY = `\n SELECT\n c.conname AS constraint_name,\n cl.relname AS table_name,\n att.attname AS column_name,\n fcl.relname AS foreign_table_name,\n fatt.attname AS foreign_column_name,\n c.confdeltype AS on_delete_char,\n c.confupdtype AS on_update_char,\n c.convalidated AS validated,\n c.condeferrable AS deferrable,\n (SELECT bool_and(t.tgenabled IN ('O', 'A')) FROM pg_catalog.pg_trigger t WHERE t.tgconstraint = c.oid) AS triggers_enabled\n FROM pg_catalog.pg_constraint c\n JOIN pg_catalog.pg_class cl ON cl.oid = c.conrelid\n JOIN pg_catalog.pg_namespace n ON n.oid = cl.relnamespace\n JOIN pg_catalog.pg_class fcl ON fcl.oid = c.confrelid\n JOIN pg_catalog.pg_namespace fn ON fn.oid = fcl.relnamespace\n JOIN unnest(c.conkey) WITH ORDINALITY AS lk(attnum, ord) ON true\n JOIN unnest(c.confkey) WITH ORDINALITY AS rk(attnum, ord) ON lk.ord = rk.ord\n JOIN pg_catalog.pg_attribute att ON att.attrelid = c.conrelid AND att.attnum = lk.attnum\n JOIN pg_catalog.pg_attribute fatt ON fatt.attrelid = c.confrelid AND fatt.attnum = rk.attnum\n WHERE c.contype = 'f'\n AND n.nspname = 'public'\n AND fn.nspname = 'public'\n ORDER BY cl.relname, c.conname, lk.ord;\n`;\n\nconst ENUMS_QUERY = `\n SELECT\n t.typname AS type_name,\n e.enumlabel AS enum_value,\n e.enumsortorder AS sort_order\n FROM pg_type t\n JOIN pg_enum e ON t.oid = e.enumtypid\n JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n WHERE n.nspname = 'public'\n ORDER BY t.typname, e.enumsortorder;\n`;\n\nconst INDEXES_QUERY = `\n SELECT\n tablename AS table_name,\n indexname AS index_name,\n indexdef AS index_def,\n con.conname AS backing_constraint,\n con.contype AS backing_constraint_type,\n health.indisvalid AS valid,\n health.indisready AS ready,\n health.indimmediate AS immediate,\n health.indexprs IS NULL AS plain_columns,\n health.indnkeyatts AS key_count,\n health.indnatts AS attribute_count\n FROM pg_indexes ix\n JOIN pg_catalog.pg_namespace ns ON ns.nspname = ix.schemaname\n JOIN pg_catalog.pg_class idx ON idx.relnamespace = ns.oid AND idx.relname = ix.indexname\n JOIN pg_catalog.pg_index health ON health.indexrelid = idx.oid\n LEFT JOIN pg_catalog.pg_constraint con ON con.conindid = idx.oid AND con.contype IN ('p', 'u', 'x')\n WHERE schemaname = 'public'\n ORDER BY tablename, indexname;\n`;\n\n// ─── Row shapes ───────────────────────────────────────────────────\n\ntype ColumnRow = {\n table: string;\n name: string;\n dataType: string;\n udtName: string;\n nullable: boolean;\n identity: boolean;\n columnDefault: string | null;\n datetimePrecision: number | null;\n charMaxLength: number | null;\n numericPrecision: number | null;\n numericScale: number | null;\n /** `format_type(...)` — carries type modifiers of non-catalog types (vector(3)). */\n fullType: string | null;\n};\n\n// ─── Public API ───────────────────────────────────────────────────\n\n/** Introspect a live postgres/pglite database (public schema) into SchemaIR. */\nexport async function introspectPostgres(params: {\n executor: SqlExecutor;\n /** Trusted policy declaration; missing this refuses lossy RLS introspection/export. */\n rlsSchema?: SchemaIR;\n /** The caller owns BEGIN/COMMIT, keeping probe locks through subsequent migration DDL. */\n inTransaction?: boolean;\n requireInstalledRls?: boolean;\n}): Promise<SchemaIR> {\n const { executor } = params;\n if (params.inTransaction !== true) await executor({ text: \"BEGIN\" });\n try {\n const savedPath = params.inTransaction === true\n ? await executor(renderRlsReadinessQuery({ dialect: postgresDialect, query: \"readSearchPath\" }))\n : undefined;\n const searchPath = savedPath?.[0]?.searchPath;\n if (params.inTransaction === true && typeof searchPath !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot read the migration search_path\" });\n const matched = await verifyPostgresRls({ executor, ...(params.rlsSchema === undefined ? {} : { schema: params.rlsSchema }), ...(params.requireInstalledRls === undefined ? {} : { requireInstalled: params.requireInstalledRls }) }).then(\n (verified) => verified,\n (error: unknown) => {\n if (error instanceof VibeError) throw error;\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Native RLS verification could not complete. Check migration privileges and supply the deployed schema as previousSchema/rlsSchema before changing referenced columns.\", meta: { reason: \"rls-verification-unavailable\" }, cause: error });\n },\n );\n const physical = await introspectPhysicalPostgres({ executor });\n if (typeof searchPath === \"string\") await executor(renderRlsReadinessQuery({ dialect: postgresDialect, query: \"setSearchPath\", searchPath }));\n return projectPostgresRls({ physical, ...(params.rlsSchema === undefined ? {} : { declared: params.rlsSchema }), matched });\n } finally {\n // Introspection/probes never commit database changes; an outer migration retains its locks.\n if (params.inTransaction !== true) await executor({ text: \"ROLLBACK\" });\n }\n}\n\n/** Read the physical catalog only; no policy probes, locks or transaction statements. */\nexport async function introspectPhysicalPostgres(params: { executor: SqlExecutor }): Promise<SchemaIR> {\n const { executor } = params;\n\n const [tableRows, viewRows, columnRows, constraintRows, fkRows, enumRows, indexRows, checkRows, exclusionRows] =\n await Promise.all([\n executor({ text: TABLES_QUERY }),\n executor({ text: VIEWS_QUERY }),\n executor({ text: COLUMNS_QUERY }),\n executor({ text: CONSTRAINTS_QUERY }),\n executor({ text: FOREIGN_KEYS_QUERY }),\n executor({ text: ENUMS_QUERY }),\n executor({ text: INDEXES_QUERY }),\n executor({ text: CHECKS_QUERY }),\n executor({ text: renderExclusionCatalog({ dialect: postgresDialect }) }),\n ]);\n\n const tables = tableRows.map((row) => row.table_name as string);\n const views = viewRows.map((row) => row.table_name as string);\n\n const columns: ColumnRow[] = columnRows.map((row) => ({\n table: row.table_name as string,\n name: row.column_name as string,\n dataType: row.data_type as string,\n udtName: row.udt_name as string,\n nullable: (row.is_nullable as string) === \"YES\",\n identity: (row.is_identity as string | null) === \"YES\",\n columnDefault: (row.column_default as string | null) ?? null,\n datetimePrecision: toNumberOrNull(row.datetime_precision),\n charMaxLength: toNumberOrNull(row.character_maximum_length),\n numericPrecision: toNumberOrNull(row.numeric_precision),\n numericScale: toNumberOrNull(row.numeric_scale),\n fullType: (row.full_type as string | null) ?? null,\n }));\n\n // Enums.\n const enums: EnumIR[] = [];\n {\n const valuesByName = new Map<string, string[]>();\n for (const row of enumRows) {\n const name = row.type_name as string;\n const list = valuesByName.get(name);\n if (list === undefined) valuesByName.set(name, [row.enum_value as string]);\n else list.push(row.enum_value as string);\n }\n for (const [name, values] of valuesByName) enums.push({ name, values });\n }\n const enumNames = new Set(enums.map((entry) => entry.name));\n\n // Constraints → PKs, single-column uniques, multi-column uniques.\n const pkByTable = new Map<string, string[]>();\n const pkNames = new Map<string, string>();\n const uniquesByConstraint = new Map<string, { table: string; columns: string[] }>();\n const constraintNames = new Set<string>();\n for (const row of constraintRows) {\n const table = row.table_name as string;\n const constraintName = row.constraint_name as string;\n const columnName = row.column_name as string;\n constraintNames.add(constraintName);\n if ((row.constraint_type as string) === \"PRIMARY KEY\") {\n pkNames.set(table, constraintName);\n const list = pkByTable.get(table);\n if (list === undefined) pkByTable.set(table, [columnName]);\n else list.push(columnName);\n } else {\n const entry = uniquesByConstraint.get(constraintName);\n if (entry === undefined) uniquesByConstraint.set(constraintName, { table, columns: [columnName] });\n else entry.columns.push(columnName);\n }\n }\n\n // CHECK constraints, grouped per table (name + inner expression).\n const checksByTable = new Map<string, CheckIR[]>();\n for (const row of checkRows) {\n const table = row.table_name as string;\n const name = row.constraint_name as string;\n const expression = stripCheckDefinition({ definition: String(row.definition ?? \"\") });\n const list = checksByTable.get(table);\n if (list === undefined) checksByTable.set(table, [{ name, expression, catalogExpression: true }]);\n else list.push({ name, expression, catalogExpression: true });\n }\n\n // FK groups (composite support — actions live on the constraint).\n type MutableFkGroup = {\n constraintName: string;\n table: string;\n columns: string[];\n refTable: string;\n refColumns: string[];\n onDelete: FkGroup[\"onDelete\"];\n onUpdate: FkGroup[\"onUpdate\"];\n };\n const fkGroupsByName = new Map<string, MutableFkGroup>();\n for (const row of fkRows) {\n const constraintName = row.constraint_name as string;\n const key = JSON.stringify([row.table_name, constraintName]);\n const existing = fkGroupsByName.get(key);\n if (existing === undefined) {\n fkGroupsByName.set(key, {\n constraintName,\n table: row.table_name as string,\n columns: [row.column_name as string],\n refTable: row.foreign_table_name as string,\n refColumns: [row.foreign_column_name as string],\n onDelete: PG_CHAR_TO_CASCADE_ACTION[(row.on_delete_char as string) ?? \"a\"] ?? \"NoAction\",\n onUpdate: PG_CHAR_TO_CASCADE_ACTION[(row.on_update_char as string) ?? \"a\"] ?? \"NoAction\",\n });\n } else {\n existing.columns.push(row.column_name as string);\n existing.refColumns.push(row.foreign_column_name as string);\n }\n }\n const fkGroups: FkGroup[] = [...fkGroupsByName.values()].map((group) => ({\n ...group,\n required: group.columns.every((columnName) => {\n const column = columns.find((c) => c.table === group.table && c.name === columnName);\n return column === undefined ? true : !column.nullable;\n }),\n }));\n\n // Indexes (parsed from indexdef).\n const indexes: IntrospectedIndex[] = [];\n for (const row of indexRows) {\n // Exclusions own their index. They are never independent DROP INDEX targets.\n if (row.backing_constraint_type === \"x\") continue;\n const parsed = parseIndexDef({\n table: row.table_name as string,\n name: row.index_name as string,\n def: row.index_def as string,\n });\n if (parsed !== null) indexes.push(parsed);\n }\n\n // Implicit join tables (the shared structural rule).\n const joinTables = new Map<string, JoinTableInfo>();\n for (const table of tables) {\n if (!table.startsWith(\"_\")) continue;\n const tableFks = fkRows.filter((row) => row.table_name === table);\n const tableIndexes = indexRows.filter((row) => row.table_name === table);\n if (pkByTable.has(table) || (checksByTable.get(table)?.length ?? 0) > 0 || exclusionRows.some((row) => row.table_name === table)) continue;\n if (!tableFks.every((row) => row.validated === true && row.deferrable === false && row.triggers_enabled === true)) continue;\n if (tableIndexes.length !== 2 || !tableIndexes.every((row) => row.valid === true && row.ready === true && row.immediate === true && row.plain_columns === true && typeof row.key_count === \"number\" && row.key_count === row.attribute_count)) continue;\n if (tableFks.some((row) => {\n const source = columnRows.find((column) => column.table_name === table && column.column_name === row.column_name);\n const target = columnRows.find((column) => column.table_name === row.foreign_table_name && column.column_name === row.foreign_column_name);\n return source === undefined || target === undefined || typeof source.full_type !== \"string\" || source.full_type.length === 0 || source.full_type !== target.full_type\n || source.column_default !== null || source.is_identity !== \"NO\" || source.is_generated !== \"NEVER\" || source.is_nullable !== \"NO\"\n || source.collation_name === undefined || source.collation_name !== target.collation_name;\n })) continue;\n const detected = detectJoinTable({\n table,\n columnNames: columns.filter((column) => column.table === table).map((column) => column.name),\n fkGroups,\n indexes,\n });\n if (detected !== null) joinTables.set(table, detected);\n }\n\n // Models.\n const models: ModelIR[] = [];\n for (const table of tables) {\n if (joinTables.has(table)) continue;\n models.push(\n buildModel({\n table,\n isView: false,\n columns,\n pkByTable,\n pkNames,\n uniquesByConstraint,\n constraintNames,\n indexes,\n enumNames,\n exclusions: exclusionRows.filter((row) => row.table_name === table).map((row) => ({ name: String(row.constraint_name), definition: String(row.definition), requiredExtensions: [], catalogDefinition: true as const })),\n checks: checksByTable.get(table) ?? [],\n }),\n );\n }\n for (const view of views) {\n models.push(\n buildModel({\n table: view,\n isView: true,\n columns,\n pkByTable,\n pkNames,\n uniquesByConstraint,\n constraintNames,\n indexes: [],\n enumNames,\n checks: [],\n }),\n );\n }\n\n // Relations: FK side + inverse list side, then implicit M2M list sides.\n addFkRelations({ models, fkGroups, joinTables });\n addJoinTableRelations({ models, joinTables });\n\n return {\n datasource: { provider: \"postgresql\" },\n models,\n enums,\n extensions: [],\n };\n}\n\n// ─── Model building ───────────────────────────────────────────────\n\nfunction buildModel(params: {\n table: string;\n isView: boolean;\n columns: readonly ColumnRow[];\n pkByTable: ReadonlyMap<string, string[]>;\n pkNames: ReadonlyMap<string, string>;\n uniquesByConstraint: ReadonlyMap<string, { table: string; columns: string[] }>;\n constraintNames: ReadonlySet<string>;\n indexes: readonly IntrospectedIndex[];\n enumNames: ReadonlySet<string>;\n exclusions?: ModelIR[\"exclusions\"];\n checks: readonly CheckIR[];\n}): ModelIR {\n const { table, isView, columns, pkByTable, uniquesByConstraint, constraintNames, indexes, enumNames } =\n params;\n\n const tableColumns = columns.filter((column) => column.table === table);\n const pk = pkByTable.get(table) ?? [];\n\n // Single-column uniqueness (constraints + unique indexes) → field.isUnique.\n const uniqueSingles = new Set<string>();\n const multiUniques: { name: string; columns: string[] }[] = [];\n for (const [name, unique] of uniquesByConstraint) {\n if (unique.table !== table) continue;\n if (unique.columns.length === 1) uniqueSingles.add(unique.columns[0] as string);\n multiUniques.push({ name, columns: unique.columns });\n }\n const tableIndexes = indexes.filter(\n (index) => index.table === table && !constraintNames.has(index.name),\n );\n for (const index of tableIndexes) {\n if (!index.unique) continue;\n // A partial or NULLS-NOT-DISTINCT unique is NOT a plain field @unique —\n // folding it would drop the predicate/flag and make every diff recreate\n // the index. Those stay model-level indexes below.\n if (index.columns.length === 1 && index.where === undefined && index.nullsNotDistinct !== true) {\n uniqueSingles.add((index.columns[0] as { name: string }).name);\n }\n }\n\n const fields: FieldIR[] = tableColumns.map((column) =>\n buildField({ column, pk, uniqueSingles, enumNames }),\n );\n\n // Indexes: multi-column unique constraints + all non-constraint indexes\n // (single-column uniques were folded into the fields above).\n const modelIndexes: IndexIR[] = [];\n for (const unique of multiUniques) {\n modelIndexes.push({\n name: unique.name,\n constraintName: unique.name,\n kind: \"unique\",\n fields: unique.columns.map((name) => ({ name })),\n });\n }\n for (const index of tableIndexes) {\n if (\n index.unique &&\n index.columns.length === 1 &&\n index.where === undefined &&\n index.nullsNotDistinct !== true &&\n index.name === `${table}_${index.columns[0]!.name}_key`\n ) {\n continue; // folded into field.isUnique above\n }\n modelIndexes.push({\n name: index.name,\n kind: index.unique ? \"unique\" : index.kind,\n fields: index.columns.map((column) => ({\n name: column.name,\n ...(column.desc ? { sort: \"desc\" as const } : {}),\n })),\n ...(index.where === undefined ? {} : { where: index.where }),\n ...(index.nullsNotDistinct === true ? { nullsNotDistinct: true } : {}),\n });\n }\n\n return {\n name: table,\n fields,\n relations: [],\n indexes: modelIndexes,\n ...(params.exclusions?.length ? { exclusions: params.exclusions } : {}),\n ...(params.checks.length === 0 ? {} : { checks: params.checks }),\n isView,\n ...(pk.length > 1 ? { primaryKey: { fields: pk } } : {}),\n ...(params.pkNames.get(table) === undefined ? {} : { primaryKeyConstraintName: params.pkNames.get(table)! }),\n };\n}\n\n/** `pg_get_constraintdef` → the inner expression: `CHECK ((amount >= 0))` → `(amount >= 0)`. */\nfunction stripCheckDefinition(params: { definition: string }): string {\n const trimmed = params.definition.trim();\n const match = trimmed.match(/^CHECK\\s*\\((.*)\\)$/is);\n return match === null ? trimmed : (match[1] as string).trim();\n}\n\nfunction buildField(params: {\n column: ColumnRow;\n pk: readonly string[];\n uniqueSingles: ReadonlySet<string>;\n enumNames: ReadonlySet<string>;\n}): FieldIR {\n const { column, pk, uniqueSingles, enumNames } = params;\n const mapped = reverseMapType({ column, enumNames });\n const isId = pk.length === 1 && pk[0] === column.name;\n const defaultValue = parseColumnDefault({ column, mapped });\n\n return {\n name: column.name,\n type: mapped.type,\n isList: mapped.isList,\n isOptional: column.nullable,\n isId,\n isUnique: uniqueSingles.has(column.name),\n isUpdatedAt: false,\n ...(defaultValue === undefined ? {} : { default: defaultValue }),\n ...(mapped.nativeType === undefined ? {} : { nativeType: mapped.nativeType }),\n ...(mapped.isUnsupported === true ? { isUnsupported: true as const } : {}),\n };\n}\n\n// ─── Reverse type mapping (dialect-matrix §2, reversed) ───────────\n\ntype MappedType = {\n type: FieldType;\n isList: boolean;\n nativeType?: string;\n isUnsupported?: true;\n};\n\n/** udt_name → canonical scalar for types that ARE the canonical mapping. */\nconst CANONICAL_UDT: Readonly<Record<string, ScalarType>> = {\n text: \"String\",\n bool: \"Boolean\",\n int4: \"Int\",\n int8: \"BigInt\",\n float8: \"Float\",\n numeric: \"Decimal\",\n timestamptz: \"DateTime\",\n jsonb: \"Json\",\n bytea: \"Bytes\",\n};\n\n/** udt_name → scalar for non-canonical types (nativeType carries the truth). */\nconst NON_CANONICAL_UDT: Readonly<Record<string, ScalarType>> = {\n varchar: \"String\",\n bpchar: \"String\",\n uuid: \"String\",\n int2: \"Int\",\n float4: \"Float\",\n timestamp: \"DateTime\",\n date: \"DateTime\",\n json: \"Json\",\n};\n\nfunction reverseMapType(params: { column: ColumnRow; enumNames: ReadonlySet<string> }): MappedType {\n const { column, enumNames } = params;\n const isList = column.dataType === \"ARRAY\";\n const udt = isList ? column.udtName.replace(/^_/, \"\") : column.udtName;\n\n // Enum (scalar or array — the LEARNINGS `_EnumName` lesson).\n if (enumNames.has(udt)) {\n return { type: { enum: udt }, isList };\n }\n\n const canonical = CANONICAL_UDT[udt];\n if (canonical !== undefined) {\n const nativeType = nonCanonicalModifier({ column, udt, scalar: canonical });\n return { type: canonical, isList, ...(nativeType === undefined ? {} : { nativeType }) };\n }\n\n const nonCanonical = NON_CANONICAL_UDT[udt];\n if (nonCanonical !== undefined) {\n return { type: nonCanonical, isList, nativeType: withModifier({ column, udt }) };\n }\n\n // Unknown type → unsupported column, raw type preserved (F3: keep, don't\n // drop). `format_type` keeps modifiers (`vector(3)`), so an extension-lowered\n // column round-trips diff-clean against its declared native type.\n const raw = column.fullType ?? udt;\n return {\n type: \"String\",\n isList: false,\n nativeType: isList && !raw.endsWith(\"[]\") ? `${raw}[]` : raw,\n isUnsupported: true,\n };\n}\n\n/**\n * For canonical base types, return a nativeType only when a modifier makes the\n * column diverge from the canonical mapping (timestamptz(3), numeric(10,2)).\n * Bare `timestamptz` is the canonical DateTime mapping and postgres reports\n * its default precision as 6, so precision 6 (or none) means \"no override\";\n * every other precision is carried truthfully — the differ's equivalence\n * class, not this function, decides that timestamptz(3) needs no ALTER.\n */\nfunction nonCanonicalModifier(params: {\n column: ColumnRow;\n udt: string;\n scalar: ScalarType;\n}): string | undefined {\n const { column, udt, scalar } = params;\n // information_schema omits element modifiers on arrays; format_type keeps them.\n if (column.dataType === \"ARRAY\" && column.fullType !== null) {\n const element = normalizeNativeType({ raw: column.fullType }).replace(/\\[\\]$/, \"\");\n if (/^(numeric|timestamptz)\\([\\d,]+\\)$/.test(element)) return element;\n }\n if (scalar === \"DateTime\" && udt === \"timestamptz\") {\n const precision = column.datetimePrecision;\n return precision === null || precision === 6 ? undefined : `timestamptz(${precision})`;\n }\n if (scalar === \"Decimal\" && udt === \"numeric\") {\n if (column.numericPrecision === null) return undefined;\n const scale = column.numericScale ?? 0;\n return `numeric(${column.numericPrecision},${scale})`;\n }\n return undefined;\n}\n\n/** Render `udt(modifier)` for non-canonical types that carry one. */\nfunction withModifier(params: { column: ColumnRow; udt: string }): string {\n const { column, udt } = params;\n // information_schema omits character_maximum_length for varchar arrays.\n // format_type preserves the element typmod; keep it so push/pull converges.\n if (udt === \"varchar\" && column.dataType === \"ARRAY\" && column.fullType !== null) {\n const elementType = normalizeNativeType({ raw: column.fullType }).replace(/\\[\\]$/, \"\");\n if (/^varchar\\(\\d+\\)$/.test(elementType)) return elementType;\n }\n if ((udt === \"varchar\" || udt === \"bpchar\") && column.charMaxLength !== null) {\n return `${udt === \"bpchar\" ? \"char\" : \"varchar\"}(${column.charMaxLength})`;\n }\n if (udt === \"bpchar\") return \"char\";\n if (udt === \"timestamp\" && column.datetimePrecision !== null && column.datetimePrecision !== 6) {\n return `timestamp(${column.datetimePrecision})`;\n }\n return udt;\n}\n\n// ─── Default parsing ──────────────────────────────────────────────\n\nfunction parseColumnDefault(params: {\n column: ColumnRow;\n mapped: MappedType;\n}): DefaultValueIR | undefined {\n const { column, mapped } = params;\n\n if (column.identity) return { kind: \"autoincrement\" };\n\n const raw = column.columnDefault;\n if (raw === null) return undefined;\n if (raw.startsWith(\"NULL::\")) return undefined;\n\n if (/^nextval\\('(?:[^']|'')*'::regclass\\)$/.test(raw)) return { kind: \"autoincrement\" };\n if (raw === \"now()\" || raw.startsWith(\"CURRENT_TIMESTAMP\")) return { kind: \"now\" };\n if (raw === \"true\" || raw === \"false\") return { kind: \"literal\", value: raw === \"true\" };\n if (/^-?\\d+(\\.\\d+)?$/.test(raw)) return { kind: \"literal\", value: /^-?\\d+$/.test(raw) ? exactIntegerLiteral({ text: raw }) : Number(raw) };\n\n // 'value' or 'value'::type — embedded quotes arrive doubled.\n const quoted = raw.match(/^'((?:[^']|'')*)'(::.*)?$/);\n if (quoted !== null) {\n const value = (quoted[1] as string).replaceAll(\"''\", \"'\");\n if (mapped.isList) {\n const elements = parsePgArrayLiteral({ literal: value });\n if (elements !== null && !elements.includes(null)) {\n const decoded = elements.map((entry) => mapped.type === \"Boolean\" ? entry === \"t\" || entry === \"true\" :\n mapped.type === \"Int\" || mapped.type === \"Float\" ? Number(entry) : entry);\n return { kind: \"list\", values: scalarListDefault({ type: mapped.type, values: decoded }) };\n }\n return { kind: \"dbgenerated\", sql: raw };\n }\n if (typeof mapped.type === \"object\") return { kind: \"enumValue\", value };\n if (isNumericScalar({ type: mapped.type }) && /^-?\\d+(\\.\\d+)?$/.test(value)) {\n return { kind: \"literal\", value: /^-?\\d+$/.test(value) ? exactIntegerLiteral({ text: value }) : Number(value) };\n }\n // A cast to a non-string type (e.g. '{}'::text[]) is not a plain literal.\n const cast = quoted[2];\n if (cast !== undefined && cast !== \"\" && mapped.isList) {\n return { kind: \"dbgenerated\", sql: raw };\n }\n return { kind: \"literal\", value };\n }\n\n return { kind: \"dbgenerated\", sql: raw };\n}\n\n// ─── Index parsing ────────────────────────────────────────────────\n\n/**\n * Parse a `pg_indexes.indexdef` line:\n * `CREATE [UNIQUE] INDEX name ON schema.table USING method (cols) [WHERE pred]`.\n * The column list is scanned with balanced parentheses (expressions like\n * `lower(email)` and `WHERE` predicates both contain parens, so a regex over\n * the whole line cannot split them). Returns null for definitions that don't\n * match — never expected from pg.\n */\nfunction parseIndexDef(params: {\n table: string;\n name: string;\n def: string;\n}): IntrospectedIndex | null {\n const { table, name, def } = params;\n const head = def.match(/^CREATE (UNIQUE )?INDEX .*? USING (\\w+) \\(/);\n if (head === null) return null;\n\n // Scan the balanced column list starting right after the opening paren.\n const start = (head.index ?? 0) + head[0].length;\n let depth = 1;\n let end = -1;\n for (let position = start; position < def.length; position += 1) {\n const char = def[position];\n if (char === \"(\") depth += 1;\n else if (char === \")\") {\n depth -= 1;\n if (depth === 0) {\n end = position;\n break;\n }\n }\n }\n if (end === -1) return null;\n\n const columns = splitTopLevel({ text: def.slice(start, end) }).map((entry) => {\n const trimmed = entry.trim();\n const desc = / DESC$/i.test(trimmed);\n const nameOnly = trimmed.replace(/ (DESC|ASC)( NULLS (FIRST|LAST))?$/i, \"\");\n return { name: nameOnly.replaceAll('\"', \"\"), desc };\n });\n\n const tail = def.slice(end + 1).trim();\n // INCLUDE, storage options and TABLESPACE can precede WHERE. Only top-level\n // keywords count: an included column named \"WHERE\" is not a predicate.\n let nullsNotDistinct = false;\n let whereRaw: string | undefined;\n let tailDepth = 0;\n let quote: string | undefined;\n for (let position = 0; position < tail.length; position += 1) {\n const char = tail[position]!;\n if (quote !== undefined) {\n if (char === quote) {\n if (tail[position + 1] === quote) position += 1;\n else quote = undefined;\n }\n continue;\n }\n if (char === '\"' || char === \"'\") { quote = char; continue; }\n if (char === \"(\") { tailDepth += 1; continue; }\n if (char === \")\") { tailDepth -= 1; continue; }\n if (tailDepth !== 0 || (position > 0 && !/\\s/.test(tail[position - 1]!))) continue;\n const rest = tail.slice(position);\n if (/^NULLS NOT DISTINCT\\b/i.test(rest)) nullsNotDistinct = true;\n const where = rest.match(/^WHERE\\s+/i);\n if (where !== null) { whereRaw = rest.slice(where[0].length); break; }\n }\n return {\n table,\n name,\n unique: head[1] !== undefined,\n kind: (head[2] as string).toLowerCase(),\n columns,\n ...(whereRaw === undefined ? {} : { where: whereRaw }),\n ...(nullsNotDistinct ? { nullsNotDistinct: true } : {}),\n };\n}\n\n/** Split a parenthesized column list on top-level commas only. */\nfunction splitTopLevel(params: { text: string }): string[] {\n const { text } = params;\n const parts: string[] = [];\n let depth = 0;\n let current = \"\";\n for (const char of text) {\n if (char === \"(\") depth += 1;\n if (char === \")\") depth -= 1;\n if (char === \",\" && depth === 0) {\n parts.push(current);\n current = \"\";\n continue;\n }\n current += char;\n }\n if (current.trim().length > 0) parts.push(current);\n return parts;\n}\n\nfunction toNumberOrNull(value: unknown): number | null {\n if (value === null || value === undefined) return null;\n const parsed = Number(value);\n return Number.isNaN(parsed) ? null : parsed;\n}\n",
|
|
18
|
+
"import { VibeError, isSqlObjectIdentity, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, QualifiedSqlName, SqlObjectIdentity } from \"@vibeorm/schema\";\nimport { getSqlDialect, renderMigrationInventory, renderSqliteColumnInventory, renderMysqlObjectMembers, sqliteTableConstraints, renderSqliteForeignKeyInventory } from \"@vibeorm/sql\";\nimport type { SqlExecutor } from \"./types.ts\";\nimport { assertCatalogVisibility } from \"./inspect-objects.ts\";\nimport { parseSqliteNamedChecks } from \"./sqlite-types.ts\";\n\n/** Live identities remain observations and cannot establish desired ownership. */\nexport type CatalogObject = { readonly identity: SqlObjectIdentity; readonly backingConstraint?: string; readonly inspectionUnavailable?: string };\n\n/** Enumerate live objects in the migration namespace. Permission errors propagate as unavailable. */\nexport async function inspectMigrationInventory(params: { executor: SqlExecutor; dialect: Dialect; namespace: string }): Promise<readonly CatalogObject[]> {\n await assertCatalogVisibility(params);\n const query = renderMigrationInventory({ dialect: getSqlDialect({ dialect: params.dialect }), namespace: params.namespace });\n const rows = await params.executor({ text: query.text, values: [...query.values] });\n const objects: CatalogObject[] = [];\n const kinds: Readonly<Record<string, \"check\" | \"foreignKey\" | \"exclusion\" | \"unique\" | \"primaryKey\">> = {\n c: \"check\", f: \"foreignKey\", x: \"exclusion\", u: \"unique\", p: \"primaryKey\", CHECK: \"check\", \"FOREIGN KEY\": \"foreignKey\", UNIQUE: \"unique\", \"PRIMARY KEY\": \"primaryKey\",\n };\n for (const row of rows) {\n const name = row.name;\n if (typeof name !== \"string\" || typeof row.kind !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Malformed catalog identity\", meta: { reason: \"inventory-unavailable\" } });\n const qualified: QualifiedSqlName = { namespace: params.namespace, name };\n const table: QualifiedSqlName = { namespace: params.namespace, name: String(row.parent ?? \"\") };\n let identity: SqlObjectIdentity;\n switch (row.kind) {\n case \"table\": case \"view\": case \"sequence\": identity = { kind: row.kind, name: qualified }; break;\n case \"trigger\": case \"index\": identity = { kind: row.kind, table, name }; break;\n case \"column\": case \"columnDefault\": case \"generatedColumn\": identity = { kind: row.kind, table, column: name }; break;\n case \"constraint\": {\n const constraintType = kinds[String(row.subtype)];\n if (constraintType === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Unknown constraint catalog kind\", meta: { reason: \"inventory-unavailable\" } });\n identity = { kind: \"constraint\", table, name, constraintType };\n break;\n }\n case \"function\": {\n let argumentTypes: unknown = JSON.parse(String(row.signature));\n if (params.dialect === \"mysql\") {\n const query = renderMysqlObjectMembers({ dialect: getSqlDialect({ dialect: params.dialect }), identity: { kind: \"function\", name: qualified, argumentTypes: [] } })!;\n const members = await params.executor({ text: query.text, values: [...query.values] });\n if (members.length === 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"MySQL function signature unavailable\", meta: { reason: \"inventory-unavailable\", name } });\n argumentTypes = members.filter((member) => member.mode !== null).map((member) => ({ namespace: \"mysql\", name: String(member.type) }));\n }\n const candidate = { kind: \"function\", name: qualified, argumentTypes };\n if (!isSqlObjectIdentity(candidate)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Invalid function signature in catalog\", meta: { reason: \"inventory-unavailable\" } });\n identity = candidate;\n break;\n }\n default: throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Unknown catalog object kind ${row.kind}`, meta: { reason: \"inventory-unavailable\" } });\n }\n objects.push({ identity, ...(typeof row.backing === \"string\" ? { backingConstraint: row.backing } : {}) });\n if (params.dialect === \"sqlite\" && row.kind === \"table\" && typeof row.definition === \"string\" && !/^\\s*CREATE\\s+VIRTUAL\\s+TABLE\\b/i.test(row.definition)) {\n const clauses = sqliteTableConstraints({ sql: row.definition });\n for (const constraint of clauses) {\n if (constraint.type === \"check\") continue;\n const name = constraint.named ? constraint.name : constraint.type === \"primaryKey\" ? `${qualified.name}_pkey` : constraint.type === \"foreignKey\" ? `${qualified.name}_${constraint.columns.join(\"_\")}_fkey` : constraint.name;\n objects.push({ identity: { kind: \"constraint\", constraintType: constraint.type, table: qualified, name }, ...(constraint.type === \"unique\" && !constraint.named ? { inspectionUnavailable: \"sqlite-anonymous-unique-constraint\" } : {}) });\n }\n const checks = parseSqliteNamedChecks({ tableSql: row.definition });\n for (const check of checks) objects.push({ identity: { kind: \"constraint\", constraintType: \"check\", table: qualified, name: check.name } });\n // This is a conservative detector, not a SQL expression parser. Unnamed\n // CHECKs cannot be individually represented by the core IR and must not\n // disappear in a rebuild. A token in a literal may conservatively refuse.\n if ([...row.definition.matchAll(/\\bCHECK\\s*\\(/gi)].length > checks.length) objects.push({ identity: { kind: \"table\", name: qualified }, inspectionUnavailable: \"sqlite-unnamed-check-definition-unavailable\" });\n const query = renderSqliteColumnInventory({ dialect: getSqlDialect({ dialect: params.dialect }), namespace: params.namespace, table: name });\n const columns = await params.executor({ text: query.text, values: [...query.values] });\n if (columns.some((column) => Number(column.pk) > 0) && !clauses.some((clause) => clause.type === \"primaryKey\")) objects.push({ identity: { kind: \"constraint\", constraintType: \"primaryKey\", table: qualified, name: `${qualified.name}_pkey` } });\n const fkQuery = renderSqliteForeignKeyInventory({ dialect: getSqlDialect({ dialect: params.dialect }), namespace: params.namespace, table: name });\n const foreignKeys = await params.executor({ text: fkQuery.text, values: [...fkQuery.values] });\n const groups = new Map<number, string[]>();\n for (const fk of foreignKeys) groups.set(Number(fk.id), [...(groups.get(Number(fk.id)) ?? []), String(fk.from)]);\n for (const fields of groups.values()) {\n if (clauses.some((clause) => clause.type === \"foreignKey\" && JSON.stringify(clause.columns) === JSON.stringify(fields))) continue;\n objects.push({ identity: { kind: \"constraint\", constraintType: \"foreignKey\", table: qualified, name: `${qualified.name}_${fields.join(\"_\")}_fkey` }, inspectionUnavailable: \"sqlite-inline-foreign-key-definition-unavailable\" });\n }\n for (const column of columns) {\n objects.push({ identity: { kind: \"column\", table: qualified, column: String(column.name) } });\n if (Number(column.hidden) > 1) objects.push({ identity: { kind: \"generatedColumn\", table: qualified, column: String(column.name) } });\n else if (column.definition !== null && column.definition !== undefined) objects.push({ identity: { kind: \"columnDefault\", table: qualified, column: String(column.name) } });\n }\n }\n }\n return [...new Map(objects.map((object) => [sqlObjectKey({ identity: object.identity }), object])).values()];\n}\n",
|
|
19
|
+
"import { randomUUID } from \"node:crypto\";\nimport { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { SchemaIR, ExclusionIR, SqlObjectIdentity } from \"@vibeorm/schema\";\nimport { postgresDialect, renderExclusionCatalog, renderExclusionProbe } from \"@vibeorm/sql\";\nimport type { SqlExecutor } from \"./types.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport type { MigrationObjectState, MigrationStateDifference } from \"./inspect-objects.ts\";\n\n/** Normalize an independently authored definition on an empty clone, rolled back by the caller's session. */\nexport async function deparseExclusion(params: { executor: SqlExecutor; table: string; definition: string }): Promise<string> {\n const probe = `vibe_exclusion_${randomUUID().replaceAll(\"-\", \"\")}`;\n await params.executor({ text: \"SAVEPOINT vibe_exclusion_probe\" });\n try {\n for (const text of renderExclusionProbe({ dialect: postgresDialect, table: params.table, probe, definition: params.definition })) await params.executor({ text });\n const rows = await params.executor({ text: renderExclusionCatalog({ dialect: postgresDialect, probe }) });\n if (typeof rows[0]?.definition !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Exclusion probe unavailable\", meta: { reason: \"exclusion-inspection-unavailable\" } });\n return rows[0].definition;\n } finally {\n await params.executor({ text: \"ROLLBACK TO SAVEPOINT vibe_exclusion_probe\" });\n await params.executor({ text: \"RELEASE SAVEPOINT vibe_exclusion_probe\" });\n }\n}\n\n/** Establish definition equivalence before the pure differ sees catalog SQL. */\nexport async function prepareExclusionDiff(params: { executor: SqlExecutor; from: SchemaIR; to: SchemaIR; previous?: DesiredState; probe?: string; replaceChecks?: readonly SqlObjectIdentity[] }): Promise<SchemaIR> {\n const models = [];\n for (const model of params.from.models) {\n const table = model.dbName ?? model.name;\n const target = params.to.models.find((entry) => (entry.dbName ?? entry.name) === table);\n const exclusions: ExclusionIR[] = [];\n for (const before of model.exclusions ?? []) {\n const next = target?.exclusions?.find((entry) => entry.name === before.name);\n if (next === undefined || next.definition === before.definition) { exclusions.push(before); continue; }\n const identity: SqlObjectIdentity = { kind: \"constraint\", constraintType: \"exclusion\", table: { namespace: \"public\", name: table }, name: before.name };\n if (params.probe === \"rollback\") {\n const normalized = await deparseExclusion({ executor: params.executor, table, definition: next.definition });\n exclusions.push(normalized === before.definition ? next : { name: before.name, definition: before.definition, requiredExtensions: before.requiredExtensions });\n continue;\n }\n const previous = params.previous?.schema.models.find((entry) => (entry.dbName ?? entry.name) === table)?.exclusions?.find((entry) => entry.name === before.name);\n if (previous !== undefined) { exclusions.push(previous); continue; }\n if (params.replaceChecks?.some((entry) => sqlObjectKey({ identity: entry }) === sqlObjectKey({ identity }))) { exclusions.push({ name: before.name, definition: before.definition, requiredExtensions: before.requiredExtensions }); continue; }\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Exclusion equivalence requires a rollback probe or explicit replacement\", meta: { reason: \"explicit-replacement-required\", identity } });\n }\n models.push({ ...model, exclusions });\n }\n return { ...params.from, models };\n}\n\n/** Verify definition and enforcement without treating a backing index as an ordinary index. */\nexport async function verifyExclusions(params: { executor: SqlExecutor; expected: DesiredState; probe?: string }): Promise<MigrationObjectState[]> {\n if (!params.expected.schema.models.some((model) => (model.exclusions?.length ?? 0) > 0)) return [];\n const rows = await params.executor({ text: renderExclusionCatalog({ dialect: postgresDialect }) });\n const objects: MigrationObjectState[] = [];\n for (const model of params.expected.schema.models) for (const exclusion of model.exclusions ?? []) {\n const table = model.dbName ?? model.name;\n const identity: SqlObjectIdentity = { kind: \"constraint\", constraintType: \"exclusion\", table: { namespace: \"public\", name: table }, name: exclusion.name };\n const row = rows.find((entry) => entry.table_name === table && entry.constraint_name === exclusion.name);\n if (row === undefined) { objects.push({ identity, ownership: \"schema\", state: \"missing\", differences: [] }); continue; }\n const differences: MigrationStateDifference[] = [\"validated\", \"valid\", \"ready\"].flatMap((attribute) => row[attribute] === true ? [] : [{ attribute, expected: true, actual: row[attribute] }]);\n const independentlyVerified = params.expected.definitions.some((entry) => sqlObjectKey({ identity: entry.identity }) === sqlObjectKey({ identity }));\n const definition = independentlyVerified ? row.definition : params.probe === \"rollback\" ? await deparseExclusion({ executor: params.executor, table, definition: exclusion.definition }) : (exclusion.normalizationSource === exclusion.definition ? exclusion.normalizedDefinition : undefined) ?? exclusion.definition;\n if (definition !== row.definition) differences.push({ attribute: \"definition\", expected: definition, actual: row.definition });\n objects.push({ identity, ownership: \"schema\", state: differences.length === 0 ? \"matching\" : params.probe === \"rollback\" ? \"changed\" : \"unavailable\", differences });\n }\n return objects;\n}\n",
|
|
20
|
+
"import { verifyExclusions } from \"./exclusions.ts\";\nimport { randomUUID } from \"node:crypto\";\nimport { VibeError, sqlObjectKey, DIALECT_CAPABILITIES } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR, SqlObjectDefinition, SqlObjectFacts, SqlObjectIdentity } from \"@vibeorm/schema\";\nimport { getSqlDialect, renderMigrationObjectBatch, renderMigrationObjectQuery, renderCheckProbe, renderMigrationNamespace, renderMigrationDependencies, renderMysqlObjectMembers, renderMysqlCheckProbe, sqliteColumnClauses, renderMigrationVisibility, sqliteTableConstraints, renderSqliteColumnInventory } from \"@vibeorm/sql\";\nimport type { MigrationObjectBatch } from \"@vibeorm/sql\";\nimport type { SqlExecutor } from \"./types.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { canonicalMigrationJson } from \"./desired-state.ts\";\nimport { parseSqliteNamedChecks } from \"./sqlite-types.ts\";\nimport { introspectPhysicalPostgres } from \"./introspect/postgres.ts\";\nimport { introspectMysql } from \"./introspect/mysql.ts\";\nimport { introspectSqlite, introspectSqliteBeforeForeignKeyRestore } from \"./introspect/sqlite.ts\";\nimport { executeStatement } from \"./execute.ts\";\nimport { normalizeSchema } from \"./normalize.ts\";\nimport { resolvePostgresTypeIdentities } from \"./postgres-type-identity.ts\";\nimport { equivalentPostgresDefaultFunction } from \"./postgres-default-equivalence.ts\";\nimport { schemaObjectIdentities } from \"./object-ownership.ts\";\n\n/** A single difference, not a boolean that hides disabled or changed objects. */\nexport type MigrationStateDifference = { readonly attribute: string; readonly expected: unknown; readonly actual: unknown };\n/** Ownership and live condition are independent dimensions. */\nexport type MigrationObjectState = {\n readonly identity: SqlObjectIdentity;\n readonly ownership: \"schema\" | \"migration\" | \"unknown\";\n readonly state: \"matching\" | \"missing\" | \"changed\" | \"unavailable\";\n readonly differences: readonly MigrationStateDifference[];\n readonly reason?: string;\n};\n/** A report only claims convergence when every requested definition was verified. */\nexport type MigrationStateReport = { readonly inSync: boolean; readonly objects: readonly MigrationObjectState[] };\n/** Catalog read outcome; missing is never substituted for insufficient privileges. */\nexport type InspectedSqlObject =\n | { readonly state: \"present\"; readonly definition: SqlObjectDefinition }\n | { readonly state: \"missing\" }\n | { readonly state: \"unavailable\"; readonly reason: string };\n\nfunction factsOf(params: { row: Record<string, unknown> }): SqlObjectFacts | undefined {\n const facts: Record<string, string | number | boolean | null | readonly string[]> = {};\n for (const [name, value] of Object.entries(params.row)) {\n if (value === null || typeof value === \"string\" || typeof value === \"boolean\" || (typeof value === \"number\" && Number.isFinite(value))) facts[name] = value;\n else if (Array.isArray(value) && value.every((entry) => typeof entry === \"string\")) facts[name] = value;\n else return undefined;\n }\n return facts;\n}\n\n/** Read an explicitly qualified object using the dialect's catalog renderer. */\nexport async function inspectSqlObject(params: { executor: SqlExecutor; dialect: Dialect; identity: SqlObjectIdentity }): Promise<InspectedSqlObject> {\n return Promise.resolve().then(async (): Promise<InspectedSqlObject> => {\n const namespace = \"table\" in params.identity ? params.identity.table.namespace : params.identity.name.namespace;\n const query = renderMigrationObjectQuery({ dialect: getSqlDialect({ dialect: params.dialect }), identity: params.identity });\n if (params.dialect === \"mysql\") await assertCatalogVisibility({ executor: params.executor, dialect: params.dialect, namespace });\n const rows = await params.executor({ text: query.text, values: [...query.values] });\n if (rows.length === 0) return { state: \"missing\" };\n if (rows.length !== 1) return { state: \"unavailable\", reason: \"ambiguous-catalog-identity\" };\n let facts = factsOf({ row: rows[0]! });\n if (facts === undefined) return { state: \"unavailable\", reason: \"unsupported-catalog-value\" };\n if (params.dialect === \"mysql\" && (params.identity.kind === \"function\" || params.identity.kind === \"view\") && facts.definition === null) return { state: \"unavailable\", reason: \"definition-not-visible\" };\n if (params.dialect === \"sqlite\" && params.identity.kind === \"constraint\") {\n const name = params.identity.name;\n if (params.identity.constraintType === \"check\") {\n const check = parseSqliteNamedChecks({ tableSql: String(facts.definition ?? \"\") }).find((entry) => entry.name === name);\n if (check === undefined) return { state: \"missing\" };\n facts = { type: \"check\", definition: check.expression };\n } else {\n const constraintType = params.identity.constraintType;\n const constraint = sqliteTableConstraints({ sql: String(facts.definition ?? \"\") }).find((entry) => entry.name === name && entry.type === constraintType);\n if (constraint === undefined && constraintType === \"primaryKey\" && name === `${params.identity.table.name}_pkey`) {\n // SQLite has no catalog constraint name for an inline primary key.\n // The inventory's synthetic identity is backed by ordered pragma keys,\n // not an invented textual constraint definition.\n const query = renderSqliteColumnInventory({ dialect: getSqlDialect({ dialect: \"sqlite\" }), namespace: params.identity.table.namespace, table: params.identity.table.name });\n const columns = (await params.executor({ text: query.text, values: [...query.values] })).filter((column) => Number(column.pk) > 0).sort((a, b) => Number(a.pk) - Number(b.pk));\n if (columns.length === 0) return { state: \"missing\" };\n facts = { type: \"primaryKey\", columns: columns.map((column) => String(column.name)) };\n } else {\n if (constraint === undefined) return { state: \"unavailable\", reason: \"constraint-definition-inspection-unavailable\" };\n facts = { type: constraint.type, definition: constraint.sql };\n }\n }\n }\n if (params.dialect === \"sqlite\" && (params.identity.kind === \"column\" || params.identity.kind === \"columnDefault\" || params.identity.kind === \"generatedColumn\")) {\n const column = params.identity.column;\n const clause = sqliteColumnClauses({ sql: String(facts.tableDefinition ?? \"\") }).find((entry) => entry.name === column);\n if (clause === undefined) return { state: \"unavailable\", reason: \"column-definition-inspection-unavailable\" };\n const { tableDefinition: ignored, ...attributes } = facts;\n facts = { ...attributes, columnDefinition: clause.sql };\n }\n if (params.identity.kind === \"columnDefault\") facts = { definition: facts.definition ?? null };\n if (params.dialect === \"postgres\") {\n const query = renderMigrationDependencies({ dialect: getSqlDialect({ dialect: params.dialect }), identity: params.identity });\n const rows = await params.executor({ text: query.text, values: [...query.values] });\n return postgresInspection({ identity: params.identity, facts, addresses: rows.map((row) => row.address) });\n }\n if (params.dialect === \"mysql\") {\n const query = renderMysqlObjectMembers({ dialect: getSqlDialect({ dialect: params.dialect }), identity: params.identity });\n if (query !== undefined) {\n const rows = await params.executor({ text: query.text, values: [...query.values] });\n if (params.identity.kind === \"function\" && rows.length === 0) return { state: \"unavailable\", reason: \"function-signature-unavailable\" };\n if (params.identity.kind === \"function\") {\n const signature = rows.filter((row) => row.mode !== null).map((row) => ({ namespace: \"mysql\", name: String(row.type) }));\n if (canonicalMigrationJson({ value: signature }) !== canonicalMigrationJson({ value: params.identity.argumentTypes })) return { state: \"missing\" };\n }\n facts = { ...facts, members: rows.map((row) => canonicalMigrationJson({ value: row })) };\n }\n }\n return { state: \"present\", definition: { identity: params.identity, facts, dependencies: [], format: \"catalog-v2\" } };\n }).catch((error: unknown): InspectedSqlObject => ({ state: \"unavailable\", reason: error instanceof VibeError ? String(error.meta.feature ?? error.code) : \"catalog-query-failed\" }));\n}\n\nfunction postgresInspection(params: { identity: SqlObjectIdentity; facts: SqlObjectFacts; addresses: readonly unknown[] }): InspectedSqlObject {\n if (!params.addresses.every((address): address is string => typeof address === \"string\")) return { state: \"unavailable\", reason: \"dependency-inspection-unavailable\" };\n const facts = { ...(params.identity.kind === \"columnDefault\" ? { definition: params.facts.definition ?? null } : params.facts), dependencyAddresses: [...params.addresses].sort() };\n const dependencies: SqlObjectIdentity[] = [];\n if (params.identity.kind === \"trigger\") {\n if (params.facts.functionArguments !== \"\") return { state: \"unavailable\", reason: \"trigger-function-signature-unavailable\" };\n dependencies.push({ kind: \"function\", name: { namespace: String(params.facts.functionNamespace), name: String(params.facts.functionName) }, argumentTypes: [] });\n }\n return { state: \"present\", definition: { identity: params.identity, facts, dependencies, format: \"catalog-v2\" } };\n}\n\nfunction unavailableReason(params: { error: unknown }): string {\n return params.error instanceof VibeError ? String(params.error.meta.feature ?? params.error.meta.reason ?? params.error.code) : \"catalog-query-failed\";\n}\n\ntype BatchOutcome = { readonly ok: true; readonly rows: ReadonlyMap<number, readonly Record<string, unknown>[]> } | { readonly ok: false; readonly reason: string };\n\nasync function readBatch(params: { executor: SqlExecutor; batch: MigrationObjectBatch }): Promise<BatchOutcome> {\n const positions = new Set(params.batch.positions);\n return Promise.resolve().then(async (): Promise<BatchOutcome> => {\n const rows = new Map<number, Record<string, unknown>[]>();\n for (const row of await params.executor({ text: params.batch.text, values: [...params.batch.values] })) {\n if (typeof row.position !== \"number\" || !Number.isInteger(row.position) || !positions.has(row.position)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Invalid batched catalog identity\", meta: { reason: \"catalog-query-failed\" } });\n const matches = rows.get(row.position) ?? [];\n matches.push(row);\n rows.set(row.position, matches);\n }\n return { ok: true, rows };\n }).then((outcome) => outcome, (error: unknown): BatchOutcome => ({ ok: false, reason: unavailableReason({ error }) }));\n}\n\nfunction batchedInspection(params: { identity: SqlObjectIdentity; matches: readonly Record<string, unknown>[] }): InspectedSqlObject {\n if (params.matches.length === 0) return { state: \"missing\" };\n if (params.matches.length !== 1) return { state: \"unavailable\", reason: \"ambiguous-catalog-identity\" };\n const row = params.matches[0]!;\n const facts = row.facts !== null && typeof row.facts === \"object\" && !Array.isArray(row.facts) ? factsOf({ row: row.facts as Record<string, unknown> }) : undefined;\n if (facts === undefined || !Array.isArray(row.dependencyAddresses)) return { state: \"unavailable\", reason: \"unsupported-catalog-value\" };\n return postgresInspection({ identity: params.identity, facts, addresses: row.dependencyAddresses });\n}\n\n/** Inspect an independent reference in bounded round trips, preserving missing/unavailable outcomes. */\nexport async function inspectSqlObjects(params: { executor: SqlExecutor; dialect: Dialect; identities: readonly SqlObjectIdentity[] }): Promise<readonly InspectedSqlObject[]> {\n if (params.dialect !== \"postgres\") {\n const results: InspectedSqlObject[] = [];\n for (const identity of params.identities) results.push(await inspectSqlObject({ ...params, identity }));\n return results;\n }\n return Promise.resolve().then(async (): Promise<readonly InspectedSqlObject[]> => {\n const results: InspectedSqlObject[] = params.identities.map((): InspectedSqlObject => ({ state: \"unavailable\", reason: \"catalog-query-failed\" }));\n for (const batch of renderMigrationObjectBatch({ dialect: getSqlDialect({ dialect: params.dialect }), identities: params.identities })) {\n // A failing batch marks only the positions it answers for; other kinds keep their own verdicts.\n const outcome = await readBatch({ executor: params.executor, batch });\n for (const position of batch.positions) {\n results[position] = outcome.ok ? batchedInspection({ identity: params.identities[position]!, matches: outcome.rows.get(position) ?? [] }) : { state: \"unavailable\", reason: outcome.reason };\n }\n }\n return results;\n }).then((result) => result, (error: unknown) => params.identities.map((): InspectedSqlObject => ({ state: \"unavailable\", reason: unavailableReason({ error }) })));\n}\n\n/** Require provable catalog visibility; role-only/partial grants report unavailable rather than missing. */\nexport async function assertCatalogVisibility(params: { executor: SqlExecutor; dialect: Dialect; namespace: string }): Promise<void> {\n if (params.dialect !== \"mysql\") return;\n const query = renderMigrationVisibility({ dialect: getSqlDialect({ dialect: params.dialect }), namespace: params.namespace });\n const rows = await params.executor({ text: query.text, values: [...query.values] });\n const grants = new Set(rows.map((row) => row.privilege));\n const missing = [\"SELECT\", \"TRIGGER\", \"SHOW VIEW\", \"EXECUTE\"].filter((privilege) => !grants.has(privilege));\n if (missing.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"MySQL catalog visibility requires direct database-wide grants; role-only or partial grants cannot prove object absence\", meta: { reason: \"inventory-unavailable\", missing } });\n}\n\n/**\n * Facts a catalog-v1 capture never recorded. A v1 expectation cannot assert\n * them, so only there are they skipped; a catalog-v2 expectation compares every\n * fact. Adding a fact means a new format version, never a new row here.\n */\nconst CATALOG_V1_OMITTED_FACTS: Readonly<Record<string, readonly string[]>> = Object.freeze({\n function: [\"definerOwner\"],\n column: [\"collationNamespace\", \"collationName\"],\n generatedColumn: [\"collationNamespace\", \"collationName\"],\n});\n\nfunction compare(params: { expected: SqlObjectDefinition; live: SqlObjectDefinition }): MigrationStateDifference[] {\n const differences: MigrationStateDifference[] = [];\n const omitted = params.expected.format === \"catalog-v1\" ? CATALOG_V1_OMITTED_FACTS[params.expected.identity.kind] ?? [] : [];\n for (const key of new Set([...Object.keys(params.expected.facts), ...Object.keys(params.live.facts)])) {\n if (omitted.includes(key) && !Object.hasOwn(params.expected.facts, key)) continue;\n const expected = params.expected.facts[key];\n const actual = params.live.facts[key];\n if ((expected === undefined) !== (actual === undefined) || canonicalMigrationJson({ value: expected }) !== canonicalMigrationJson({ value: actual })) differences.push({ attribute: key, expected, actual });\n }\n const expected = params.expected.dependencies.map((identity) => sqlObjectKey({ identity })).sort();\n const actual = params.live.dependencies.map((identity) => sqlObjectKey({ identity })).sort();\n if (JSON.stringify(expected) !== JSON.stringify(actual)) differences.push({ attribute: \"dependencies\", expected, actual });\n return differences;\n}\n\n/** Probe modes make database writes and required privileges explicit. */\nexport function assertProbeMode(params: { dialect: Dialect; probe?: \"none\" | \"rollback\" | \"temporary\" }): void {\n if (params.probe !== undefined && params.probe !== \"none\" && DIALECT_CAPABILITIES[params.dialect].checkNormalization !== params.probe) throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: `${params.probe} CHECK probes are unavailable on ${params.dialect}`, meta: { feature: \"checkProbe\", dialect: params.dialect } });\n}\n\n/** Read-only by default. The report never treats an absent expectation as a match. */\nexport async function verifyMigrationState(params: { executor: SqlExecutor; expected: DesiredState; dialect: Dialect; probe?: \"none\" | \"rollback\" | \"temporary\"; /** Independent replay verification may batch its catalog reads. */ batch?: true }): Promise<MigrationStateReport> {\n return verifyState(params);\n}\n\nasync function verifyState(params: Parameters<typeof verifyMigrationState>[0] & { sqliteRestorePending?: true }): Promise<MigrationStateReport> {\n assertProbeMode({ dialect: params.dialect, probe: params.probe });\n const declarations = params.expected.schema.migrationObjects ?? [];\n const owned = new Set(declarations.map((object) => sqlObjectKey({ identity: object.identity })));\n const definitions = new Map(params.expected.definitions.map((definition) => [sqlObjectKey({ identity: definition.identity }), definition]));\n const identities = new Map(params.expected.definitions.map((definition) => [sqlObjectKey({ identity: definition.identity }), definition.identity]));\n for (const object of declarations) identities.set(sqlObjectKey({ identity: object.identity }), object.identity);\n const objects: MigrationObjectState[] = [];\n const inspections = params.batch === true ? await inspectSqlObjects({ ...params, identities: [...identities.values()] }) : undefined;\n let position = 0;\n for (const [key, identity] of identities) {\n const ownership = owned.has(key) ? \"migration\" : \"schema\";\n const expected = definitions.get(key);\n const live = inspections === undefined ? await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity }) : inspections[position]!;\n position++;\n if (live.state !== \"present\") {\n objects.push({ identity, ownership, state: live.state, differences: [], ...(live.state === \"unavailable\" ? { reason: live.reason } : {}) });\n } else if (expected === undefined) {\n objects.push({ identity, ownership, state: \"unavailable\", reason: \"independent-definition-required\", differences: [] });\n } else if (params.dialect === \"postgres\" && identity.kind === \"table\" && (expected.facts.persistence === undefined || expected.facts.options === undefined)) {\n objects.push({ identity, ownership, state: \"unavailable\", reason: \"table-physical-reference-required\", differences: compare({ expected, live: live.definition }) });\n } else {\n const differences = compare({ expected, live: live.definition });\n objects.push({ identity, ownership, state: differences.length === 0 ? \"matching\" : \"changed\", differences });\n }\n }\n if (params.expected.schema.models.length > 0 || params.expected.schema.enums.length > 0) objects.push(...await verifySchemaObjects(params));\n if (params.dialect === \"postgres\") objects.push(...await verifyExclusions(params));\n return { inSync: objects.every((object) => object.state === \"matching\"), objects };\n}\n\nasync function verifySchemaObjects(params: Parameters<typeof verifyMigrationState>[0] & { sqliteRestorePending?: true }): Promise<MigrationObjectState[]> {\n const physical = params.dialect === \"postgres\" ? await introspectPhysicalPostgres({ executor: params.executor })\n : params.dialect === \"mysql\" ? await introspectMysql({ executor: params.executor })\n : params.sqliteRestorePending === true ? await introspectSqliteBeforeForeignKeyRestore({ executor: params.executor }) : await introspectSqlite({ executor: params.executor });\n const resolved = params.dialect === \"postgres\" ? await resolvePostgresTypeIdentities({ executor: params.executor, schema: params.expected.schema, mode: \"verify\" }) : { schema: params.expected.schema, unavailable: [] };\n const expected = normalizeSchema({ schema: resolved.schema, dialect: params.dialect });\n const actual = normalizeSchema({ schema: physical, dialect: params.dialect });\n const objects: MigrationObjectState[] = resolved.unavailable.map((identity) => ({ identity, ownership: \"schema\", state: \"unavailable\", reason: \"type-reference-required\", differences: [] }));\n const namespace = await migrationNamespace({ executor: params.executor, dialect: params.dialect });\n const sqliteTableOptions = params.dialect === \"sqlite\" && expected.tables.size > 0\n ? await params.executor({ text: \"PRAGMA main.table_list;\", values: [] }) : undefined;\n if (params.dialect === \"postgres\") for (const [name, desired] of expected.enums) {\n const identity: SqlObjectIdentity = { kind: \"enum\", name: { namespace, name } };\n const live = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n if (live.state !== \"present\") {\n objects.push({ identity, ownership: \"schema\", state: live.state, differences: [], ...(live.state === \"unavailable\" ? { reason: live.reason } : {}) });\n continue;\n }\n const values = live.definition.facts.values;\n if (!Array.isArray(values) || !values.every((value) => typeof value === \"string\")) {\n objects.push({ identity, ownership: \"schema\", state: \"unavailable\", reason: \"enum-values-unavailable\", differences: [] });\n continue;\n }\n const matching = canonicalMigrationJson({ value: desired.values }) === canonicalMigrationJson({ value: values });\n objects.push({ identity, ownership: \"schema\", state: matching ? \"matching\" : \"changed\", differences: matching ? [] : [{ attribute: \"values\", expected: desired.values, actual: values }] });\n }\n for (const [name, desired] of expected.tables) {\n const table = { namespace, name };\n const live = actual.tables.get(name);\n if (live === undefined) {\n const presence = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity: { kind: \"table\", name: table } });\n objects.push({ identity: { kind: \"table\", name: table }, ownership: \"schema\", state: presence.state === \"missing\" ? \"missing\" : \"unavailable\", ...(presence.state === \"missing\" ? {} : { reason: \"schema-definition-not-visible\" }), differences: [] });\n continue;\n }\n if (sqliteTableOptions !== undefined) {\n const options = sqliteTableOptions.find((row) => row.schema === namespace && row.name === name);\n if (options?.strict !== 0 || options.wr !== 0) {\n objects.push({ identity: { kind: \"table\", name: table }, ownership: \"schema\", state: \"unavailable\", reason: \"sqlite-table-options-unrepresented\", differences: [{ attribute: \"tableOptions\", expected: { strict: 0, wr: 0 }, actual: options === undefined ? undefined : { strict: options.strict, wr: options.wr } }] });\n continue;\n }\n }\n const differences: MigrationStateDifference[] = [];\n const pin = (attribute: string, expected: unknown, actual: unknown): void => {\n if (canonicalMigrationJson({ value: expected }) !== canonicalMigrationJson({ value: actual })) differences.push({ attribute, expected, actual });\n };\n pin(\"primaryKey\", desired.pk, live.pk);\n for (const [column, field] of desired.columns) {\n const stored = live.columns.get(column);\n pin(`columns.${column}.type`, field.typeKey, stored?.typeKey);\n pin(`columns.${column}.nullable`, field.nullable, stored?.nullable);\n if (params.dialect === \"mysql\" && field.field.collation !== undefined) {\n pin(`columns.${column}.collation`, field.field.collation.toLowerCase(), stored?.field.collation?.toLowerCase());\n }\n const ownedDefault = params.expected.schema.migrationObjects?.some((object) => (object.identity.kind === \"columnDefault\" || object.identity.kind === \"generatedColumn\") && object.identity.table.namespace === namespace && object.identity.table.name === name && object.identity.column === column);\n if (!ownedDefault) {\n const desiredDefault = field.field.default;\n const actualDefault = stored?.field.default;\n const equivalent = params.dialect === \"postgres\" && field.defaultKey !== stored?.defaultKey &&\n desiredDefault?.kind === \"dbgenerated\" && actualDefault?.kind === \"dbgenerated\" &&\n await equivalentPostgresDefaultFunction({ executor: params.executor, table, column, expected: desiredDefault.sql, actual: actualDefault.sql });\n if (!equivalent) pin(`columns.${column}.default`, field.defaultKey, stored?.defaultKey);\n }\n }\n for (const [key, fk] of desired.fks) {\n const stored = live.fks.get(key);\n pin(`foreignKeys.${fk.constraintName}`, { columns: fk.columns, refTable: fk.refTable, refColumns: fk.refColumns, onDelete: fk.onDelete, onUpdate: fk.onUpdate }, stored === undefined ? undefined : { columns: stored.columns, refTable: stored.refTable, refColumns: stored.refColumns, onDelete: stored.onDelete, onUpdate: stored.onUpdate });\n if (params.dialect === \"postgres\" && stored !== undefined) {\n const identity: SqlObjectIdentity = { kind: \"constraint\", constraintType: \"foreignKey\", table, name: stored.constraintName };\n // A reviewed catalog definition can deliberately describe a staged NOT VALID FK.\n if (params.expected.definitions.some((definition) => sqlObjectKey({ identity: definition.identity }) === sqlObjectKey({ identity }))) continue;\n const inspection = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n if (inspection.state !== \"present\") {\n objects.push({ identity, ownership: \"schema\", state: inspection.state, differences: [], ...(inspection.state === \"unavailable\" ? { reason: inspection.reason } : {}) });\n } else {\n const differences = [\"validated\", \"triggersEnabled\"].flatMap((attribute) => inspection.definition.facts[attribute] === true ? [] : [{ attribute, expected: true, actual: inspection.definition.facts[attribute] }]);\n objects.push({ identity, ownership: \"schema\", state: differences.length === 0 ? \"matching\" : \"changed\", differences });\n }\n }\n }\n for (const [key, index] of desired.indexes) {\n pin(`indexes.${index.name}`, key, live.indexes.get(key)?.key);\n if (params.dialect !== \"postgres\" || !live.indexes.has(key)) continue;\n const identity: SqlObjectIdentity = { kind: \"index\", table, name: live.indexes.get(key)!.name };\n if (params.expected.definitions.some((definition) => sqlObjectKey({ identity: definition.identity }) === sqlObjectKey({ identity }))) continue;\n const inspection = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n if (inspection.state !== \"present\") {\n objects.push({ identity, ownership: \"schema\", state: inspection.state, differences: [], ...(inspection.state === \"unavailable\" ? { reason: inspection.reason } : {}) });\n } else {\n const differences = [\"valid\", \"ready\"].flatMap((attribute) => inspection.definition.facts[attribute] === true ? [] : [{ attribute, expected: true, actual: inspection.definition.facts[attribute] }]);\n objects.push({ identity, ownership: \"schema\", state: differences.length === 0 ? \"matching\" : \"changed\", differences });\n }\n }\n objects.push({ identity: { kind: \"table\", name: table }, ownership: \"schema\", state: differences.length === 0 ? \"matching\" : \"changed\", differences });\n for (const [check, expression] of desired.checks) {\n const identity: SqlObjectIdentity = { kind: \"constraint\", constraintType: \"check\", table, name: check };\n if (params.expected.definitions.some((definition) => sqlObjectKey({ identity: definition.identity }) === sqlObjectKey({ identity }))) continue;\n const stored = live.checks.get(check);\n if (stored === undefined) { objects.push({ identity, ownership: \"schema\", state: \"missing\", differences: [] }); continue; }\n if (params.dialect !== \"sqlite\") {\n const inspection = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n if (inspection.state !== \"present\") { objects.push({ identity, ownership: \"schema\", state: inspection.state, differences: [] }); continue; }\n const disabled = params.dialect === \"postgres\" ? inspection.definition.facts.validated !== true : inspection.definition.facts.enforced !== \"YES\";\n if (disabled) { objects.push({ identity, ownership: \"schema\", state: \"changed\", differences: [{ attribute: params.dialect === \"postgres\" ? \"validated\" : \"enforced\", expected: params.dialect === \"postgres\" ? true : \"YES\", actual: params.dialect === \"postgres\" ? inspection.definition.facts.validated : inspection.definition.facts.enforced }] }); continue; }\n }\n if (stored === expression) { objects.push({ identity, ownership: \"schema\", state: \"matching\", differences: [] }); continue; }\n if (params.dialect === \"postgres\" && params.probe === \"rollback\") {\n const normalized = await deparsePostgresCheck({ executor: params.executor, table, expression, probe: \"rollback\" });\n const read = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n const actual = read.state === \"present\" ? read.definition.facts.definition : undefined;\n objects.push({ identity, ownership: \"schema\", state: normalized === actual ? \"matching\" : \"changed\", differences: normalized === actual ? [] : [{ attribute: \"definition\", expected: normalized, actual }] });\n } else if (params.dialect === \"mysql\" && params.probe === \"temporary\") {\n const normalized = await deparseMysqlCheck({ executor: params.executor, table, expression, probe: \"temporary\" });\n const inspection = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n const actual = inspection.state === \"present\" ? inspection.definition.facts.definition : undefined;\n const match = normalized === actual;\n objects.push({ identity, ownership: \"schema\", state: inspection.state === \"unavailable\" ? \"unavailable\" : match ? \"matching\" : \"changed\", differences: match ? [] : [{ attribute: \"definition\", expected: normalized, actual }] });\n } else objects.push({ identity, ownership: \"schema\", state: \"unavailable\", reason: \"explicit-replacement-required\", differences: [{ attribute: \"definition\", expected: expression, actual: stored }] });\n }\n }\n for (const [name, join] of expected.joinTables) {\n const stored = actual.joinTables.get(name);\n const shape = (value: typeof join | undefined): unknown => value === undefined ? undefined : { a: { table: value.a.table, column: value.a.column }, b: { table: value.b.table, column: value.b.column } };\n const matching = canonicalMigrationJson({ value: shape(join) }) === canonicalMigrationJson({ value: shape(stored) });\n objects.push({ identity: { kind: \"table\", name: { namespace, name } }, ownership: \"schema\", state: stored === undefined ? \"missing\" : matching ? \"matching\" : \"changed\", differences: matching ? [] : [{ attribute: \"joinTable\", expected: shape(join), actual: shape(stored) }] });\n }\n for (const [name] of expected.views) {\n if (!params.expected.definitions.some((definition) => definition.identity.kind === \"view\" && definition.identity.name.namespace === namespace && definition.identity.name.name === name)) objects.push({ identity: { kind: \"view\", name: { namespace, name } }, ownership: \"schema\", state: actual.views.has(name) ? \"unavailable\" : \"missing\", reason: \"independent-definition-required\", differences: [] });\n }\n return objects;\n}\n\n/** A transition verifies intended removals as well as definitions that should remain. */\nexport async function verifyMigrationTransition(params: { executor: SqlExecutor; dialect: Dialect; from: DesiredState; to: DesiredState; removals?: readonly SqlObjectIdentity[]; probe?: \"none\" | \"rollback\" | \"temporary\" }): Promise<MigrationStateReport> {\n return verifyTransition(params);\n}\n\n/** @internal Only for a validated rebuild script immediately before COMMIT/FK restoration. */\nexport async function verifySqliteTransitionBeforeRestore(params: Parameters<typeof verifyMigrationTransition>[0]): Promise<MigrationStateReport> {\n if (params.dialect !== \"sqlite\") throw new VibeError({ code: \"VIBE_INTERNAL\", message: \"SQLite rebuild verification requires the SQLite dialect\" });\n await executeStatement({ executor: params.executor, dialect: \"sqlite\", statement: \"PRAGMA foreign_key_check;\" });\n return verifyTransition({ ...params, sqliteRestorePending: true });\n}\n\nasync function verifyTransition(params: Parameters<typeof verifyMigrationTransition>[0] & { sqliteRestorePending?: true }): Promise<MigrationStateReport> {\n const report = await verifyState({ executor: params.executor, dialect: params.dialect, expected: params.to, ...(params.sqliteRestorePending === true ? { sqliteRestorePending: true } : {}), ...(params.probe === undefined ? {} : { probe: params.probe }) });\n const namespace = await migrationNamespace(params);\n const identities = (state: DesiredState): SqlObjectIdentity[] => [...schemaObjectIdentities({ schema: state.schema, dialect: params.dialect, namespace }), ...(state.schema.migrationObjects ?? []).map((object) => object.identity), ...state.definitions.map((definition) => definition.identity)];\n const retained = new Set(identities(params.to).map((identity) => sqlObjectKey({ identity })));\n const removed = new Map([...identities(params.from).filter((identity) => !retained.has(sqlObjectKey({ identity }))), ...(params.removals ?? [])].map((identity) => [sqlObjectKey({ identity }), identity]));\n const objects = [...report.objects];\n for (const identity of removed.values()) {\n const live = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n const absent = live.state === \"missing\" || (identity.kind === \"columnDefault\" && live.state === \"present\" && live.definition.facts.definition === null);\n if (!absent) objects.push({ identity, ownership: \"schema\", state: live.state === \"unavailable\" ? \"unavailable\" : \"changed\", reason: live.state === \"unavailable\" ? live.reason : \"expected-absent\", differences: [{ attribute: \"presence\", expected: false, actual: live.state === \"present\" ? true : undefined }] });\n }\n return { inSync: report.inSync && objects.every((object) => object.state === \"matching\"), objects };\n}\n\n/** Resolve the physical namespace once; never invent a MySQL database name. */\nexport async function migrationNamespace(params: { executor: SqlExecutor; dialect: Dialect }): Promise<string> {\n if (params.dialect !== \"mysql\") return params.dialect === \"sqlite\" ? \"main\" : \"public\";\n const query = renderMigrationNamespace({ dialect: getSqlDialect({ dialect: params.dialect }) });\n const rows = await params.executor({ text: query.text, values: [] });\n const namespace = rows[0]?.namespace;\n if (typeof namespace !== \"string\" || namespace.length === 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot determine the migration namespace\", meta: { reason: \"inspection-unavailable\" } });\n return namespace;\n}\n\n/** Refuse mutation/adoption when verification is incomplete. */\nexport function assertMigrationState(params: { report: MigrationStateReport }): void {\n if (!params.report.inSync) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Migration state could not be verified\", meta: { reason: \"migration-state-unverified\", shadowReusable: true, objects: params.report.objects.filter((object) => object.state !== \"matching\") } });\n}\n\n/** Normalize a trusted authored CHECK in the real type context without retaining DDL. Caller owns transaction. */\nexport async function deparsePostgresCheck(params: { executor: SqlExecutor; table: { namespace: string; name: string }; expression: string; probe: \"rollback\" }): Promise<string> {\n const definition = await deparsePostgresCheckDefinition({ ...params, constraint: \"vibeorm_check_probe\" });\n return String(definition.facts.definition);\n}\n\n/** Compile a trusted CHECK declaration into normalized metadata using only the authored expression. */\nexport async function deparsePostgresCheckDefinition(params: { executor: SqlExecutor; table: { namespace: string; name: string }; expression: string; constraint: string; probe: \"rollback\" }): Promise<SqlObjectDefinition> {\n const name = \"vibeorm_check_probe\";\n await params.executor({ text: \"SAVEPOINT vibeorm_check_probe\" });\n try {\n const query = renderCheckProbe({ dialect: getSqlDialect({ dialect: \"postgres\" }), table: params.table, expression: params.expression, name });\n await params.executor({ text: query.text });\n const result = await inspectSqlObject({ executor: params.executor, dialect: \"postgres\", identity: { kind: \"constraint\", constraintType: \"check\", table: params.table, name } });\n if (result.state !== \"present\" || typeof result.definition.facts.definition !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"CHECK normalization probe unavailable\", meta: { reason: \"check-inspection-unavailable\" } });\n return { ...result.definition, identity: { kind: \"constraint\", constraintType: \"check\", table: params.table, name: params.constraint }, facts: { ...result.definition.facts, definition: result.definition.facts.definition.replace(/ NOT VALID$/, \"\"), validated: true } };\n } finally {\n await params.executor({ text: \"ROLLBACK TO SAVEPOINT vibeorm_check_probe\" });\n await params.executor({ text: \"RELEASE SAVEPOINT vibeorm_check_probe\" });\n }\n}\n\n/** Normalize on a private MySQL temporary clone; cleanup is mandatory even after a failed expression. */\nexport async function deparseMysqlCheck(params: { executor: SqlExecutor; table: { namespace: string; name: string }; expression: string; probe: \"temporary\" }): Promise<string> {\n const probe = `vibe_check_${randomUUID().replaceAll(\"-\", \"\")}`;\n const dialect = getSqlDialect({ dialect: \"mysql\" });\n const clone = renderMysqlCheckProbe({ dialect, probe, operation: \"clone\", table: params.table });\n await params.executor({ text: clone.text });\n let created = true;\n try {\n const read = renderMysqlCheckProbe({ dialect, probe, operation: \"read\" });\n const source = await params.executor({ text: read.text, values: [] });\n const definition = source[0]?.[\"Create Table\"];\n if (typeof definition !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot read temporary clone definition\" });\n const drop = renderMysqlCheckProbe({ dialect, probe, operation: \"drop\" });\n await params.executor({ text: drop.text });\n created = false;\n // CREATE/DROP TEMPORARY TABLE preserve the caller's transaction; ALTER TABLE does not.\n const add = renderMysqlCheckProbe({ dialect, probe, operation: \"add\", expression: params.expression, definition });\n await params.executor({ text: add.text });\n created = true;\n const rows = await params.executor({ text: read.text, values: [] });\n const normalizedDefinition = rows[0]?.[\"Create Table\"];\n const check = typeof normalizedDefinition === \"string\" ? parseSqliteNamedChecks({ tableSql: normalizedDefinition }).find((entry) => entry.name === probe) : undefined;\n if (check === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"MySQL temporary CHECK deparse unavailable\", meta: { reason: \"check-inspection-unavailable\" } });\n return check.expression;\n } finally {\n if (created) {\n const drop = renderMysqlCheckProbe({ dialect, probe, operation: \"drop\" });\n await params.executor({ text: drop.text });\n }\n }\n}\n\n/** Resolve raw CHECK comparisons; unequal unnormalized text never silently produces an empty diff. */\nexport async function prepareCheckDiff(params: { executor: SqlExecutor; from: SchemaIR; to: SchemaIR; dialect: Dialect; probe?: \"none\" | \"rollback\" | \"temporary\"; previous?: DesiredState; replaceChecks?: readonly SqlObjectIdentity[] }): Promise<SchemaIR> {\n assertProbeMode({ dialect: params.dialect, probe: params.probe });\n const models = [];\n for (const model of params.from.models) {\n const table = model.dbName ?? model.name;\n const target = params.to.models.find((entry) => (entry.dbName ?? entry.name) === table);\n const checks = [];\n for (const check of model.checks ?? []) {\n const next = target?.checks?.find((entry) => entry.name === check.name);\n if (next === undefined || next.expression === check.expression) { checks.push({ name: check.name, expression: check.expression }); continue; }\n const identity: SqlObjectIdentity = { kind: \"constraint\", constraintType: \"check\", table: { namespace: await migrationNamespace({ executor: params.executor, dialect: params.dialect }), name: table }, name: check.name };\n if (params.dialect === \"postgres\" && params.probe === \"rollback\") {\n const desired = await deparsePostgresCheck({ executor: params.executor, table: identity.table, expression: next.expression, probe: \"rollback\" });\n const live = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n if (live.state !== \"present\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Live CHECK inspection unavailable\", meta: { reason: \"check-inspection-unavailable\", identity } });\n if (live.definition.facts.definition === desired) { checks.push(next); continue; }\n checks.push({ name: check.name, expression: check.expression });\n continue;\n }\n if (params.dialect === \"mysql\" && params.probe === \"temporary\") {\n const desired = await deparseMysqlCheck({ executor: params.executor, table: identity.table, expression: next.expression, probe: \"temporary\" });\n const live = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n if (live.state !== \"present\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Live CHECK inspection unavailable\", meta: { reason: \"check-inspection-unavailable\", identity } });\n checks.push(desired === live.definition.facts.definition ? next : { name: check.name, expression: check.expression });\n continue;\n }\n const previous = params.previous?.schema.models.find((entry) => (entry.dbName ?? entry.name) === table)?.checks?.find((entry) => entry.name === check.name);\n if (previous !== undefined) {\n // The planner verified this independent baseline before comparing authored text.\n checks.push(previous.expression === next.expression ? next : { name: check.name, expression: check.expression });\n continue;\n }\n if (params.replaceChecks?.some((entry) => sqlObjectKey({ identity: entry }) === sqlObjectKey({ identity }))) { checks.push({ name: check.name, expression: check.expression }); continue; }\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Cannot establish CHECK equivalence for ${table}.${check.name}; request a rollback probe or an explicit replacement`, meta: { reason: \"explicit-replacement-required\", identity } });\n }\n models.push({ ...model, checks });\n }\n return { ...params.from, models };\n}\n",
|
|
21
|
+
"/**\n * Postgres / PGlite introspection: live database → SchemaIR.\n *\n * Representation contract (the differ's round-trip depends on it, LEARNINGS):\n *\n * - Type mapping is the REVERSE of dialect-matrix §2; `nativeType` is set only\n * when the column's type is NOT the canonical mapping for its scalar.\n * - Identity columns and `nextval(...)` defaults → `@default(autoincrement())`.\n * - Enum ARRAY columns (`data_type = 'ARRAY'`, `udt_name = '_EnumName'`) are\n * enum lists — never `String[]`.\n * - Unknown column types (tsvector, geometry, …) become `isUnsupported` fields\n * with the raw type in `nativeType` — kept, not dropped.\n * - FK/join-table representation comes from introspect/shared.ts — the ONE\n * structural rule every dialect introspector uses.\n * - Views (`isView: true`) are returned with their columns only.\n * - The `_vibe_migrations` bookkeeping table is skipped.\n * - Hardcoded to the `public` schema (v1 parity).\n */\n\nimport { renderExclusionCatalog } from \"@vibeorm/sql\";\nimport { parsePgArrayLiteral } from \"@vibeorm/sql\";\nimport { scalarListDefault } from \"@vibeorm/schema\";\nimport { exactIntegerLiteral } from \"@vibeorm/schema\";\nimport { postgresDialect, renderRlsReadinessQuery } from \"@vibeorm/sql\";\n\nimport { VibeError } from \"@vibeorm/schema\";\nimport type {\n CheckIR,\n DefaultValueIR,\n EnumIR,\n FieldIR,\n FieldType,\n IndexIR,\n ModelIR,\n ScalarType,\n SchemaIR,\n} from \"@vibeorm/schema\";\nimport { PG_CHAR_TO_CASCADE_ACTION, isNumericScalar, normalizeNativeType } from \"../postgres-types.ts\";\nimport { MIGRATIONS_TABLE_NAME } from \"../journal-table.ts\";\nimport {\n addFkRelations,\n addJoinTableRelations,\n detectJoinTable,\n} from \"./shared.ts\";\nimport type { FkGroup, IntrospectedIndex, JoinTableInfo } from \"./shared.ts\";\nimport type { SqlExecutor } from \"../types.ts\";\nimport { resolvePostgresTypeIdentities } from \"../postgres-type-identity.ts\";\nimport { projectPostgresRls, verifyPostgresRls } from \"./postgres-rls.ts\";\n\n// ─── Catalog queries ──────────────────────────────────────────────\n\n/**\n * Relations that BELONG to an installed postgres extension (pg_depend\n * deptype 'e': postgis's spatial_ref_sys, its geometry_columns view, …) are\n * not user tables: they are created and dropped WITH the extension, and a\n * DROP TABLE on them fails. Excluding them here keeps push/migrate from ever\n * scheduling their drop — first surfaced live on ParadeDB, whose image\n * pre-installs postgis.\n */\nconst EXTENSION_OWNED_FILTER = `NOT EXISTS (\n SELECT 1\n FROM pg_catalog.pg_depend d\n JOIN pg_catalog.pg_class c ON c.oid = d.objid\n JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n WHERE d.classid = 'pg_class'::regclass\n AND d.deptype = 'e'\n AND n.nspname = 'public'\n AND c.relname = table_name\n )`;\n\nconst TABLES_QUERY = `\n SELECT table_name\n FROM information_schema.tables\n WHERE table_schema = 'public'\n AND table_type = 'BASE TABLE'\n AND table_name <> '${MIGRATIONS_TABLE_NAME}'\n AND ${EXTENSION_OWNED_FILTER}\n ORDER BY table_name;\n`;\n\nconst VIEWS_QUERY = `\n SELECT table_name\n FROM information_schema.views\n WHERE table_schema = 'public'\n AND ${EXTENSION_OWNED_FILTER}\n ORDER BY table_name;\n`;\n\nconst COLUMNS_QUERY = `\n SELECT\n table_name,\n column_name,\n data_type,\n udt_name,\n is_nullable,\n is_identity,\n is_generated,\n collation_name,\n column_default,\n datetime_precision,\n character_maximum_length,\n numeric_precision,\n numeric_scale,\n ordinal_position,\n (\n SELECT format_type(a.atttypid, a.atttypmod)\n FROM pg_attribute a\n JOIN pg_class c ON c.oid = a.attrelid\n JOIN pg_namespace n ON n.oid = c.relnamespace\n WHERE n.nspname = 'public'\n AND c.relname = columns.table_name\n AND a.attname = columns.column_name\n ) AS full_type\n FROM information_schema.columns AS columns\n WHERE table_schema = 'public'\n ORDER BY table_name, ordinal_position;\n`;\n\n/**\n * PK/unique constraints via pg_catalog, NOT information_schema:\n * `information_schema.table_constraints` / `key_column_usage` only show\n * constraints on tables the current user owns or holds some privilege OTHER\n * than SELECT on, so a read-only role would silently lose every `@id` while\n * the (already catalog-based) FK query still returns relations — the most\n * confusing possible failure. `unnest WITH ORDINALITY` preserves composite-key\n * column order, matching the FK query below.\n */\nconst CONSTRAINTS_QUERY = `\n SELECT\n c.conname AS constraint_name,\n CASE c.contype WHEN 'p' THEN 'PRIMARY KEY' ELSE 'UNIQUE' END AS constraint_type,\n cl.relname AS table_name,\n att.attname AS column_name\n FROM pg_catalog.pg_constraint c\n JOIN pg_catalog.pg_class cl ON cl.oid = c.conrelid\n JOIN pg_catalog.pg_namespace n ON n.oid = cl.relnamespace\n JOIN unnest(c.conkey) WITH ORDINALITY AS k(attnum, ord) ON true\n JOIN pg_catalog.pg_attribute att ON att.attrelid = c.conrelid AND att.attnum = k.attnum\n WHERE c.contype IN ('p', 'u')\n AND n.nspname = 'public'\n ORDER BY cl.relname, c.conname, k.ord;\n`;\n\n/**\n * Explicit CHECK constraints (contype 'c'), with their re-serialized\n * definition. NAME keys the diff; the expression only matters for `db pull`\n * output — postgres re-serializes it (extra parens, casts), which is exactly\n * why the differ never compares expression text.\n */\nconst CHECKS_QUERY = `\n SELECT\n cl.relname AS table_name,\n c.conname AS constraint_name,\n pg_get_constraintdef(c.oid) AS definition\n FROM pg_catalog.pg_constraint c\n JOIN pg_catalog.pg_class cl ON cl.oid = c.conrelid\n JOIN pg_catalog.pg_namespace n ON n.oid = cl.relnamespace\n WHERE c.contype = 'c'\n AND n.nspname = 'public'\n ORDER BY cl.relname, c.conname;\n`;\n\n/**\n * FKs via pg_catalog (not information_schema): `unnest(...) WITH ORDINALITY`\n * preserves composite-FK column order across server versions, and\n * `confdeltype` / `confupdtype` surface the cascade actions directly (v1\n * lesson).\n */\nconst FOREIGN_KEYS_QUERY = `\n SELECT\n c.conname AS constraint_name,\n cl.relname AS table_name,\n att.attname AS column_name,\n fcl.relname AS foreign_table_name,\n fatt.attname AS foreign_column_name,\n c.confdeltype AS on_delete_char,\n c.confupdtype AS on_update_char,\n c.convalidated AS validated,\n c.condeferrable AS deferrable,\n (SELECT bool_and(t.tgenabled IN ('O', 'A')) FROM pg_catalog.pg_trigger t WHERE t.tgconstraint = c.oid) AS triggers_enabled\n FROM pg_catalog.pg_constraint c\n JOIN pg_catalog.pg_class cl ON cl.oid = c.conrelid\n JOIN pg_catalog.pg_namespace n ON n.oid = cl.relnamespace\n JOIN pg_catalog.pg_class fcl ON fcl.oid = c.confrelid\n JOIN pg_catalog.pg_namespace fn ON fn.oid = fcl.relnamespace\n JOIN unnest(c.conkey) WITH ORDINALITY AS lk(attnum, ord) ON true\n JOIN unnest(c.confkey) WITH ORDINALITY AS rk(attnum, ord) ON lk.ord = rk.ord\n JOIN pg_catalog.pg_attribute att ON att.attrelid = c.conrelid AND att.attnum = lk.attnum\n JOIN pg_catalog.pg_attribute fatt ON fatt.attrelid = c.confrelid AND fatt.attnum = rk.attnum\n WHERE c.contype = 'f'\n AND n.nspname = 'public'\n AND fn.nspname = 'public'\n ORDER BY cl.relname, c.conname, lk.ord;\n`;\n\nconst ENUMS_QUERY = `\n SELECT\n t.typname AS type_name,\n e.enumlabel AS enum_value,\n e.enumsortorder AS sort_order\n FROM pg_type t\n JOIN pg_enum e ON t.oid = e.enumtypid\n JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n WHERE n.nspname = 'public'\n ORDER BY t.typname, e.enumsortorder;\n`;\n\nconst INDEXES_QUERY = `\n SELECT\n tablename AS table_name,\n indexname AS index_name,\n indexdef AS index_def,\n con.conname AS backing_constraint,\n con.contype AS backing_constraint_type,\n health.indisvalid AS valid,\n health.indisready AS ready,\n health.indimmediate AS immediate,\n health.indexprs IS NULL AS plain_columns,\n health.indnkeyatts AS key_count,\n health.indnatts AS attribute_count\n FROM pg_indexes ix\n JOIN pg_catalog.pg_namespace ns ON ns.nspname = ix.schemaname\n JOIN pg_catalog.pg_class idx ON idx.relnamespace = ns.oid AND idx.relname = ix.indexname\n JOIN pg_catalog.pg_index health ON health.indexrelid = idx.oid\n LEFT JOIN pg_catalog.pg_constraint con ON con.conindid = idx.oid AND con.contype IN ('p', 'u', 'x')\n WHERE schemaname = 'public'\n ORDER BY tablename, indexname;\n`;\n\n// ─── Row shapes ───────────────────────────────────────────────────\n\ntype ColumnRow = {\n table: string;\n name: string;\n dataType: string;\n udtName: string;\n nullable: boolean;\n identity: boolean;\n columnDefault: string | null;\n datetimePrecision: number | null;\n charMaxLength: number | null;\n numericPrecision: number | null;\n numericScale: number | null;\n /** `format_type(...)` — carries type modifiers of non-catalog types (vector(3)). */\n fullType: string | null;\n};\n\n// ─── Public API ───────────────────────────────────────────────────\n\n/** Introspect a live postgres/pglite database (public schema) into SchemaIR. */\nexport async function introspectPostgres(params: {\n executor: SqlExecutor;\n /** Trusted policy declaration; missing this refuses lossy RLS introspection/export. */\n rlsSchema?: SchemaIR;\n /** The caller owns BEGIN/COMMIT, keeping probe locks through subsequent migration DDL. */\n inTransaction?: boolean;\n requireInstalledRls?: boolean;\n}): Promise<SchemaIR> {\n const { executor } = params;\n if (params.inTransaction !== true) await executor({ text: \"BEGIN\" });\n try {\n const savedPath = params.inTransaction === true\n ? await executor(renderRlsReadinessQuery({ dialect: postgresDialect, query: \"readSearchPath\" }))\n : undefined;\n const searchPath = savedPath?.[0]?.searchPath;\n if (params.inTransaction === true && typeof searchPath !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot read the migration search_path\" });\n const matched = await verifyPostgresRls({ executor, ...(params.rlsSchema === undefined ? {} : { schema: params.rlsSchema }), ...(params.requireInstalledRls === undefined ? {} : { requireInstalled: params.requireInstalledRls }) }).then(\n (verified) => verified,\n (error: unknown) => {\n if (error instanceof VibeError) throw error;\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Native RLS verification could not complete. Check migration privileges and supply the deployed schema as previousSchema/rlsSchema before changing referenced columns.\", meta: { reason: \"rls-verification-unavailable\" }, cause: error });\n },\n );\n const physical = await introspectPhysicalPostgres({ executor });\n if (typeof searchPath === \"string\") await executor(renderRlsReadinessQuery({ dialect: postgresDialect, query: \"setSearchPath\", searchPath }));\n return projectPostgresRls({ physical, ...(params.rlsSchema === undefined ? {} : { declared: params.rlsSchema }), matched });\n } finally {\n // Introspection/probes never commit database changes; an outer migration retains its locks.\n if (params.inTransaction !== true) await executor({ text: \"ROLLBACK\" });\n }\n}\n\n/** Read the physical catalog only; no policy probes, locks or transaction statements. */\nexport async function introspectPhysicalPostgres(params: { executor: SqlExecutor }): Promise<SchemaIR> {\n const { executor } = params;\n\n const [tableRows, viewRows, columnRows, constraintRows, fkRows, enumRows, indexRows, checkRows, exclusionRows] =\n await Promise.all([\n executor({ text: TABLES_QUERY }),\n executor({ text: VIEWS_QUERY }),\n executor({ text: COLUMNS_QUERY }),\n executor({ text: CONSTRAINTS_QUERY }),\n executor({ text: FOREIGN_KEYS_QUERY }),\n executor({ text: ENUMS_QUERY }),\n executor({ text: INDEXES_QUERY }),\n executor({ text: CHECKS_QUERY }),\n executor({ text: renderExclusionCatalog({ dialect: postgresDialect }) }),\n ]);\n\n const tables = tableRows.map((row) => row.table_name as string);\n const views = viewRows.map((row) => row.table_name as string);\n\n const columns: ColumnRow[] = columnRows.map((row) => ({\n table: row.table_name as string,\n name: row.column_name as string,\n dataType: row.data_type as string,\n udtName: row.udt_name as string,\n nullable: (row.is_nullable as string) === \"YES\",\n identity: (row.is_identity as string | null) === \"YES\",\n columnDefault: (row.column_default as string | null) ?? null,\n datetimePrecision: toNumberOrNull(row.datetime_precision),\n charMaxLength: toNumberOrNull(row.character_maximum_length),\n numericPrecision: toNumberOrNull(row.numeric_precision),\n numericScale: toNumberOrNull(row.numeric_scale),\n fullType: (row.full_type as string | null) ?? null,\n }));\n\n // Enums.\n const enums: EnumIR[] = [];\n {\n const valuesByName = new Map<string, string[]>();\n for (const row of enumRows) {\n const name = row.type_name as string;\n const list = valuesByName.get(name);\n if (list === undefined) valuesByName.set(name, [row.enum_value as string]);\n else list.push(row.enum_value as string);\n }\n for (const [name, values] of valuesByName) enums.push({ name, values });\n }\n const enumNames = new Set(enums.map((entry) => entry.name));\n\n // Constraints → PKs, single-column uniques, multi-column uniques.\n const pkByTable = new Map<string, string[]>();\n const pkNames = new Map<string, string>();\n const uniquesByConstraint = new Map<string, { table: string; columns: string[] }>();\n const constraintNames = new Set<string>();\n for (const row of constraintRows) {\n const table = row.table_name as string;\n const constraintName = row.constraint_name as string;\n const columnName = row.column_name as string;\n constraintNames.add(constraintName);\n if ((row.constraint_type as string) === \"PRIMARY KEY\") {\n pkNames.set(table, constraintName);\n const list = pkByTable.get(table);\n if (list === undefined) pkByTable.set(table, [columnName]);\n else list.push(columnName);\n } else {\n const entry = uniquesByConstraint.get(constraintName);\n if (entry === undefined) uniquesByConstraint.set(constraintName, { table, columns: [columnName] });\n else entry.columns.push(columnName);\n }\n }\n\n // CHECK constraints, grouped per table (name + inner expression).\n const checksByTable = new Map<string, CheckIR[]>();\n for (const row of checkRows) {\n const table = row.table_name as string;\n const name = row.constraint_name as string;\n const expression = stripCheckDefinition({ definition: String(row.definition ?? \"\") });\n const list = checksByTable.get(table);\n if (list === undefined) checksByTable.set(table, [{ name, expression, catalogExpression: true }]);\n else list.push({ name, expression, catalogExpression: true });\n }\n\n // FK groups (composite support — actions live on the constraint).\n type MutableFkGroup = {\n constraintName: string;\n table: string;\n columns: string[];\n refTable: string;\n refColumns: string[];\n onDelete: FkGroup[\"onDelete\"];\n onUpdate: FkGroup[\"onUpdate\"];\n };\n const fkGroupsByName = new Map<string, MutableFkGroup>();\n for (const row of fkRows) {\n const constraintName = row.constraint_name as string;\n const key = JSON.stringify([row.table_name, constraintName]);\n const existing = fkGroupsByName.get(key);\n if (existing === undefined) {\n fkGroupsByName.set(key, {\n constraintName,\n table: row.table_name as string,\n columns: [row.column_name as string],\n refTable: row.foreign_table_name as string,\n refColumns: [row.foreign_column_name as string],\n onDelete: PG_CHAR_TO_CASCADE_ACTION[(row.on_delete_char as string) ?? \"a\"] ?? \"NoAction\",\n onUpdate: PG_CHAR_TO_CASCADE_ACTION[(row.on_update_char as string) ?? \"a\"] ?? \"NoAction\",\n });\n } else {\n existing.columns.push(row.column_name as string);\n existing.refColumns.push(row.foreign_column_name as string);\n }\n }\n const fkGroups: FkGroup[] = [...fkGroupsByName.values()].map((group) => ({\n ...group,\n required: group.columns.every((columnName) => {\n const column = columns.find((c) => c.table === group.table && c.name === columnName);\n return column === undefined ? true : !column.nullable;\n }),\n }));\n\n // Indexes (parsed from indexdef).\n const indexes: IntrospectedIndex[] = [];\n for (const row of indexRows) {\n // Exclusions own their index. They are never independent DROP INDEX targets.\n if (row.backing_constraint_type === \"x\") continue;\n const parsed = parseIndexDef({\n table: row.table_name as string,\n name: row.index_name as string,\n def: row.index_def as string,\n });\n if (parsed !== null) indexes.push(parsed);\n }\n\n // Implicit join tables (the shared structural rule).\n const joinTables = new Map<string, JoinTableInfo>();\n for (const table of tables) {\n if (!table.startsWith(\"_\")) continue;\n const tableFks = fkRows.filter((row) => row.table_name === table);\n const tableIndexes = indexRows.filter((row) => row.table_name === table);\n if (pkByTable.has(table) || (checksByTable.get(table)?.length ?? 0) > 0 || exclusionRows.some((row) => row.table_name === table)) continue;\n if (!tableFks.every((row) => row.validated === true && row.deferrable === false && row.triggers_enabled === true)) continue;\n if (tableIndexes.length !== 2 || !tableIndexes.every((row) => row.valid === true && row.ready === true && row.immediate === true && row.plain_columns === true && typeof row.key_count === \"number\" && row.key_count === row.attribute_count)) continue;\n if (tableFks.some((row) => {\n const source = columnRows.find((column) => column.table_name === table && column.column_name === row.column_name);\n const target = columnRows.find((column) => column.table_name === row.foreign_table_name && column.column_name === row.foreign_column_name);\n return source === undefined || target === undefined || typeof source.full_type !== \"string\" || source.full_type.length === 0 || source.full_type !== target.full_type\n || source.column_default !== null || source.is_identity !== \"NO\" || source.is_generated !== \"NEVER\" || source.is_nullable !== \"NO\"\n || source.collation_name === undefined || source.collation_name !== target.collation_name;\n })) continue;\n const detected = detectJoinTable({\n table,\n columnNames: columns.filter((column) => column.table === table).map((column) => column.name),\n fkGroups,\n indexes,\n });\n if (detected !== null) joinTables.set(table, detected);\n }\n\n // Models.\n const models: ModelIR[] = [];\n for (const table of tables) {\n if (joinTables.has(table)) continue;\n models.push(\n buildModel({\n table,\n isView: false,\n columns,\n pkByTable,\n pkNames,\n uniquesByConstraint,\n constraintNames,\n indexes,\n enumNames,\n exclusions: exclusionRows.filter((row) => row.table_name === table).map((row) => ({ name: String(row.constraint_name), definition: String(row.definition), requiredExtensions: [], catalogDefinition: true as const })),\n checks: checksByTable.get(table) ?? [],\n }),\n );\n }\n for (const view of views) {\n models.push(\n buildModel({\n table: view,\n isView: true,\n columns,\n pkByTable,\n pkNames,\n uniquesByConstraint,\n constraintNames,\n indexes: [],\n enumNames,\n checks: [],\n }),\n );\n }\n\n // Relations: FK side + inverse list side, then implicit M2M list sides.\n addFkRelations({ models, fkGroups, joinTables });\n addJoinTableRelations({ models, joinTables });\n\n const resolved = await resolvePostgresTypeIdentities({ executor, mode: \"catalog\", schema: {\n datasource: { provider: \"postgresql\" }, models, enums, extensions: [],\n } });\n if (resolved.unavailable.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"PostgreSQL column type identity could not be read\", meta: { reason: \"type-inspection-unavailable\", columns: resolved.unavailable } });\n return resolved.schema;\n}\n\n// ─── Model building ───────────────────────────────────────────────\n\nfunction buildModel(params: {\n table: string;\n isView: boolean;\n columns: readonly ColumnRow[];\n pkByTable: ReadonlyMap<string, string[]>;\n pkNames: ReadonlyMap<string, string>;\n uniquesByConstraint: ReadonlyMap<string, { table: string; columns: string[] }>;\n constraintNames: ReadonlySet<string>;\n indexes: readonly IntrospectedIndex[];\n enumNames: ReadonlySet<string>;\n exclusions?: ModelIR[\"exclusions\"];\n checks: readonly CheckIR[];\n}): ModelIR {\n const { table, isView, columns, pkByTable, uniquesByConstraint, constraintNames, indexes, enumNames } =\n params;\n\n const tableColumns = columns.filter((column) => column.table === table);\n const pk = pkByTable.get(table) ?? [];\n\n // Single-column uniqueness (constraints + unique indexes) → field.isUnique.\n const uniqueSingles = new Set<string>();\n const multiUniques: { name: string; columns: string[] }[] = [];\n for (const [name, unique] of uniquesByConstraint) {\n if (unique.table !== table) continue;\n if (unique.columns.length === 1) uniqueSingles.add(unique.columns[0] as string);\n multiUniques.push({ name, columns: unique.columns });\n }\n const tableIndexes = indexes.filter(\n (index) => index.table === table && !constraintNames.has(index.name),\n );\n for (const index of tableIndexes) {\n if (!index.unique) continue;\n // A partial or NULLS-NOT-DISTINCT unique is NOT a plain field @unique —\n // folding it would drop the predicate/flag and make every diff recreate\n // the index. Those stay model-level indexes below.\n if (index.columns.length === 1 && index.where === undefined && index.nullsNotDistinct !== true) {\n uniqueSingles.add((index.columns[0] as { name: string }).name);\n }\n }\n\n const fields: FieldIR[] = tableColumns.map((column) =>\n buildField({ column, pk, uniqueSingles, enumNames }),\n );\n\n // Indexes: multi-column unique constraints + all non-constraint indexes\n // (single-column uniques were folded into the fields above).\n const modelIndexes: IndexIR[] = [];\n for (const unique of multiUniques) {\n modelIndexes.push({\n name: unique.name,\n constraintName: unique.name,\n kind: \"unique\",\n fields: unique.columns.map((name) => ({ name })),\n });\n }\n for (const index of tableIndexes) {\n if (\n index.unique &&\n index.columns.length === 1 &&\n index.where === undefined &&\n index.nullsNotDistinct !== true &&\n index.name === `${table}_${index.columns[0]!.name}_key`\n ) {\n continue; // folded into field.isUnique above\n }\n modelIndexes.push({\n name: index.name,\n kind: index.unique ? \"unique\" : index.kind,\n fields: index.columns.map((column) => ({\n name: column.name,\n ...(column.desc ? { sort: \"desc\" as const } : {}),\n })),\n ...(index.where === undefined ? {} : { where: index.where }),\n ...(index.nullsNotDistinct === true ? { nullsNotDistinct: true } : {}),\n });\n }\n\n return {\n name: table,\n fields,\n relations: [],\n indexes: modelIndexes,\n ...(params.exclusions?.length ? { exclusions: params.exclusions } : {}),\n ...(params.checks.length === 0 ? {} : { checks: params.checks }),\n isView,\n ...(pk.length > 1 ? { primaryKey: { fields: pk } } : {}),\n ...(params.pkNames.get(table) === undefined ? {} : { primaryKeyConstraintName: params.pkNames.get(table)! }),\n };\n}\n\n/** `pg_get_constraintdef` → the inner expression: `CHECK ((amount >= 0))` → `(amount >= 0)`. */\nfunction stripCheckDefinition(params: { definition: string }): string {\n const trimmed = params.definition.trim();\n const match = trimmed.match(/^CHECK\\s*\\((.*)\\)$/is);\n return match === null ? trimmed : (match[1] as string).trim();\n}\n\nfunction buildField(params: {\n column: ColumnRow;\n pk: readonly string[];\n uniqueSingles: ReadonlySet<string>;\n enumNames: ReadonlySet<string>;\n}): FieldIR {\n const { column, pk, uniqueSingles, enumNames } = params;\n const mapped = reverseMapType({ column, enumNames });\n const isId = pk.length === 1 && pk[0] === column.name;\n const defaultValue = parseColumnDefault({ column, mapped });\n\n return {\n name: column.name,\n type: mapped.type,\n isList: mapped.isList,\n isOptional: column.nullable,\n isId,\n isUnique: uniqueSingles.has(column.name),\n isUpdatedAt: false,\n ...(defaultValue === undefined ? {} : { default: defaultValue }),\n ...(mapped.nativeType === undefined ? {} : { nativeType: mapped.nativeType }),\n ...(mapped.isUnsupported === true ? { isUnsupported: true as const } : {}),\n };\n}\n\n// ─── Reverse type mapping (dialect-matrix §2, reversed) ───────────\n\ntype MappedType = {\n type: FieldType;\n isList: boolean;\n nativeType?: string;\n isUnsupported?: true;\n};\n\n/** udt_name → canonical scalar for types that ARE the canonical mapping. */\nconst CANONICAL_UDT: Readonly<Record<string, ScalarType>> = {\n text: \"String\",\n bool: \"Boolean\",\n int4: \"Int\",\n int8: \"BigInt\",\n float8: \"Float\",\n numeric: \"Decimal\",\n timestamptz: \"DateTime\",\n jsonb: \"Json\",\n bytea: \"Bytes\",\n};\n\n/** udt_name → scalar for non-canonical types (nativeType carries the truth). */\nconst NON_CANONICAL_UDT: Readonly<Record<string, ScalarType>> = {\n varchar: \"String\",\n bpchar: \"String\",\n uuid: \"String\",\n int2: \"Int\",\n float4: \"Float\",\n timestamp: \"DateTime\",\n date: \"DateTime\",\n json: \"Json\",\n};\n\nfunction reverseMapType(params: { column: ColumnRow; enumNames: ReadonlySet<string> }): MappedType {\n const { column, enumNames } = params;\n const isList = column.dataType === \"ARRAY\";\n const udt = isList ? column.udtName.replace(/^_/, \"\") : column.udtName;\n\n // Enum (scalar or array — the LEARNINGS `_EnumName` lesson).\n if (enumNames.has(udt)) {\n return { type: { enum: udt }, isList };\n }\n\n const canonical = CANONICAL_UDT[udt];\n if (canonical !== undefined) {\n const nativeType = nonCanonicalModifier({ column, udt, scalar: canonical });\n return { type: canonical, isList, ...(nativeType === undefined ? {} : { nativeType }) };\n }\n\n const nonCanonical = NON_CANONICAL_UDT[udt];\n if (nonCanonical !== undefined) {\n return { type: nonCanonical, isList, nativeType: withModifier({ column, udt }) };\n }\n\n // Unknown type → unsupported column, raw type preserved (F3: keep, don't\n // drop). `format_type` keeps modifiers (`vector(3)`), so an extension-lowered\n // column round-trips diff-clean against its declared native type.\n const raw = column.fullType ?? udt;\n return {\n type: \"String\",\n isList: false,\n nativeType: isList && !raw.endsWith(\"[]\") ? `${raw}[]` : raw,\n isUnsupported: true,\n };\n}\n\n/**\n * For canonical base types, return a nativeType only when a modifier makes the\n * column diverge from the canonical mapping (timestamptz(3), numeric(10,2)).\n * Bare `timestamptz` is the canonical DateTime mapping and postgres reports\n * its default precision as 6, so precision 6 (or none) means \"no override\";\n * every other precision is carried truthfully — the differ's equivalence\n * class, not this function, decides that timestamptz(3) needs no ALTER.\n */\nfunction nonCanonicalModifier(params: {\n column: ColumnRow;\n udt: string;\n scalar: ScalarType;\n}): string | undefined {\n const { column, udt, scalar } = params;\n // information_schema omits element modifiers on arrays; format_type keeps them.\n if (column.dataType === \"ARRAY\" && column.fullType !== null) {\n const element = normalizeNativeType({ raw: column.fullType }).replace(/\\[\\]$/, \"\");\n if (/^(numeric|timestamptz)\\([\\d,]+\\)$/.test(element)) return element;\n }\n if (scalar === \"DateTime\" && udt === \"timestamptz\") {\n const precision = column.datetimePrecision;\n return precision === null || precision === 6 ? undefined : `timestamptz(${precision})`;\n }\n if (scalar === \"Decimal\" && udt === \"numeric\") {\n if (column.numericPrecision === null) return undefined;\n const scale = column.numericScale ?? 0;\n return `numeric(${column.numericPrecision},${scale})`;\n }\n return undefined;\n}\n\n/** Render `udt(modifier)` for non-canonical types that carry one. */\nfunction withModifier(params: { column: ColumnRow; udt: string }): string {\n const { column, udt } = params;\n // information_schema omits character_maximum_length for varchar arrays.\n // format_type preserves the element typmod; keep it so push/pull converges.\n if (udt === \"varchar\" && column.dataType === \"ARRAY\" && column.fullType !== null) {\n const elementType = normalizeNativeType({ raw: column.fullType }).replace(/\\[\\]$/, \"\");\n if (/^varchar\\(\\d+\\)$/.test(elementType)) return elementType;\n }\n if ((udt === \"varchar\" || udt === \"bpchar\") && column.charMaxLength !== null) {\n return `${udt === \"bpchar\" ? \"char\" : \"varchar\"}(${column.charMaxLength})`;\n }\n if (udt === \"bpchar\") return \"char\";\n if (udt === \"timestamp\" && column.datetimePrecision !== null && column.datetimePrecision !== 6) {\n return `timestamp(${column.datetimePrecision})`;\n }\n return udt;\n}\n\n// ─── Default parsing ──────────────────────────────────────────────\n\nfunction parseColumnDefault(params: {\n column: ColumnRow;\n mapped: MappedType;\n}): DefaultValueIR | undefined {\n const { column, mapped } = params;\n\n if (column.identity) return { kind: \"autoincrement\" };\n\n const raw = column.columnDefault;\n if (raw === null) return undefined;\n if (raw.startsWith(\"NULL::\")) return undefined;\n\n if (/^nextval\\('(?:[^']|'')*'::regclass\\)$/.test(raw)) return { kind: \"autoincrement\" };\n if (raw === \"now()\" || raw.startsWith(\"CURRENT_TIMESTAMP\")) return { kind: \"now\" };\n if (raw === \"true\" || raw === \"false\") return { kind: \"literal\", value: raw === \"true\" };\n if (/^-?\\d+(\\.\\d+)?$/.test(raw)) return { kind: \"literal\", value: /^-?\\d+$/.test(raw) ? exactIntegerLiteral({ text: raw }) : Number(raw) };\n\n // 'value' or 'value'::type — embedded quotes arrive doubled.\n const quoted = raw.match(/^'((?:[^']|'')*)'(::.*)?$/);\n if (quoted !== null) {\n const value = (quoted[1] as string).replaceAll(\"''\", \"'\");\n if (mapped.isList) {\n const elements = parsePgArrayLiteral({ literal: value });\n if (elements !== null && !elements.includes(null)) {\n const decoded = elements.map((entry) => mapped.type === \"Boolean\" ? entry === \"t\" || entry === \"true\" :\n mapped.type === \"Int\" || mapped.type === \"Float\" ? Number(entry) : entry);\n return { kind: \"list\", values: scalarListDefault({ type: mapped.type, values: decoded }) };\n }\n return { kind: \"dbgenerated\", sql: raw };\n }\n if (typeof mapped.type === \"object\") return { kind: \"enumValue\", value };\n if (isNumericScalar({ type: mapped.type }) && /^-?\\d+(\\.\\d+)?$/.test(value)) {\n return { kind: \"literal\", value: /^-?\\d+$/.test(value) ? exactIntegerLiteral({ text: value }) : Number(value) };\n }\n // A cast to a non-string type (e.g. '{}'::text[]) is not a plain literal.\n const cast = quoted[2];\n if (cast !== undefined && cast !== \"\" && mapped.isList) {\n return { kind: \"dbgenerated\", sql: raw };\n }\n return { kind: \"literal\", value };\n }\n\n return { kind: \"dbgenerated\", sql: raw };\n}\n\n// ─── Index parsing ────────────────────────────────────────────────\n\n/**\n * Parse a `pg_indexes.indexdef` line:\n * `CREATE [UNIQUE] INDEX name ON schema.table USING method (cols) [WHERE pred]`.\n * The column list is scanned with balanced parentheses (expressions like\n * `lower(email)` and `WHERE` predicates both contain parens, so a regex over\n * the whole line cannot split them). Returns null for definitions that don't\n * match — never expected from pg.\n */\nfunction parseIndexDef(params: {\n table: string;\n name: string;\n def: string;\n}): IntrospectedIndex | null {\n const { table, name, def } = params;\n const head = def.match(/^CREATE (UNIQUE )?INDEX .*? USING (\\w+) \\(/);\n if (head === null) return null;\n\n // Scan the balanced column list starting right after the opening paren.\n const start = (head.index ?? 0) + head[0].length;\n let depth = 1;\n let end = -1;\n for (let position = start; position < def.length; position += 1) {\n const char = def[position];\n if (char === \"(\") depth += 1;\n else if (char === \")\") {\n depth -= 1;\n if (depth === 0) {\n end = position;\n break;\n }\n }\n }\n if (end === -1) return null;\n\n const columns = splitTopLevel({ text: def.slice(start, end) }).map((entry) => {\n const trimmed = entry.trim();\n const desc = / DESC$/i.test(trimmed);\n const nameOnly = trimmed.replace(/ (DESC|ASC)( NULLS (FIRST|LAST))?$/i, \"\");\n return { name: nameOnly.replaceAll('\"', \"\"), desc };\n });\n\n const tail = def.slice(end + 1).trim();\n // INCLUDE, storage options and TABLESPACE can precede WHERE. Only top-level\n // keywords count: an included column named \"WHERE\" is not a predicate.\n let nullsNotDistinct = false;\n let whereRaw: string | undefined;\n let tailDepth = 0;\n let quote: string | undefined;\n for (let position = 0; position < tail.length; position += 1) {\n const char = tail[position]!;\n if (quote !== undefined) {\n if (char === quote) {\n if (tail[position + 1] === quote) position += 1;\n else quote = undefined;\n }\n continue;\n }\n if (char === '\"' || char === \"'\") { quote = char; continue; }\n if (char === \"(\") { tailDepth += 1; continue; }\n if (char === \")\") { tailDepth -= 1; continue; }\n if (tailDepth !== 0 || (position > 0 && !/\\s/.test(tail[position - 1]!))) continue;\n const rest = tail.slice(position);\n if (/^NULLS NOT DISTINCT\\b/i.test(rest)) nullsNotDistinct = true;\n const where = rest.match(/^WHERE\\s+/i);\n if (where !== null) { whereRaw = rest.slice(where[0].length); break; }\n }\n return {\n table,\n name,\n unique: head[1] !== undefined,\n kind: (head[2] as string).toLowerCase(),\n columns,\n ...(whereRaw === undefined ? {} : { where: whereRaw }),\n ...(nullsNotDistinct ? { nullsNotDistinct: true } : {}),\n };\n}\n\n/** Split a parenthesized column list on top-level commas only. */\nfunction splitTopLevel(params: { text: string }): string[] {\n const { text } = params;\n const parts: string[] = [];\n let depth = 0;\n let current = \"\";\n for (const char of text) {\n if (char === \"(\") depth += 1;\n if (char === \")\") depth -= 1;\n if (char === \",\" && depth === 0) {\n parts.push(current);\n current = \"\";\n continue;\n }\n current += char;\n }\n if (current.trim().length > 0) parts.push(current);\n return parts;\n}\n\nfunction toNumberOrNull(value: unknown): number | null {\n if (value === null || value === undefined) return null;\n const parsed = Number(value);\n return Number.isNaN(parsed) ? null : parsed;\n}\n",
|
|
21
22
|
"/**\n * The bookkeeping table's name, alone in a leaf module.\n *\n * It used to live in runner.ts, which the three introspectors import while\n * runner.ts is itself importing THEM — a cycle whose outcome depended on which\n * module the process happened to evaluate first, and which surfaced as\n * \"Cannot access 'MIGRATIONS_TABLE_NAME' before initialization\" as soon as the\n * import order shifted. A leaf module has no such ordering: it can be\n * evaluated before anything that needs it.\n *\n * runner.ts re-exports the name, so the public surface is unchanged.\n */\n\n/** Name of the migrations bookkeeping table (skipped by introspection). */\nexport const MIGRATIONS_TABLE_NAME: string = \"_vibe_migrations\";\n",
|
|
22
23
|
"/**\n * Introspection helpers shared by ALL dialect introspectors — the join-table\n * detection rule and the relation/naming conventions live HERE, once\n * (LEARNINGS: implicit-M2M conventions must never be re-implemented per\n * consumer). Every dialect introspector produces the same representation:\n *\n * - FKs become an UNNAMED `manyToOne` on the owning model plus an UNNAMED\n * `oneToMany` list side on the target — EXCEPT when the model pair carries\n * more than one unnamed relation pair (mutual FKs, twin FKs to one target,\n * an FK alongside a default-named join table): those FK pairs get a\n * synthesized `@relation` name so `db pull` output re-parses (the parser\n * rejects the unnamed shape as `ambiguous-relation`) and implicit-M2M\n * detection keeps its name keys unique.\n * - Only canonical implicit join tables are compressed: required A/B columns,\n * cascading single-column FKs to primary keys, an unfiltered AB unique index\n * and the B lookup index, with no extra indexes. Noncanonical shapes remain\n * explicit models or refuse when compression cannot preserve their keys.\n */\n\nimport { VibeError } from \"@vibeorm/schema\";\nimport type { CascadeAction, ModelIR, RelationIR } from \"@vibeorm/schema\";\n\n// ─── Shared shapes ────────────────────────────────────────────────\n\n/** A grouped foreign key (composite-capable), dialect-independent. */\nexport type FkGroup = {\n readonly constraintName: string;\n readonly table: string;\n readonly columns: readonly string[];\n readonly refTable: string;\n readonly refColumns: readonly string[];\n readonly onDelete: CascadeAction;\n readonly onUpdate: CascadeAction;\n /** Every FK column NOT NULL (drives isOptional on the relation). */\n readonly required: boolean;\n};\n\n/** An introspected index in the shape join-table detection needs. */\nexport type IntrospectedIndex = {\n readonly table: string;\n readonly name: string;\n readonly unique: boolean;\n readonly kind: string;\n readonly columns: readonly { readonly name: string; readonly desc: boolean }[];\n readonly where?: string;\n /** `UNIQUE NULLS NOT DISTINCT` (postgres 15+). */\n readonly nullsNotDistinct?: boolean;\n};\n\n/** A detected physical join table. */\nexport type JoinTableInfo = {\n readonly tableA: string;\n readonly tableB: string;\n readonly relationName?: string;\n};\n\n// ─── Join-table detection (THE structural rule) ───────────────────\n\n/**\n * Detect whether a physical table is an implicit many-to-many join table:\n * Name and index/FK structure must match the renderer's canonical shape.\n * Referenced primary keys are checked later, once target models exist.\n * Callers remain responsible for refusing unrepresented catalog guarantees.\n */\nexport function detectJoinTable(params: {\n table: string;\n columnNames: readonly string[];\n fkGroups: readonly FkGroup[];\n indexes: readonly IntrospectedIndex[];\n}): JoinTableInfo | null {\n const { table, columnNames, fkGroups, indexes } = params;\n if (!table.startsWith(\"_\")) return null;\n\n const names = [...columnNames].sort();\n if (names.length !== 2 || names[0] !== \"A\" || names[1] !== \"B\") return null;\n\n const tableFks = fkGroups.filter((group) => group.table === table);\n if (tableFks.length !== 2) return null;\n const fkA = tableFks.find((group) => group.columns.length === 1 && group.columns[0] === \"A\");\n const fkB = tableFks.find((group) => group.columns.length === 1 && group.columns[0] === \"B\");\n if (fkA === undefined || fkB === undefined) return null;\n if (fkA.refTable > fkB.refTable || tableFks.some((fk) => !fk.required || fk.onDelete !== \"Cascade\" || fk.onUpdate !== \"Cascade\")) return null;\n\n const tableIndexes = indexes.filter((index) => index.table === table);\n const canonicalAb = (index: IntrospectedIndex): boolean => index.unique && index.kind === \"btree\" && index.where === undefined && index.nullsNotDistinct !== true && index.columns.length === 2 && index.columns[0]?.name === \"A\" && index.columns[1]?.name === \"B\" && index.columns.every((column) => !column.desc);\n const canonicalB = (index: IntrospectedIndex): boolean => !index.unique && index.kind === \"btree\" && index.where === undefined && index.columns.length === 1 && index.columns[0]?.name === \"B\" && !index.columns[0].desc;\n if (tableIndexes.length !== 2 || tableIndexes.filter(canonicalAb).length !== 1 || tableIndexes.filter(canonicalB).length !== 1) return null;\n\n const sorted = [fkA.refTable, fkB.refTable].sort();\n const defaultName = `_${sorted[0]}To${sorted[1]}`;\n return {\n tableA: fkA.refTable,\n tableB: fkB.refTable,\n ...(table === defaultName ? {} : { relationName: table.slice(1) }),\n };\n}\n\n// ─── Relation building ────────────────────────────────────────────\n\n/** Add manyToOne + inverse oneToMany relation pairs for every FK group. */\nexport function addFkRelations(params: {\n models: ModelIR[];\n fkGroups: readonly FkGroup[];\n joinTables: ReadonlyMap<string, JoinTableInfo>;\n}): void {\n const { models, fkGroups, joinTables } = params;\n const modelsByName = new Map(models.map((model) => [model.name, model]));\n // Detection happens before models exist. Verify the endpoint keys here,\n // before a compressed result can escape any dialect introspector.\n for (const [table] of joinTables) for (const fk of fkGroups.filter((group) => group.table === table)) {\n const target = modelsByName.get(fk.refTable);\n const primary = target?.primaryKey?.fields ?? target?.fields.filter((field) => field.isId).map((field) => field.name) ?? [];\n const columns = primary.map((name) => target?.fields.find((field) => field.name === name)?.dbName ?? name);\n if (columns.length !== 1 || fk.refColumns.length !== 1 || columns[0] !== fk.refColumns[0]) throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: `Join table \"${table}\" does not reference the single-column primary key of \"${fk.refTable}\"; automatic join compression is unavailable`, meta: { feature: \"implicitJoinReferencedKey\", table, target: fk.refTable } });\n }\n const relationsByModel = new Map<string, RelationIR[]>();\n const takeName = nameAllocator({ models });\n const ambiguousPairs = detectAmbiguousPairs({ fkGroups, joinTables, modelsByName });\n\n for (const group of fkGroups) {\n if (joinTables.has(group.table)) continue;\n const owner = modelsByName.get(group.table);\n const target = modelsByName.get(group.refTable);\n if (owner === undefined || target === undefined) continue;\n\n // Prisma's pull convention: `<Table>_<col[_col]>To<RefTable>`, carried by\n // BOTH sides so they pair back deterministically on re-parse.\n const relationName = ambiguousPairs.has(modelPairKey({ a: group.table, b: group.refTable }))\n ? `${group.table}_${group.columns.join(\"_\")}To${group.refTable}`\n : undefined;\n\n const fkSide: RelationIR = {\n name: takeName({ model: owner.name, base: lowerFirst(group.refTable) }),\n model: owner.name,\n targetModel: group.refTable,\n type: \"manyToOne\",\n fields: group.columns,\n references: group.refColumns,\n constraintName: group.constraintName,\n onDelete: group.onDelete,\n onUpdate: group.onUpdate,\n isList: false,\n isOptional: !group.required,\n ...(relationName === undefined ? {} : { relationName }),\n };\n pushRelation({ relationsByModel, relation: fkSide });\n\n const listSide: RelationIR = {\n name: takeName({ model: target.name, base: lowerFirst(group.table) }),\n model: target.name,\n targetModel: group.table,\n type: \"oneToMany\",\n isList: true,\n isOptional: false,\n ...(relationName === undefined ? {} : { relationName }),\n };\n pushRelation({ relationsByModel, relation: listSide });\n }\n\n applyRelations({ models, relationsByModel });\n}\n\n/** Add the two unnamed oneToMany list sides for every detected join table. */\nexport function addJoinTableRelations(params: {\n models: ModelIR[];\n joinTables: ReadonlyMap<string, JoinTableInfo>;\n}): void {\n const { models, joinTables } = params;\n const modelsByName = new Map(models.map((model) => [model.name, model]));\n const relationsByModel = new Map<string, RelationIR[]>();\n const takeName = nameAllocator({ models });\n\n for (const [, joinTable] of joinTables) {\n const modelA = modelsByName.get(joinTable.tableA);\n const modelB = modelsByName.get(joinTable.tableB);\n if (modelA === undefined || modelB === undefined) continue;\n\n const shared = joinTable.relationName;\n pushRelation({\n relationsByModel,\n relation: {\n name: takeName({ model: modelA.name, base: lowerFirst(modelB.name) }),\n model: modelA.name,\n targetModel: modelB.name,\n type: \"oneToMany\",\n isList: true,\n isOptional: false,\n ...(shared === undefined ? {} : { relationName: shared }),\n },\n });\n pushRelation({\n relationsByModel,\n relation: {\n name: takeName({ model: modelB.name, base: lowerFirst(modelA.name) }),\n model: modelB.name,\n targetModel: modelA.name,\n type: \"oneToMany\",\n isList: true,\n isOptional: false,\n ...(shared === undefined ? {} : { relationName: shared }),\n },\n });\n }\n\n applyRelations({ models, relationsByModel });\n}\n\n// ─── Disambiguation ──────────────────────────────────────\n\n/** Collision-free key for an UNORDERED model pair (self-pairs included). */\nfunction modelPairKey(params: { a: string; b: string }): string {\n const { a, b } = params;\n return [a, b].sort().join(\"\\u0000\");\n}\n\n/**\n * Model pairs whose introspected relations would be ambiguous if every side\n * stayed unnamed: more than one unnamed relation pair between the same two\n * models — mutual FKs, twin FKs to one target, two self-FKs, or an FK\n * alongside a default-named join table. The parser rejects that shape as\n * `ambiguous-relation` (so `db pull` output would not re-parse), and migrate's\n * sole-counterpart M2M rule refuses to pair inside it (so a REAL join table\n * next to an FK would stop round-tripping). FK pairs on these model pairs get\n * synthesized names; join-table sides never do — their physical table name IS\n * their name, so the FK pairs yield.\n */\nfunction detectAmbiguousPairs(params: {\n fkGroups: readonly FkGroup[];\n joinTables: ReadonlyMap<string, JoinTableInfo>;\n modelsByName: ReadonlyMap<string, ModelIR>;\n}): ReadonlySet<string> {\n const { fkGroups, joinTables, modelsByName } = params;\n const counts = new Map<string, number>();\n const bump = (key: string): void => {\n counts.set(key, (counts.get(key) ?? 0) + 1);\n };\n for (const group of fkGroups) {\n if (joinTables.has(group.table)) continue;\n if (!modelsByName.has(group.table) || !modelsByName.has(group.refTable)) continue;\n bump(modelPairKey({ a: group.table, b: group.refTable }));\n }\n for (const [, joinTable] of joinTables) {\n if (joinTable.relationName !== undefined) continue;\n bump(modelPairKey({ a: joinTable.tableA, b: joinTable.tableB }));\n }\n return new Set(\n [...counts.entries()].filter(([, count]) => count > 1).map(([key]) => key),\n );\n}\n\n// ─── Internals ────────────────────────────────────────────────────\n\nfunction pushRelation(params: {\n relationsByModel: Map<string, RelationIR[]>;\n relation: RelationIR;\n}): void {\n const { relationsByModel, relation } = params;\n const list = relationsByModel.get(relation.model);\n if (list === undefined) relationsByModel.set(relation.model, [relation]);\n else list.push(relation);\n}\n\nfunction applyRelations(params: {\n models: ModelIR[];\n relationsByModel: ReadonlyMap<string, RelationIR[]>;\n}): void {\n const { models, relationsByModel } = params;\n for (let index = 0; index < models.length; index += 1) {\n const model = models[index] as ModelIR;\n const additions = relationsByModel.get(model.name);\n if (additions === undefined) continue;\n models[index] = { ...model, relations: [...model.relations, ...additions] };\n }\n}\n\n/** Allocate relation names unique per model AND clashing with no column name. */\nfunction nameAllocator(params: {\n models: readonly ModelIR[];\n}): (args: { model: string; base: string }) => string {\n const { models } = params;\n const used = new Map<string, Set<string>>();\n for (const model of models) {\n used.set(\n model.name,\n new Set([\n ...model.fields.map((field) => field.name),\n ...model.relations.map((relation) => relation.name),\n ]),\n );\n }\n return ({ model, base }) => {\n const names = used.get(model) ?? new Set<string>();\n used.set(model, names);\n let candidate = base;\n let suffix = 2;\n while (names.has(candidate)) {\n candidate = `${base}_${suffix}`;\n suffix += 1;\n }\n names.add(candidate);\n return candidate;\n };\n}\n\n/** Lower-case the first character (relation field names from table names). */\nexport function lowerFirst(value: string): string {\n return value.charAt(0).toLowerCase() + value.slice(1);\n}\n",
|
|
24
|
+
"import { VibeError } from \"@vibeorm/schema\";\nimport type { FieldIR, SchemaIR, SqlObjectIdentity } from \"@vibeorm/schema\";\nimport { postgresDialect, renderPostgresTypeIdentity } from \"@vibeorm/sql\";\nimport { parseUnsupportedPostgresType } from \"./postgres-types.ts\";\nimport type { SqlExecutor } from \"./types.ts\";\n\n/** Resolved migration fields and columns whose authored identity cannot be proven. */\nexport type PostgresTypeResolution = { readonly schema: SchemaIR; readonly unavailable: readonly SqlObjectIdentity[] };\n\n/** Resolve only from explicit names, independent evidence, or PostgreSQL's system catalog. */\nexport async function resolvePostgresTypeIdentities(params: {\n executor: SqlExecutor;\n schema: SchemaIR;\n previous?: SchemaIR;\n mode: \"catalog\" | \"reference\" | \"verify\";\n}): Promise<PostgresTypeResolution> {\n const unavailable: SqlObjectIdentity[] = [];\n const models = [];\n for (const model of params.schema.models) {\n const table = { namespace: \"public\", name: model.dbName ?? model.name };\n const previous = params.previous?.models.find((entry) => (entry.dbName ?? entry.name) === table.name);\n const fields: FieldIR[] = [];\n for (const field of model.fields) {\n if (field.isUnsupported !== true) { fields.push(field); continue; }\n const column = field.dbName ?? field.name;\n const parsed = parseUnsupportedPostgresType({ raw: field.nativeType ?? \"\" });\n const evidence = field.nativeTypeIdentity;\n if (evidence !== undefined && (evidence.source !== field.nativeType || (parsed?.namespace !== undefined && parsed.namespace !== evidence.namespace))) {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"PostgreSQL type evidence no longer matches its declaration; recapture the independent reference\", meta: { reason: \"type-reference-invalid\", shadowReusable: true, table: table.name, column } });\n }\n const prior = previous?.fields.find((entry) => (entry.dbName ?? entry.name) === column && entry.isUnsupported === true);\n const priorType = parseUnsupportedPostgresType({ raw: prior?.nativeType ?? \"\" });\n const priorNamespace = prior?.nativeTypeIdentity?.source === prior?.nativeType ? prior?.nativeTypeIdentity?.namespace : priorType?.namespace;\n // Only carry the namespace of an unchanged base name. Modifiers and array\n // shape remain authored, so changing vector(1536) to vector(768) still diffs.\n let namespace = parsed?.namespace ?? evidence?.namespace ?? (priorType?.name === parsed?.name ? priorNamespace : undefined);\n if (params.mode === \"catalog\" || params.mode === \"reference\" || namespace === undefined) {\n const source = params.mode === \"catalog\" ? { table, column }\n : { type: { name: parsed?.name ?? \"\", ...(namespace === undefined && params.mode === \"reference\" ? {} : { namespace: namespace ?? \"pg_catalog\" }) } };\n const query = renderPostgresTypeIdentity({ dialect: postgresDialect, source });\n const rows = parsed === undefined && params.mode !== \"catalog\" ? [] : await params.executor({ text: query.text, values: [...query.values] }).then((rows) => rows, (cause: unknown): never => {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"PostgreSQL type identity inspection failed\", meta: { reason: \"type-inspection-unavailable\", table: table.name, column }, cause });\n });\n const resolved = rows.length === 1 ? rows[0] : undefined;\n namespace = typeof resolved?.namespace === \"string\" && (resolved.name === parsed?.name || parsed === undefined && params.mode === \"catalog\") ? resolved.namespace : undefined;\n }\n if (parsed === undefined && params.mode !== \"catalog\" || namespace === undefined || field.nativeType === undefined) {\n unavailable.push({ kind: \"column\", table, column });\n fields.push(field);\n } else {\n fields.push({ ...field, nativeTypeIdentity: { source: field.nativeType, namespace } });\n }\n }\n models.push({ ...model, fields });\n }\n return { schema: { ...params.schema, models }, unavailable };\n}\n",
|
|
23
25
|
"/** PostgreSQL catalog security facts and owner-side, server-deparsed policy comparison. */\nimport { VibeError, assertValidSchemaIR } from \"@vibeorm/schema\";\nimport type { ModelIR, RlsPolicyIR, SchemaIR } from \"@vibeorm/schema\";\nimport { NATIVE_RLS, postgresDialect, renderRlsPolicy } from \"@vibeorm/sql\";\nimport { isRlsProtected } from \"../ddl/rls.ts\";\nimport type { SqlExecutor } from \"../types.ts\";\n\n/** Catalog attributes are intentionally not represented as authored policy declarations. */\nexport type PostgresRlsPolicy = {\n readonly name: string;\n readonly command: string;\n readonly permissive: boolean;\n readonly roles: string;\n readonly using: string | null;\n readonly withCheck: string | null;\n readonly comment: string | null;\n};\n/** Every public ordinary/partitioned table, including tables with flags but no policies. */\nexport type PostgresRlsTable = {\n readonly table: string;\n readonly enabled: boolean;\n readonly force: boolean;\n readonly policies: readonly PostgresRlsPolicy[];\n};\n\nconst CATALOG_SQL = `SELECT c.relname AS table_name, c.relrowsecurity AS enabled,\n c.relforcerowsecurity AS force, p.polname AS policy_name, p.polcmd AS command,\n p.polpermissive AS permissive, p.polroles::text AS roles,\n pg_catalog.pg_get_expr(p.polqual, p.polrelid) AS using_expression,\n pg_catalog.pg_get_expr(p.polwithcheck, p.polrelid) AS check_expression,\n pg_catalog.obj_description(p.oid, 'pg_policy') AS comment\nFROM pg_catalog.pg_class c\nJOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\nLEFT JOIN pg_catalog.pg_policy p ON p.polrelid = c.oid\nWHERE n.nspname = 'public' AND c.relkind IN ('r', 'p')\nORDER BY c.relname, p.polname`;\nconst PROBE = \"vibeorm_probe\";\n\n/** Read both clauses and all structural attributes; callers pin search_path and transaction. */\nexport async function readPostgresRls(params: { executor: SqlExecutor }): Promise<PostgresRlsTable[]> {\n const rows = await params.executor({ text: CATALOG_SQL, values: [] });\n const tables = new Map<string, { table: string; enabled: boolean; force: boolean; policies: PostgresRlsPolicy[] }>();\n for (const row of rows) {\n const table = String(row.table_name);\n let state = tables.get(table);\n if (state === undefined) {\n state = { table, enabled: row.enabled === true, force: row.force === true, policies: [] };\n tables.set(table, state);\n }\n if (row.policy_name !== null && row.policy_name !== undefined) {\n state.policies.push({ name: String(row.policy_name), command: String(row.command), permissive: row.permissive === true, roles: String(row.roles), using: row.using_expression === null ? null : String(row.using_expression), withCheck: row.check_expression === null ? null : String(row.check_expression), comment: row.comment === null ? null : String(row.comment) });\n }\n }\n return [...tables.values()];\n}\n\nfunction conflict(params: { table: string; reason: \"rls-conflict\" | \"rls-unmanaged\" | \"rls-drift\"; attributes: readonly string[] }): never {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `Native RLS on public.${params.table} cannot be managed safely (${params.attributes.join(\", \")}). Review the live policies and restore the deployed declaration, or remove conflicting policies explicitly with administrator credentials. Supply rlsSchema/previousSchema for the deployed policy; no policy is deleted or adopted automatically.`,\n meta: params,\n });\n}\n\n/**\n * Compare against a trusted deployed declaration, not a policy name/comment/hash.\n * An explicit previousSchema/status check requires every declared policy to exist.\n * Push without a previous schema permits installing protection on an ordinary table.\n * Must run inside the caller's transaction. Locks survive the rolled-back probe.\n */\nexport async function verifyPostgresRls(params: {\n executor: SqlExecutor;\n schema?: SchemaIR;\n requireInstalled?: boolean;\n}): Promise<ReadonlySet<string>> {\n const { executor, schema } = params;\n if (schema !== undefined && schema.rls !== undefined) assertValidSchemaIR({ schema });\n await executor({ text: \"SET LOCAL search_path = ''\" });\n const declared = new Map((schema?.models ?? []).map((model) => [model.dbName ?? model.name, model]));\n let tables = await readPostgresRls({ executor });\n // Acquire in physical-name order BEFORE the savepoint so rollback of the probe retains locks.\n for (const state of tables) {\n const model = declared.get(state.table);\n if (!state.enabled && !state.force && state.policies.length === 0 && (model === undefined || !isRlsProtected({ model }))) continue;\n await executor({ text: `LOCK TABLE \"public\".${postgresDialect.quoteIdent({ name: state.table })} IN ACCESS EXCLUSIVE MODE` });\n }\n tables = await readPostgresRls({ executor });\n const matched = new Set<string>();\n for (const state of tables) {\n const model = declared.get(state.table);\n const active = state.enabled || state.force || state.policies.length > 0;\n if (schema === undefined && active) conflict({ table: state.table, reason: \"rls-unmanaged\", attributes: [\"security metadata cannot be exported losslessly without a trusted declaration\"] });\n if (model === undefined || !isRlsProtected({ model })) {\n if (active) conflict({ table: state.table, reason: \"rls-conflict\", attributes: [\"unexpected native policies or RLS flags\"] });\n continue;\n }\n if (!active && params.requireInstalled !== true) continue;\n const unknown = state.policies.filter((policy) => policy.name !== NATIVE_RLS.policyName);\n if (unknown.length > 0) conflict({ table: state.table, reason: \"rls-conflict\", attributes: unknown.map((policy) => `unexpected policy ${policy.name}`) });\n const policy = state.policies.find((entry) => entry.name === NATIVE_RLS.policyName);\n if (policy === undefined) conflict({ table: state.table, reason: \"rls-drift\", attributes: [\"missing policy\"] });\n const structure = [\n ...(policy.command !== \"*\" ? [\"command\"] : []),\n ...(!policy.permissive ? [\"permissiveness\"] : []),\n ...(policy.roles !== \"{0}\" ? [\"roles\"] : []),\n ...(policy.withCheck === null ? [\"missing WITH CHECK\"] : []),\n ];\n if (structure.length > 0) conflict({ table: state.table, reason: \"rls-conflict\", attributes: structure });\n const attributes: string[] = [...(!state.enabled ? [\"enabled\"] : []), ...(!state.force ? [\"force\"] : [])];\n await executor({ text: \"SAVEPOINT vibeorm_rls_probe\" });\n let probe: PostgresRlsPolicy | undefined;\n try {\n const rendered = renderRlsPolicy({ dialect: postgresDialect, schema: schema!, model: model.name, policyName: PROBE });\n await executor({ text: rendered.text });\n probe = (await readPostgresRls({ executor })).find((entry) => entry.table === state.table)?.policies.find((entry) => entry.name === PROBE);\n } finally {\n await executor({ text: \"ROLLBACK TO SAVEPOINT vibeorm_rls_probe\" });\n await executor({ text: \"RELEASE SAVEPOINT vibeorm_rls_probe\" });\n }\n if (probe === undefined) conflict({ table: state.table, reason: \"rls-drift\", attributes: [\"probe unavailable\"] });\n if (policy.using !== probe.using) attributes.push(\"using\");\n if (policy.withCheck !== probe.withCheck) attributes.push(\"withCheck\");\n if (attributes.length > 0) conflict({ table: state.table, reason: \"rls-drift\", attributes });\n matched.add(state.table);\n }\n if (params.requireInstalled === true) {\n for (const [table, model] of declared) {\n if (isRlsProtected({ model }) && !matched.has(table)) conflict({ table, reason: \"rls-drift\", attributes: [\"missing table\"] });\n }\n }\n return matched;\n}\n\n/** Attach only verified declarations, mapped to the physical names introspection uses. No SQL parsing. */\nexport function projectPostgresRls(params: { physical: SchemaIR; declared?: SchemaIR; matched: ReadonlySet<string> }): SchemaIR {\n const { physical, declared, matched } = params;\n if (declared?.rls === undefined || matched.size === 0) return physical;\n const models = physical.models.map((model): ModelIR => {\n const source = declared.models.find((entry) => (entry.dbName ?? entry.name) === model.name);\n if (source === undefined || !matched.has(model.name)) return { ...model, rls: \"unprotected\" };\n const sourcePolicy = source.rls;\n let rls: RlsPolicyIR = \"deny\";\n if (typeof sourcePolicy === \"object\" && \"where\" in sourcePolicy) {\n rls = { where: Object.fromEntries(Object.entries(sourcePolicy.where).map(([field, reference]) => [source.fields.find((entry) => entry.name === field)?.dbName ?? field, reference])) };\n } else if (typeof sourcePolicy === \"object\" && \"through\" in sourcePolicy) {\n const sourceRelation = source.relations.find((entry) => entry.name === sourcePolicy.through)!;\n const target = declared.models.find((entry) => entry.name === sourceRelation.targetModel)!;\n const fields = sourceRelation.fields!.map((name) => source.fields.find((entry) => entry.name === name)?.dbName ?? name);\n const references = sourceRelation.references!.map((name) => target.fields.find((entry) => entry.name === name)?.dbName ?? name);\n const relation = model.relations.find((entry) => entry.targetModel === (target.dbName ?? target.name) && JSON.stringify(entry.fields) === JSON.stringify(fields) && JSON.stringify(entry.references) === JSON.stringify(references));\n if (relation === undefined) conflict({ table: model.name, reason: \"rls-drift\", attributes: [\"through foreign key\"] });\n rls = { through: relation.name };\n }\n return { ...model, rls };\n });\n return { ...physical, rls: declared.rls, models };\n}\n",
|
|
24
|
-
"/**\n * SQLite introspection: live database → SchemaIR, from `sqlite_master` (table\n * and index SQL text) plus `PRAGMA table_info / index_list / index_xinfo /\n * foreign_key_list`.\n *\n * THE TEXT-TYPE AMBIGUITY, stated honestly: sqlite stores only the four\n * storage classes we emit, so the reverse mapping is TEXT→String,\n * INTEGER→Int, REAL→Float, BLOB→Bytes — ALWAYS. A DateTime/Decimal/Json\n * column pulls back as String and a Boolean/BigInt as Int; there is no marker\n * to recover the richer type. The differ compensates by comparing columns by\n * storage class on sqlite (normalize.ts), so round-trips stay diff-clean.\n * Two markers DO survive:\n * - enums: our named CHECK constraints (`<table>_<column>_enum_<Enum>`)\n * recover both the enum's name and values;\n * - autoincrement: the literal `PRIMARY KEY AUTOINCREMENT` text on a\n * single-column INTEGER PK.\n * Any other declared type (VARCHAR(30), DATETIME, … from a foreign database)\n * becomes an `isUnsupported` field with the raw type preserved in\n * `nativeType` (F3: keep, don't drop).\n *\n * Representation mirrors introspect/postgres.ts exactly (shared.ts is the one\n * relation/join-table rule): unnamed relation pairs, structural join-table\n * detection, single-column uniques folded into `isUnique`, composite PKs on\n * `model.primaryKey` (PK columns are never optional), views with columns\n * only. Skipped: the `_vibe_migrations` table, `sqlite_*` internals\n * (sqlite_sequence comes with AUTOINCREMENT), and expression indexes\n * (index_xinfo reports no column name for them).\n *\n * Every row-returning query passes `values: []` — through `toSqlExecutor` a\n * value-less text runs on the adapter's multi-statement batch path, which\n * returns no rows (adapter-sqlite contract).\n */\n\nimport { exactIntegerLiteral } from \"@vibeorm/schema\";\n\nimport type {\n CascadeAction,\n DefaultValueIR,\n EnumIR,\n FieldIR,\n FieldType,\n IndexIR,\n ModelIR,\n SchemaIR,\n} from \"@vibeorm/schema\";\nimport { sqliteDialect, sqliteTableConstraints, sqliteColumnClauses } from \"@vibeorm/sql\";\nimport { MIGRATIONS_TABLE_NAME } from \"../journal-table.ts\";\nimport { parseSqliteEnumChecks, parseSqliteNamedChecks, sqliteEnumCheckName } from \"../sqlite-types.ts\";\nimport {\n addFkRelations,\n addJoinTableRelations,\n detectJoinTable,\n} from \"./shared.ts\";\nimport type { FkGroup, IntrospectedIndex, JoinTableInfo } from \"./shared.ts\";\nimport type { SqlExecutor } from \"../types.ts\";\n\n// ─── Row shapes ───────────────────────────────────────────────────\n\ntype MasterRow = { name: string; type: string; sql: string | null };\n\ntype ColumnInfo = {\n name: string;\n declaredType: string;\n notNull: boolean;\n defaultValue: string | null;\n /** 1-based position within the PK, 0 = not part of it. */\n pkPosition: number;\n catalogComplete: boolean;\n};\n\nconst SQLITE_ACTION_TO_CASCADE: Readonly<Record<string, CascadeAction>> = {\n \"NO ACTION\": \"NoAction\",\n RESTRICT: \"Restrict\",\n CASCADE: \"Cascade\",\n \"SET NULL\": \"SetNull\",\n \"SET DEFAULT\": \"SetDefault\",\n};\n\n// ─── Public API ───────────────────────────────────────────────────\n\n/** Introspect a live sqlite database into SchemaIR. */\nexport async function introspectSqlite(params: { executor: SqlExecutor }): Promise<SchemaIR> {\n return introspectSqliteCatalog(params);\n}\n\n/** @internal The runner verifies foreign_key_check and restores enforcement after COMMIT. */\nexport async function introspectSqliteBeforeForeignKeyRestore(params: { executor: SqlExecutor }): Promise<SchemaIR> {\n return introspectSqliteCatalog({ ...params, restorePending: true });\n}\n\nasync function introspectSqliteCatalog(params: { executor: SqlExecutor; restorePending?: true }): Promise<SchemaIR> {\n const { executor } = params;\n\n const masterRows = await executor({\n // `_` is a LIKE wildcard: the prefix is escaped so only SQLite's own\n // `sqlite_*` objects are hidden, never a user table named `SqliteAudit`.\n text: `SELECT name, type, sql FROM sqlite_master WHERE type IN ('table', 'view') AND name NOT LIKE 'sqlite\\\\_%' ESCAPE '\\\\' AND name <> '${MIGRATIONS_TABLE_NAME}' ORDER BY name`,\n values: [],\n });\n const indexSqlRows = await executor({\n text: `SELECT name, tbl_name, sql FROM sqlite_master WHERE type = 'index' ORDER BY name`,\n values: [],\n });\n\n const entries: MasterRow[] = masterRows.map((row) => ({\n name: row.name as string,\n type: row.type as string,\n sql: (row.sql as string | null) ?? null,\n }));\n const tables = entries.filter((entry) => entry.type === \"table\");\n const views = entries.filter((entry) => entry.type === \"view\");\n\n const indexSqlByName = new Map<string, string | null>();\n for (const row of indexSqlRows) {\n indexSqlByName.set(row.name as string, (row.sql as string | null) ?? null);\n }\n\n // Per-table catalog: columns, indexes, FKs, enum checks.\n const columnsByTable = new Map<string, ColumnInfo[]>();\n const indexes: IntrospectedIndex[] = [];\n const indexEvidence = new Map<string, boolean>();\n const uniqueSinglesByTable = new Map<string, Set<string>>();\n const modelIndexesByTable = new Map<string, IndexIR[]>();\n const checksByTable = new Map<string, { name: string; expression: string }[]>();\n const fkGroups: FkGroup[] = [];\n const enumsByColumn = new Map<string, { enumName: string; values: readonly string[] }>();\n const enumRegistry = new Map<string, EnumIR>();\n const autoincrementTables = new Set<string>();\n\n for (const table of tables) {\n const columns = await readColumns({ executor, table: table.name });\n columnsByTable.set(table.name, columns);\n\n // Enum CHECK markers from the table's SQL text.\n const enumCheckNames = new Set<string>();\n for (const check of parseSqliteEnumChecks({ tableSql: table.sql ?? \"\" })) {\n enumsByColumn.set(`${table.name}.${check.column}`, {\n enumName: check.enumName,\n values: check.values,\n });\n enumCheckNames.add(\n sqliteEnumCheckName({ table: table.name, column: check.column, enumName: check.enumName }),\n );\n if (!enumRegistry.has(check.enumName)) {\n enumRegistry.set(check.enumName, { name: check.enumName, values: check.values });\n }\n }\n\n // User CHECK constraints — every named check that is NOT enum machinery.\n checksByTable.set(\n table.name,\n parseSqliteNamedChecks({ tableSql: table.sql ?? \"\" }).filter(\n (check) => !enumCheckNames.has(check.name),\n ),\n );\n\n // Autoincrement marker (single-column INTEGER PK only).\n if (/PRIMARY KEY AUTOINCREMENT/i.test(table.sql ?? \"\")) {\n autoincrementTables.add(table.name);\n }\n\n // Indexes.\n const { tableIndexes, uniqueSingles, modelIndexes, compressionSafe } = await readIndexes({\n executor,\n table: table.name,\n indexSqlByName,\n });\n indexes.push(...tableIndexes);\n indexEvidence.set(table.name, compressionSafe);\n uniqueSinglesByTable.set(table.name, uniqueSingles);\n modelIndexesByTable.set(table.name, modelIndexes);\n\n // Foreign keys.\n fkGroups.push(...(await readForeignKeys({ executor, table: table.name, columns, tableSql: table.sql ?? \"\" })));\n }\n\n // Implicit join tables (the shared structural rule).\n const joinTables = new Map<string, JoinTableInfo>();\n let foreignKeysEnabled: boolean | undefined;\n for (const table of tables) {\n if (!table.name.startsWith(\"_\") || table.sql === null || indexEvidence.get(table.name) !== true) continue;\n // Catalog SQL is valid SQL; remove quoted names/literals and comments before\n // testing for clauses the implicit representation cannot retain.\n const keywords = table.sql.replace(/--[^\\n]*|\\/\\*[\\s\\S]*?\\*\\/|\"(?:\"\"|[^\"])*\"|'(?:''|[^'])*'|`(?:``|[^`])*`|\\[[^\\]]*\\]/g, \" \");\n if (/\\b(?:CHECK|PRIMARY|GENERATED|COLLATE|DEFERRABLE|STRICT|WITHOUT|CONFLICT|AS)\\b/i.test(keywords) || sqliteColumnClauses({ sql: table.sql }).length !== 2) continue;\n const tableColumns = columnsByTable.get(table.name) ?? [];\n if (tableColumns.some((column) => !column.catalogComplete || column.pkPosition !== 0 || column.defaultValue !== null)) continue;\n if (fkGroups.filter((fk) => fk.table === table.name).some((fk) => fk.columns.some((name, index) => {\n const source = tableColumns.find((column) => column.name === name);\n const target = columnsByTable.get(fk.refTable)?.find((column) => column.name === fk.refColumns[index]);\n return source === undefined || target === undefined || !target.catalogComplete || source.declaredType.trim().toUpperCase() !== target.declaredType.trim().toUpperCase();\n }))) continue;\n const detected = detectJoinTable({\n table: table.name,\n columnNames: (columnsByTable.get(table.name) ?? []).map((column) => column.name),\n fkGroups,\n indexes,\n });\n if (detected === null) continue;\n if (foreignKeysEnabled === undefined) {\n const enabled = await executor({ text: \"PRAGMA foreign_keys\", values: [] });\n const deferred = await executor({ text: \"PRAGMA defer_foreign_keys\", values: [] });\n foreignKeysEnabled = (enabled[0]?.foreign_keys === 1 || params.restorePending === true && enabled[0]?.foreign_keys === 0) && deferred[0]?.defer_foreign_keys === 0;\n }\n if (!foreignKeysEnabled) continue;\n const violations = await executor({ text: `PRAGMA foreign_key_check(${q(table.name)})`, values: [] });\n if (violations.length === 0) joinTables.set(table.name, detected);\n }\n\n // Models.\n const models: ModelIR[] = [];\n for (const table of tables) {\n if (joinTables.has(table.name)) continue;\n models.push(\n buildModel({\n table: table.name,\n isView: false,\n columns: columnsByTable.get(table.name) ?? [],\n uniqueSingles: uniqueSinglesByTable.get(table.name) ?? new Set(),\n modelIndexes: modelIndexesByTable.get(table.name) ?? [],\n enumsByColumn,\n autoincrement: autoincrementTables.has(table.name),\n checks: checksByTable.get(table.name) ?? [],\n }),\n );\n }\n for (const view of views) {\n models.push(\n buildModel({\n table: view.name,\n isView: true,\n columns: await readColumns({ executor, table: view.name }),\n uniqueSingles: new Set(),\n modelIndexes: [],\n enumsByColumn,\n autoincrement: false,\n checks: [],\n }),\n );\n }\n\n addFkRelations({ models, fkGroups, joinTables });\n addJoinTableRelations({ models, joinTables });\n\n return {\n datasource: { provider: \"sqlite\" },\n models,\n enums: [...enumRegistry.values()],\n extensions: [],\n };\n}\n\n// ─── Catalog readers ──────────────────────────────────────────────\n\nasync function readColumns(params: {\n executor: SqlExecutor;\n table: string;\n}): Promise<ColumnInfo[]> {\n const rows = await params.executor({\n text: `PRAGMA table_info(${q(params.table)})`,\n values: [],\n });\n return rows.map((row) => ({\n name: row.name as string,\n declaredType: (row.type as string | null) ?? \"\",\n notNull: Number(row.notnull) === 1,\n defaultValue: row.dflt_value === null || row.dflt_value === undefined ? null : String(row.dflt_value),\n pkPosition: Number(row.pk),\n catalogComplete: typeof row.type === \"string\" && row.type.trim().length > 0 && (row.notnull === 0 || row.notnull === 1) && (row.dflt_value === null || typeof row.dflt_value === \"string\") && typeof row.pk === \"number\",\n }));\n}\n\nasync function readIndexes(params: {\n executor: SqlExecutor;\n table: string;\n indexSqlByName: ReadonlyMap<string, string | null>;\n}): Promise<{\n tableIndexes: IntrospectedIndex[];\n uniqueSingles: Set<string>;\n modelIndexes: IndexIR[];\n compressionSafe: boolean;\n}> {\n const { executor, table, indexSqlByName } = params;\n const listRows = await executor({ text: `PRAGMA index_list(${q(table)})`, values: [] });\n\n const tableIndexes: IntrospectedIndex[] = [];\n const uniqueSingles = new Set<string>();\n const modelIndexes: IndexIR[] = [];\n let compressionSafe = true;\n\n for (const listRow of listRows) {\n if (![\"c\", \"u\", \"pk\"].includes(String(listRow.origin)) || (listRow.unique !== 0 && listRow.unique !== 1) || (listRow.partial !== 0 && listRow.partial !== 1)) compressionSafe = false;\n const origin = listRow.origin as string;\n if (origin === \"pk\") continue; // The PK itself — table_info carries it.\n\n const name = listRow.name as string;\n const unique = Number(listRow.unique) === 1;\n const partial = Number(listRow.partial) === 1;\n if (partial) compressionSafe = false;\n\n const infoRows = await executor({ text: `PRAGMA index_xinfo(${q(name)})`, values: [] });\n const keyRows = infoRows\n .filter((row) => Number(row.key) === 1)\n .sort((a, b) => Number(a.seqno) - Number(b.seqno));\n if (keyRows.length === 0 || !keyRows.every((row) => typeof row.name === \"string\" && row.coll === \"BINARY\" && row.desc === 0)) compressionSafe = false;\n let columns: { name: string; desc: boolean }[];\n if (keyRows.some((row) => row.name === null || row.name === undefined)) {\n // Expression index. OUR OWN Decimal form — CAST(\"col\" AS REAL), emitted\n // by the sqlite DDL renderer (SQLITE-2) — is recovered from the index's\n // sqlite_master SQL so `diff(introspect(push(X)), X)` stays [] and push\n // stays idempotent. Any OTHER expression index is skipped (documented\n // non-support), exactly as before.\n const recovered = parseIndexColumnsFromSql({ sql: indexSqlByName.get(name) ?? null });\n if (recovered === null) continue;\n columns = recovered;\n } else {\n columns = keyRows.map((row) => ({\n name: row.name as string,\n desc: Number(row.desc) === 1,\n }));\n }\n\n let where: string | undefined;\n if (partial) {\n const sql = indexSqlByName.get(name);\n const match = sql?.match(/\\sWHERE\\s+(.*)$/is);\n where = match?.[1]?.trim();\n }\n\n tableIndexes.push({\n table,\n name,\n unique,\n kind: \"btree\",\n columns,\n ...(where === undefined ? {} : { where }),\n });\n\n if (unique && columns.length === 1 && where === undefined) {\n uniqueSingles.add((columns[0] as { name: string }).name);\n if (name.startsWith(\"sqlite_autoindex_\") || name === `${table}_${columns[0]!.name}_key`) continue;\n }\n modelIndexes.push({\n name,\n kind: unique ? \"unique\" : \"btree\",\n fields: columns.map((column) => ({\n name: column.name,\n ...(column.desc ? { sort: \"desc\" as const } : {}),\n })),\n ...(where === undefined ? {} : { where }),\n });\n }\n\n return { tableIndexes, uniqueSingles, modelIndexes, compressionSafe };\n}\n\n/** One parsed index-column term: `\"col\" [DESC]` or `CAST(\"col\" AS REAL) [DESC]`. */\nconst PLAIN_INDEX_COLUMN = /^\"((?:[^\"]|\"\")+)\"(?:\\s+(ASC|DESC))?$/i;\nconst CAST_REAL_INDEX_COLUMN = /^CAST\\s*\\(\\s*\"((?:[^\"]|\"\")+)\"\\s+AS\\s+REAL\\s*\\)(?:\\s+(ASC|DESC))?$/i;\n\n/**\n * Recover an expression index's column list from its `sqlite_master.sql`\n * (SQLITE-2). Only shapes WE emit parse — plain quoted columns and\n * `CAST(\"col\" AS REAL)`, each with an optional direction; a trailing partial\n * WHERE clause is fine (it sits OUTSIDE the column list — closure item 2).\n * Anything else (other expressions, COLLATE clauses) returns null and the\n * caller skips the index as before.\n */\nexport function parseIndexColumnsFromSql(params: {\n sql: string | null;\n}): { name: string; desc: boolean }[] | null {\n const { sql } = params;\n if (sql === null) return null;\n // Locate the column list's OPENING paren after `ON \"table\"` and walk to its\n // matching close with a depth tracker — a greedy regex capture would swallow\n // through a PARTIAL index's WHERE clause (closure item 2: our own emitted\n // partial Decimal expression index then failed to parse, was skipped as\n // foreign, and every push re-created it).\n const onMatch = /\\sON\\s+\"(?:[^\"]|\"\")+\"\\s*\\(/i.exec(sql);\n if (onMatch === null) return null;\n const open = onMatch.index + onMatch[0].length - 1;\n let listDepth = 0;\n let close = -1;\n for (let index = open; index < sql.length; index++) {\n const char = sql[index];\n if (char === \"(\") listDepth += 1;\n else if (char === \")\") {\n listDepth -= 1;\n if (listDepth === 0) {\n close = index;\n break;\n }\n }\n }\n if (close === -1) return null;\n const list = sql.slice(open + 1, close);\n\n // Split on top-level commas — CAST(…) carries its own parens.\n const terms: string[] = [];\n let depth = 0;\n let start = 0;\n for (let index = 0; index < list.length; index++) {\n const char = list[index];\n if (char === \"(\") depth += 1;\n else if (char === \")\") depth -= 1;\n else if (char === \",\" && depth === 0) {\n terms.push(list.slice(start, index));\n start = index + 1;\n }\n }\n terms.push(list.slice(start));\n\n const columns: { name: string; desc: boolean }[] = [];\n for (const term of terms) {\n const trimmed = term.trim();\n const match = PLAIN_INDEX_COLUMN.exec(trimmed) ?? CAST_REAL_INDEX_COLUMN.exec(trimmed);\n if (match === null) return null;\n columns.push({\n name: (match[1] as string).replaceAll('\"\"', '\"'),\n desc: (match[2] ?? \"\").toUpperCase() === \"DESC\",\n });\n }\n return columns;\n}\n\nasync function readForeignKeys(params: {\n executor: SqlExecutor;\n table: string;\n columns: readonly ColumnInfo[];\n tableSql: string;\n}): Promise<FkGroup[]> {\n const { executor, table, columns } = params;\n const rows = await executor({ text: `PRAGMA foreign_key_list(${q(table)})`, values: [] });\n\n type MutableGroup = {\n columns: string[];\n refTable: string;\n refColumns: string[];\n onDelete: CascadeAction;\n onUpdate: CascadeAction;\n };\n const groups = new Map<number, MutableGroup>();\n const ordered = [...rows].sort(\n (a, b) => Number(a.id) - Number(b.id) || Number(a.seq) - Number(b.seq),\n );\n for (const row of ordered) {\n const id = Number(row.id);\n const from = row.from as string;\n // `to` is null when the FK references the parent's implicit PK — we never\n // emit that form, but resolve it defensively to the parent's rowid alias.\n const to = (row.to as string | null) ?? \"rowid\";\n const existing = groups.get(id);\n if (existing === undefined) {\n groups.set(id, {\n columns: [from],\n refTable: row.table as string,\n refColumns: [to],\n onDelete: SQLITE_ACTION_TO_CASCADE[(row.on_delete as string) ?? \"NO ACTION\"] ?? \"NoAction\",\n onUpdate: SQLITE_ACTION_TO_CASCADE[(row.on_update as string) ?? \"NO ACTION\"] ?? \"NoAction\",\n });\n } else {\n existing.columns.push(from);\n existing.refColumns.push(to);\n }\n }\n\n return [...groups.values()].map((group) => ({\n // sqlite does not surface FK constraint names — recompute the convention\n // the differ's normalization uses, so keys line up.\n constraintName: sqliteTableConstraints({ sql: params.tableSql }).find((clause) => clause.named && clause.type === \"foreignKey\" && JSON.stringify(clause.columns) === JSON.stringify(group.columns))?.name ?? `${table}_${group.columns.join(\"_\")}_fkey`,\n table,\n columns: group.columns,\n refTable: group.refTable,\n refColumns: group.refColumns,\n onDelete: group.onDelete,\n onUpdate: group.onUpdate,\n required: group.columns.every((columnName) => {\n const column = columns.find((candidate) => candidate.name === columnName);\n return column === undefined ? true : column.notNull;\n }),\n }));\n}\n\n// ─── Model building ───────────────────────────────────────────────\n\nfunction buildModel(params: {\n table: string;\n isView: boolean;\n columns: readonly ColumnInfo[];\n uniqueSingles: ReadonlySet<string>;\n modelIndexes: readonly IndexIR[];\n enumsByColumn: ReadonlyMap<string, { enumName: string; values: readonly string[] }>;\n autoincrement: boolean;\n checks: readonly { readonly name: string; readonly expression: string }[];\n}): ModelIR {\n const { table, isView, columns, uniqueSingles, modelIndexes, enumsByColumn, autoincrement } =\n params;\n\n const pk = columns\n .filter((column) => column.pkPosition > 0)\n .sort((a, b) => a.pkPosition - b.pkPosition)\n .map((column) => column.name);\n\n const fields: FieldIR[] = columns.map((column) => {\n const enumRef = enumsByColumn.get(`${table}.${column.name}`);\n const mapped = reverseMapType({ column, enumRef });\n const isId = pk.length === 1 && pk[0] === column.name;\n const isAutoincrement =\n autoincrement && isId && column.declaredType.toUpperCase() === \"INTEGER\";\n const defaultValue: DefaultValueIR | undefined = isAutoincrement\n ? { kind: \"autoincrement\" }\n : parseColumnDefault({ column, mapped });\n\n return {\n name: column.name,\n type: mapped.type,\n isList: false,\n // PK columns are never optional: sqlite's table_info reports notnull=0\n // for `INTEGER PRIMARY KEY` rowid aliases, but the column cannot\n // actually hold NULL (postgres-parity rule).\n isOptional: column.pkPosition > 0 ? false : !column.notNull,\n isId,\n isUnique: uniqueSingles.has(column.name),\n isUpdatedAt: false,\n ...(defaultValue === undefined ? {} : { default: defaultValue }),\n ...(mapped.nativeType === undefined ? {} : { nativeType: mapped.nativeType }),\n ...(mapped.isUnsupported === true ? { isUnsupported: true as const } : {}),\n };\n });\n\n return {\n name: table,\n fields,\n relations: [],\n indexes: [...modelIndexes],\n ...(params.checks.length === 0 ? {} : { checks: params.checks.map((check) => ({ ...check, catalogExpression: true as const })) }),\n isView,\n ...(pk.length > 1 ? { primaryKey: { fields: pk } } : {}),\n };\n}\n\n// ─── Reverse type mapping (the TEXT-ambiguity rule) ───────────────\n\ntype MappedType = {\n type: FieldType;\n nativeType?: string;\n isUnsupported?: true;\n};\n\nfunction reverseMapType(params: {\n column: ColumnInfo;\n enumRef: { enumName: string; values: readonly string[] } | undefined;\n}): MappedType {\n const { column, enumRef } = params;\n const declared = column.declaredType.trim().toUpperCase();\n\n if (enumRef !== undefined && declared === \"TEXT\") {\n return { type: { enum: enumRef.enumName } };\n }\n switch (declared) {\n case \"TEXT\":\n return { type: \"String\" };\n case \"INTEGER\":\n return { type: \"Int\" };\n case \"REAL\":\n return { type: \"Float\" };\n case \"BLOB\":\n return { type: \"Bytes\" };\n default:\n // Foreign declared type (VARCHAR(30), DATETIME, …) — preserved, not\n // guessed at (F3: keep, don't drop).\n return { type: \"String\", nativeType: column.declaredType, isUnsupported: true };\n }\n}\n\n// ─── Default parsing ──────────────────────────────────────────────\n\nfunction parseColumnDefault(params: {\n column: ColumnInfo;\n mapped: MappedType;\n}): DefaultValueIR | undefined {\n const { column, mapped } = params;\n const raw = column.defaultValue;\n if (raw === null) return undefined;\n\n if (/^-?\\d+(\\.\\d+)?$/.test(raw)) return { kind: \"literal\", value: /^-?\\d+$/.test(raw) ? exactIntegerLiteral({ text: raw }) : Number(raw) };\n\n const quoted = raw.match(/^'((?:[^']|'')*)'$/);\n if (quoted !== null) {\n const value = (quoted[1] as string).replaceAll(\"''\", \"'\");\n if (typeof mapped.type === \"object\") return { kind: \"enumValue\", value };\n if ((mapped.type === \"Int\" || mapped.type === \"Float\") && /^-?\\d+(\\.\\d+)?$/.test(value)) {\n return { kind: \"literal\", value: /^-?\\d+$/.test(value) ? exactIntegerLiteral({ text: value }) : Number(value) };\n }\n return { kind: \"literal\", value };\n }\n\n return { kind: \"dbgenerated\", sql: raw };\n}\n\n// ─── Quoting ──────────────────────────────────────────────────────\n\nfunction q(name: string): string {\n return sqliteDialect.quoteIdent({ name });\n}\n",
|
|
26
|
+
"/** Native policy migration orchestration. SQL text comes only from @vibeorm/sql. */\nimport { VibeError, assertValidSchemaIR, unsupportedCapability } from \"@vibeorm/schema\";\nimport type { Dialect, ModelIR, SchemaIR } from \"@vibeorm/schema\";\nimport * as sql from \"@vibeorm/sql\";\nimport type { MigrationStep } from \"../types.ts\";\n\n/** Whether a model requires ENABLE + FORCE and a managed policy. */\nexport function isRlsProtected(params: { model: ModelIR }): boolean {\n return params.model.rls !== undefined && params.model.rls !== \"unprotected\";\n}\n\n/** Parent policies before through children; callers validate acyclic IR first. */\nexport function orderedRlsModels(params: { schema: SchemaIR }): ModelIR[] {\n const result: ModelIR[] = [];\n const visited = new Set<string>();\n const visit = (model: ModelIR): void => {\n if (visited.has(model.name)) return;\n visited.add(model.name);\n const policy = model.rls;\n if (typeof policy === \"object\" && \"through\" in policy) {\n const relation = model.relations.find((entry) => entry.name === policy.through);\n const parent = params.schema.models.find((entry) => entry.name === relation?.targetModel);\n if (parent !== undefined) visit(parent);\n }\n if (isRlsProtected({ model })) result.push(model);\n };\n for (const model of params.schema.models) visit(model);\n return result;\n}\n\n/** RLS declarations refuse on unsupported dialects even when the physical diff is empty. */\nexport function assertRlsDialect(params: { schema: SchemaIR; dialect: Dialect }): void {\n if (params.schema.rls === undefined && !params.schema.models.some((model) => model.rls !== undefined)) return;\n if (!sql.DIALECT_CAPABILITIES[params.dialect].nativeRowLevelSecurity) {\n throw unsupportedCapability({ dialect: params.dialect, feature: \"nativeRowLevelSecurity\" });\n }\n assertValidSchemaIR({ schema: params.schema });\n}\n\n/** Compose child-first policy drops, physical DDL, parent-first installations, then explicit removals. */\nexport function withRlsSteps(params: {\n from: SchemaIR;\n to: SchemaIR;\n steps: readonly MigrationStep[];\n}): MigrationStep[] {\n const { from, to, steps } = params;\n const before = orderedRlsModels({ schema: from });\n const after = orderedRlsModels({ schema: to });\n const beforeByTable = new Map(before.map((model) => [model.dbName ?? model.name, model]));\n const afterByTable = new Map(after.map((model) => [model.dbName ?? model.name, model]));\n const changed = new Set<string>();\n const policyChanges = new Set<string>();\n for (const [table, model] of beforeByTable) {\n const target = afterByTable.get(table);\n if (target === undefined || sql.renderRlsPredicate({ dialect: sql.postgresDialect, schema: from, model: model.name }) !== sql.renderRlsPredicate({ dialect: sql.postgresDialect, schema: to, model: target.name })) {\n changed.add(table);\n policyChanges.add(table);\n }\n }\n for (const step of steps) {\n if (step.kind === \"dropTable\" || step.kind === \"dropColumn\" || step.kind === \"alterColumn\" || step.kind === \"dropForeignKey\" || step.kind === \"dropPrimaryKey\") changed.add(step.table);\n }\n // A through expression references its parent table, while parent policy changes also change child semantics.\n for (const schema of [from, to]) {\n for (const model of orderedRlsModels({ schema })) {\n if (typeof model.rls !== \"object\" || !(\"through\" in model.rls)) continue;\n const through = model.rls.through;\n const relation = model.relations.find((entry) => entry.name === through);\n const parent = schema.models.find((entry) => entry.name === relation?.targetModel);\n if (parent !== undefined && changed.has(parent.dbName ?? parent.name)) {\n changed.add(model.dbName ?? model.name);\n policyChanges.add(model.dbName ?? model.name);\n }\n }\n }\n const drops: MigrationStep[] = [];\n const installs: MigrationStep[] = [];\n const removals: MigrationStep[] = [];\n for (const model of [...before].reverse()) {\n const table = model.dbName ?? model.name;\n if (!changed.has(table)) continue;\n const target = afterByTable.get(table);\n const securityChange = target === undefined\n ? `remove native RLS protection from \"${table}\"`\n : policyChanges.has(table) && target.rls !== \"deny\"\n ? `replace native RLS policy on \"${table}\" (access may widen)`\n : undefined;\n drops.push({ kind: \"dropPolicy\", table, destructive: false, ...(securityChange === undefined ? {} : { securityChange }) });\n if (target === undefined && to.models.some((entry) => (entry.dbName ?? entry.name) === table)) {\n removals.push({ kind: \"noForceRls\", table, destructive: false }, { kind: \"disableRls\", table, destructive: false });\n }\n }\n for (const model of after) {\n const table = model.dbName ?? model.name;\n if (beforeByTable.has(table) && !changed.has(table)) continue;\n if (!beforeByTable.has(table)) installs.push({ kind: \"enableRls\", table, destructive: false }, { kind: \"forceRls\", table, destructive: false });\n installs.push({ kind: \"createPolicy\", table, schema: to, model: model.name, destructive: false });\n }\n return [...drops, ...steps, ...installs, ...removals];\n}\n\n/** Structural step discriminator shared by all three migration renderers. */\nexport function isRlsStep(params: { step: MigrationStep }): boolean {\n return [\"enableRls\", \"forceRls\", \"disableRls\", \"noForceRls\", \"createPolicy\", \"dropPolicy\"].includes(params.step.kind);\n}\n\n/** Dispatch only: absence of a SQL-layer migration renderer is a loud refusal, never synthesized SQL. */\nexport function renderRlsStep(params: { step: MigrationStep; dialect: Dialect }): string[] {\n const { step, dialect } = params;\n if (!sql.DIALECT_CAPABILITIES[dialect].nativeRowLevelSecurity) throw unsupportedCapability({ dialect, feature: \"nativeRowLevelSecurity\" });\n const common = { dialect: sql.postgresDialect, table: \"table\" in step ? step.table ?? \"\" : \"\" };\n switch (step.kind) {\n case \"enableRls\": return [sql.renderRlsEnable(common).text];\n case \"forceRls\": return [sql.renderRlsForce(common).text];\n case \"createPolicy\": return [sql.renderRlsPolicy({ dialect: common.dialect, schema: step.schema, model: step.model }).text];\n case \"dropPolicy\":\n case \"disableRls\":\n case \"noForceRls\": {\n const name = step.kind === \"dropPolicy\" ? \"renderRlsDropPolicy\" : step.kind === \"disableRls\" ? \"renderRlsDisable\" : \"renderRlsNoForce\";\n const renderers = sql as typeof sql & Partial<Record<typeof name, typeof sql.renderRlsEnable>>;\n const renderer = renderers[name];\n if (renderer === undefined) throw unsupportedCapability({ dialect, feature: \"nativeRowLevelSecurity\", hint: `The SQL package must provide ${name} before this migration can execute` });\n return [renderer(common).text];\n }\n default: throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Expected a native RLS migration step\" });\n }\n}\n\n/** Human preview of security changes, deliberately separate from destructive data steps. */\nexport function securityChangesOf(params: { steps: readonly MigrationStep[] }): string[] {\n return [...new Set(params.steps.flatMap((step) => step.securityChange === undefined ? [] : [step.securityChange]))];\n}\n\n/** Shared push/apply/rollback refusal. Data-loss flags are intentionally not accepted here. */\nexport function assertSecurityAcknowledgement(params: { securityChanges: readonly string[]; acceptSecurityChanges?: boolean }): void {\n if (params.securityChanges.length === 0 || params.acceptSecurityChanges === true) return;\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `Security changes require acceptSecurityChanges: true; acceptDataLoss does not authorize them:\\n${params.securityChanges.join(\"\\n\")}`,\n meta: { reason: \"security-acknowledgement-required\", securityChanges: params.securityChanges },\n });\n}\n",
|
|
25
27
|
"/**\n * MySQL introspection: live database → SchemaIR, from\n * `information_schema.{tables,views,columns,statistics,key_column_usage,\n * referential_constraints}` (scoped to `DATABASE()`).\n *\n * Representation mirrors introspect/postgres.ts exactly (shared.ts carries\n * the one relation/join-table rule). MySQL-specific decisions:\n *\n * - `COLUMN_TYPE` is the reverse-mapping source: `tinyint(1)` → Boolean (the\n * marker), `varchar(191)` → String, `enum('A','B')` → an enum whose values\n * are parsed from the type and whose NAME is synthesized as\n * `<Table>_<column>` — mysql enums are nameless, so the schema-declared\n * name is unrecoverable. The differ compares enum columns by VALUE LIST\n * (normalize.ts), so the synthetic names never produce phantom steps.\n * - `EXTRA = auto_increment` → `@default(autoincrement())`;\n * `DEFAULT_GENERATED` expressions → `dbgenerated` (CURRENT_TIMESTAMP(…) →\n * `now` first).\n * - Non-canonical column types keep `COLUMN_TYPE` in `nativeType`; unknown\n * types become `isUnsupported` fields (F3: keep, don't drop).\n * - Indexes named like an FK constraint on the same table are SKIPPED: mysql\n * auto-creates them for FKs without a covering index, and surfacing them\n * would churn round-trips with phantom index steps.\n * - The `_vibe_migrations` bookkeeping table is skipped.\n */\n\nimport { exactIntegerLiteral } from \"@vibeorm/schema\";\nimport { mysqlDialect } from \"@vibeorm/sql\";\n\nimport type {\n CascadeAction,\n CheckIR,\n DefaultValueIR,\n EnumIR,\n FieldIR,\n FieldType,\n IndexIR,\n ModelIR,\n ScalarType,\n SchemaIR,\n} from \"@vibeorm/schema\";\nimport { normalizeMysqlType, parseMysqlEnumColumnType } from \"../mysql-types.ts\";\nimport { MIGRATIONS_TABLE_NAME } from \"../journal-table.ts\";\nimport {\n addFkRelations,\n addJoinTableRelations,\n detectJoinTable,\n} from \"./shared.ts\";\nimport type { FkGroup, IntrospectedIndex, JoinTableInfo } from \"./shared.ts\";\nimport type { SqlExecutor } from \"../types.ts\";\n\n// ─── Catalog queries ──────────────────────────────────────────────\n\nconst TABLES_QUERY = `\n SELECT table_name, engine\n FROM information_schema.tables\n WHERE table_schema = DATABASE()\n AND table_type = 'BASE TABLE'\n AND table_name <> '${MIGRATIONS_TABLE_NAME}'\n ORDER BY table_name;\n`;\n\nconst VIEWS_QUERY = `\n SELECT table_name\n FROM information_schema.views\n WHERE table_schema = DATABASE()\n ORDER BY table_name;\n`;\n\nconst COLUMNS_QUERY = `\n SELECT\n table_name,\n column_name,\n column_type,\n is_nullable,\n column_default,\n collation_name,\n extra,\n generation_expression,\n ordinal_position\n FROM information_schema.columns\n WHERE table_schema = DATABASE()\n ORDER BY table_name, ordinal_position;\n`;\n\nconst STATISTICS_QUERY = `\n SELECT\n table_name,\n index_name,\n non_unique,\n seq_in_index,\n column_name,\n collation,\n index_type,\n is_visible,\n sub_part,\n expression\n FROM information_schema.statistics\n WHERE table_schema = DATABASE()\n ORDER BY table_name, index_name, seq_in_index;\n`;\n\nconst FOREIGN_KEYS_QUERY = `\n SELECT\n constraint_name,\n table_name,\n column_name,\n ordinal_position,\n referenced_table_name,\n referenced_column_name,\n table_schema,\n referenced_table_schema\n FROM information_schema.key_column_usage\n WHERE table_schema = DATABASE()\n AND referenced_table_name IS NOT NULL\n ORDER BY table_name, constraint_name, ordinal_position;\n`;\n\nconst REFERENTIAL_QUERY = `\n SELECT constraint_name, update_rule, delete_rule\n FROM information_schema.referential_constraints\n WHERE constraint_schema = DATABASE();\n`;\n\n/** Explicit CHECK constraints (MySQL 8.0.16+ stores and enforces them). */\nconst CHECKS_QUERY = `\n SELECT\n tc.table_name AS table_name,\n tc.constraint_name AS constraint_name,\n cc.check_clause AS definition\n FROM information_schema.table_constraints tc\n JOIN information_schema.check_constraints cc\n ON cc.constraint_schema = tc.constraint_schema\n AND cc.constraint_name = tc.constraint_name\n WHERE tc.table_schema = DATABASE()\n AND tc.constraint_type = 'CHECK'\n ORDER BY tc.table_name, tc.constraint_name;\n`;\n\n// ─── Row shapes ───────────────────────────────────────────────────\n\ntype ColumnRow = {\n table: string;\n name: string;\n columnType: string;\n nullable: boolean;\n columnDefault: string | null;\n collation: string | null;\n extra: string;\n};\n\nconst MYSQL_RULE_TO_CASCADE: Readonly<Record<string, CascadeAction>> = {\n \"NO ACTION\": \"NoAction\",\n RESTRICT: \"Restrict\",\n CASCADE: \"Cascade\",\n \"SET NULL\": \"SetNull\",\n \"SET DEFAULT\": \"SetDefault\",\n};\n\n// ─── Catalog row reading ─────────────────────────────────\n\n/**\n * Read one column from an information_schema row by its lowercase name,\n * falling back to the UPPERCASE label.\n *\n * MySQL labels information_schema result columns from the data dictionary and\n * the casing has flipped across server lines — verified live on MySQL 8.4,\n * where `SELECT table_name FROM information_schema.tables` comes back labeled\n * `TABLE_NAME`, so every lowercase-only read returned `undefined` and\n * introspecting a NON-EMPTY database crashed (an empty catalog produced no\n * rows, which is why push against a fresh database masked the bug).\n */\nfunction catalogField(params: { row: Record<string, unknown>; name: string }): unknown {\n const value = params.row[params.name];\n return value !== undefined ? value : params.row[params.name.toUpperCase()];\n}\n\n// ─── Public API ───────────────────────────────────────────────────\n\n/** Introspect a live mysql database (current schema) into SchemaIR. */\nexport async function introspectMysql(params: { executor: SqlExecutor }): Promise<SchemaIR> {\n const { executor } = params;\n\n const [tableRows, viewRows, columnRows, statisticRows, fkRows, refRows, checkRows] =\n await Promise.all([\n executor({ text: TABLES_QUERY }),\n executor({ text: VIEWS_QUERY }),\n executor({ text: COLUMNS_QUERY }),\n executor({ text: STATISTICS_QUERY }),\n executor({ text: FOREIGN_KEYS_QUERY }),\n executor({ text: REFERENTIAL_QUERY }),\n executor({ text: CHECKS_QUERY }),\n ]);\n\n // CHECK constraints per table. The stored clause arrives wrapped in one\n // outer paren pair — stripped when balanced; expression text is pull-print\n // material only (the differ keys on NAME).\n const checksByTable = new Map<string, CheckIR[]>();\n for (const row of checkRows) {\n const table = catalogField({ row, name: \"table_name\" }) as string;\n const name = catalogField({ row, name: \"constraint_name\" }) as string;\n const expression = stripBalancedOuterParens(\n String(catalogField({ row, name: \"definition\" }) ?? \"\"),\n );\n const list = checksByTable.get(table);\n if (list === undefined) checksByTable.set(table, [{ name, expression, catalogExpression: true }]);\n else list.push({ name, expression, catalogExpression: true });\n }\n\n const tables = tableRows.map((row) => catalogField({ row, name: \"table_name\" }) as string);\n const views = viewRows.map((row) => catalogField({ row, name: \"table_name\" }) as string);\n\n const columns: ColumnRow[] = columnRows.map((row) => ({\n table: catalogField({ row, name: \"table_name\" }) as string,\n name: catalogField({ row, name: \"column_name\" }) as string,\n columnType: catalogField({ row, name: \"column_type\" }) as string,\n nullable: (catalogField({ row, name: \"is_nullable\" }) as string) === \"YES\",\n columnDefault: (catalogField({ row, name: \"column_default\" }) as string | null) ?? null,\n collation: (catalogField({ row, name: \"collation_name\" }) as string | null) ?? null,\n extra: ((catalogField({ row, name: \"extra\" }) as string | null) ?? \"\").toLowerCase(),\n }));\n\n // Referential rules by constraint name.\n const rulesByConstraint = new Map<string, { onDelete: CascadeAction; onUpdate: CascadeAction }>();\n for (const row of refRows) {\n rulesByConstraint.set(catalogField({ row, name: \"constraint_name\" }) as string, {\n onDelete:\n MYSQL_RULE_TO_CASCADE[\n ((catalogField({ row, name: \"delete_rule\" }) as string) ?? \"NO ACTION\").toUpperCase()\n ] ?? \"NoAction\",\n onUpdate:\n MYSQL_RULE_TO_CASCADE[\n ((catalogField({ row, name: \"update_rule\" }) as string) ?? \"NO ACTION\").toUpperCase()\n ] ?? \"NoAction\",\n });\n }\n\n // FK groups (composite support; ordinal_position preserves column order).\n type MutableGroup = {\n constraintName: string;\n table: string;\n columns: string[];\n refTable: string;\n refColumns: string[];\n };\n const groupsByKey = new Map<string, MutableGroup>();\n for (const row of fkRows) {\n const constraintName = catalogField({ row, name: \"constraint_name\" }) as string;\n const table = catalogField({ row, name: \"table_name\" }) as string;\n const key = `${table}\\u0000${constraintName}`;\n const existing = groupsByKey.get(key);\n if (existing === undefined) {\n groupsByKey.set(key, {\n constraintName,\n table,\n columns: [catalogField({ row, name: \"column_name\" }) as string],\n refTable: catalogField({ row, name: \"referenced_table_name\" }) as string,\n refColumns: [catalogField({ row, name: \"referenced_column_name\" }) as string],\n });\n } else {\n existing.columns.push(catalogField({ row, name: \"column_name\" }) as string);\n existing.refColumns.push(catalogField({ row, name: \"referenced_column_name\" }) as string);\n }\n }\n const fkGroups: FkGroup[] = [...groupsByKey.values()].map((group) => {\n const rules = rulesByConstraint.get(group.constraintName);\n return {\n ...group,\n onDelete: rules?.onDelete ?? \"NoAction\",\n onUpdate: rules?.onUpdate ?? \"NoAction\",\n required: group.columns.every((columnName) => {\n const column = columns.find(\n (candidate) => candidate.table === group.table && candidate.name === columnName,\n );\n return column === undefined ? true : !column.nullable;\n }),\n };\n });\n const fkNamesByTable = new Map<string, Set<string>>();\n for (const group of fkGroups) {\n const set = fkNamesByTable.get(group.table) ?? new Set<string>();\n set.add(group.constraintName);\n fkNamesByTable.set(group.table, set);\n }\n\n // Indexes + PKs from statistics.\n const pkByTable = new Map<string, string[]>();\n const indexes: IntrospectedIndex[] = [];\n {\n type MutableIndex = {\n table: string;\n name: string;\n unique: boolean;\n columns: { name: string; desc: boolean }[];\n };\n const byKey = new Map<string, MutableIndex>();\n for (const row of statisticRows) {\n const table = catalogField({ row, name: \"table_name\" }) as string;\n const name = catalogField({ row, name: \"index_name\" }) as string;\n const columnName = catalogField({ row, name: \"column_name\" }) as string;\n if (name === \"PRIMARY\") {\n const list = pkByTable.get(table);\n if (list === undefined) pkByTable.set(table, [columnName]);\n else list.push(columnName);\n continue;\n }\n // mysql auto-creates an index per FK lacking one, named after the\n // constraint — skip those to keep round-trips churn-free.\n if (fkNamesByTable.get(table)?.has(name) === true) continue;\n\n const key = `${table}\\u0000${name}`;\n const entry = byKey.get(key);\n const column = {\n name: columnName,\n desc: (catalogField({ row, name: \"collation\" }) as string | null) === \"D\",\n };\n if (entry === undefined) {\n byKey.set(key, {\n table,\n name,\n unique: Number(catalogField({ row, name: \"non_unique\" })) === 0,\n columns: [column],\n });\n } else {\n entry.columns.push(column);\n }\n }\n for (const entry of byKey.values()) {\n indexes.push({ ...entry, kind: \"btree\" });\n }\n }\n\n // Enum columns: values parsed from COLUMN_TYPE, names synthesized.\n const enums: EnumIR[] = [];\n\n // Implicit join tables (the shared structural rule).\n const joinTables = new Map<string, JoinTableInfo>();\n let foreignKeysEnabled: boolean | undefined;\n for (const table of tables) {\n if (!table.startsWith(\"_\") || pkByTable.has(table) || (checksByTable.get(table)?.length ?? 0) > 0) continue;\n const tableIndexes = statisticRows.filter((row) => catalogField({ row, name: \"table_name\" }) === table);\n if (new Set(tableIndexes.map((row) => catalogField({ row, name: \"index_name\" }))).size !== 2 || !tableIndexes.every((row) =>\n catalogField({ row, name: \"index_type\" }) === \"BTREE\" && catalogField({ row, name: \"is_visible\" }) === \"YES\"\n && catalogField({ row, name: \"sub_part\" }) === null && catalogField({ row, name: \"expression\" }) === null\n && catalogField({ row, name: \"collation\" }) === \"A\" && Number.isInteger(Number(catalogField({ row, name: \"seq_in_index\" }))) && Number(catalogField({ row, name: \"seq_in_index\" })) > 0)) continue;\n const tableFks = fkRows.filter((row) => catalogField({ row, name: \"table_name\" }) === table);\n if (tableFks.some((row) => {\n const targetTable = catalogField({ row, name: \"referenced_table_name\" });\n const source = columnRows.find((column) => catalogField({ row: column, name: \"table_name\" }) === table && catalogField({ row: column, name: \"column_name\" }) === catalogField({ row, name: \"column_name\" }));\n const target = columnRows.find((column) => catalogField({ row: column, name: \"table_name\" }) === targetTable && catalogField({ row: column, name: \"column_name\" }) === catalogField({ row, name: \"referenced_column_name\" }));\n if (source === undefined || target === undefined) return true;\n const type = catalogField({ row: source, name: \"column_type\" });\n return typeof type !== \"string\" || type.length === 0 || type !== catalogField({ row: target, name: \"column_type\" })\n || catalogField({ row: source, name: \"column_default\" }) !== null || catalogField({ row: source, name: \"extra\" }) !== \"\"\n || catalogField({ row: source, name: \"generation_expression\" }) !== \"\" || catalogField({ row: source, name: \"is_nullable\" }) !== \"NO\"\n || catalogField({ row: source, name: \"collation_name\" }) === undefined || catalogField({ row: source, name: \"collation_name\" }) !== catalogField({ row: target, name: \"collation_name\" })\n || catalogField({ row, name: \"table_schema\" }) === undefined || catalogField({ row, name: \"table_schema\" }) !== catalogField({ row, name: \"referenced_table_schema\" })\n || ![table, targetTable].every((name) => tableRows.some((entry) => catalogField({ row: entry, name: \"table_name\" }) === name && catalogField({ row: entry, name: \"engine\" }) === \"InnoDB\"));\n })) continue;\n const detected = detectJoinTable({\n table,\n columnNames: columns.filter((column) => column.table === table).map((column) => column.name),\n fkGroups,\n indexes,\n });\n if (detected === null) continue;\n if (foreignKeysEnabled === undefined) {\n const rows = await executor({ text: \"SELECT @@SESSION.foreign_key_checks AS foreign_key_checks\", values: [] });\n foreignKeysEnabled = rows[0] !== undefined && Number(catalogField({ row: rows[0], name: \"foreign_key_checks\" })) === 1;\n }\n if (!foreignKeysEnabled) continue;\n const q = (name: string): string => mysqlDialect.quoteIdent({ name });\n let valid = true;\n for (const fk of fkGroups.filter((group) => group.table === table)) {\n const rows = await executor({ text: `SELECT 1 AS invalid FROM ${q(table)} child LEFT JOIN ${q(fk.refTable)} parent ON child.${q(fk.columns[0]!)} = parent.${q(fk.refColumns[0]!)} WHERE parent.${q(fk.refColumns[0]!)} IS NULL LIMIT 1`, values: [] });\n if (rows.length > 0) { valid = false; break; }\n }\n if (valid) joinTables.set(table, detected);\n }\n\n // Models.\n const models: ModelIR[] = [];\n for (const table of tables) {\n if (joinTables.has(table)) continue;\n models.push(\n buildModel({\n table,\n isView: false,\n columns,\n pkByTable,\n indexes,\n enums,\n checks: checksByTable.get(table) ?? [],\n }),\n );\n }\n for (const view of views) {\n models.push(\n buildModel({\n table: view,\n isView: true,\n columns,\n pkByTable: new Map(),\n indexes: [],\n enums,\n checks: [],\n }),\n );\n }\n\n addFkRelations({ models, fkGroups, joinTables });\n addJoinTableRelations({ models, joinTables });\n\n return {\n datasource: { provider: \"mysql\" },\n models,\n enums,\n extensions: [],\n };\n}\n\n// ─── Model building ───────────────────────────────────────────────\n\nfunction buildModel(params: {\n table: string;\n isView: boolean;\n columns: readonly ColumnRow[];\n pkByTable: ReadonlyMap<string, string[]>;\n indexes: readonly IntrospectedIndex[];\n enums: EnumIR[];\n checks: readonly CheckIR[];\n}): ModelIR {\n const { table, isView, columns, pkByTable, indexes, enums } = params;\n\n const tableColumns = columns.filter((column) => column.table === table);\n const pk = pkByTable.get(table) ?? [];\n\n const tableIndexes = indexes.filter((index) => index.table === table);\n const uniqueSingles = new Set<string>();\n for (const index of tableIndexes) {\n if (index.unique && index.columns.length === 1) {\n uniqueSingles.add((index.columns[0] as { name: string }).name);\n }\n }\n\n const fields: FieldIR[] = tableColumns.map((column) => {\n const mapped = reverseMapType({ table, column, enums });\n const isId = pk.length === 1 && pk[0] === column.name;\n const defaultValue = parseColumnDefault({ column, mapped });\n return {\n name: column.name,\n type: mapped.type,\n isList: false,\n isOptional: column.nullable,\n isId,\n isUnique: uniqueSingles.has(column.name),\n isUpdatedAt: false,\n ...(defaultValue === undefined ? {} : { default: defaultValue }),\n ...(mapped.nativeType === undefined ? {} : { nativeType: mapped.nativeType }),\n ...(mapped.isUnsupported === true ? { isUnsupported: true as const } : {}),\n ...(mapped.type === \"String\" && column.collation !== null ? { collation: column.collation } : {}),\n };\n });\n\n const modelIndexes: IndexIR[] = [];\n for (const index of tableIndexes) {\n if (index.unique && index.columns.length === 1 && index.name === `${table}_${index.columns[0]!.name}_key`) continue;\n modelIndexes.push({\n name: index.name,\n kind: index.unique ? \"unique\" : \"btree\",\n fields: index.columns.map((column) => ({\n name: column.name,\n ...(column.desc ? { sort: \"desc\" as const } : {}),\n })),\n });\n }\n\n return {\n name: table,\n fields,\n relations: [],\n indexes: modelIndexes,\n ...(params.checks.length === 0 ? {} : { checks: params.checks }),\n isView,\n ...(pk.length > 1 ? { primaryKey: { fields: pk } } : {}),\n };\n}\n\n/** Strip ONE balanced outer paren pair (`(a > 0)` → `a > 0`; `(a) AND (b)` stays). */\nfunction stripBalancedOuterParens(text: string): string {\n const trimmed = text.trim();\n if (!trimmed.startsWith(\"(\") || !trimmed.endsWith(\")\")) return trimmed;\n let depth = 0;\n for (let index = 0; index < trimmed.length; index++) {\n const char = trimmed[index];\n if (char === \"(\") depth += 1;\n else if (char === \")\") {\n depth -= 1;\n if (depth === 0 && index < trimmed.length - 1) return trimmed;\n }\n }\n return trimmed.slice(1, -1).trim();\n}\n\n// ─── Reverse type mapping (dialect-matrix §2, reversed) ───────────\n\ntype MappedType = {\n type: FieldType;\n nativeType?: string;\n isUnsupported?: true;\n};\n\n/** Normalized COLUMN_TYPE → scalar for types that ARE the canonical mapping. */\nconst CANONICAL_MYSQL: Readonly<Record<string, ScalarType>> = {\n \"varchar(191)\": \"String\",\n \"tinyint(1)\": \"Boolean\",\n int: \"Int\",\n bigint: \"BigInt\",\n double: \"Float\",\n \"decimal(65,30)\": \"Decimal\",\n \"datetime(3)\": \"DateTime\",\n json: \"Json\",\n longblob: \"Bytes\",\n};\n\n/** Base type → scalar for non-canonical spellings (nativeType keeps the truth). */\nconst BASE_TO_SCALAR: Readonly<Record<string, ScalarType>> = {\n varchar: \"String\",\n char: \"String\",\n text: \"String\",\n tinytext: \"String\",\n mediumtext: \"String\",\n longtext: \"String\",\n tinyint: \"Int\",\n smallint: \"Int\",\n mediumint: \"Int\",\n int: \"Int\",\n bigint: \"BigInt\",\n double: \"Float\",\n float: \"Float\",\n real: \"Float\",\n decimal: \"Decimal\",\n datetime: \"DateTime\",\n timestamp: \"DateTime\",\n date: \"DateTime\",\n json: \"Json\",\n blob: \"Bytes\",\n tinyblob: \"Bytes\",\n mediumblob: \"Bytes\",\n longblob: \"Bytes\",\n binary: \"Bytes\",\n varbinary: \"Bytes\",\n};\n\nfunction reverseMapType(params: {\n table: string;\n column: ColumnRow;\n enums: EnumIR[];\n}): MappedType {\n const { table, column, enums } = params;\n\n const enumValues = parseMysqlEnumColumnType({ columnType: column.columnType });\n if (enumValues !== null) {\n // mysql enums are nameless — synthesize `<Table>_<column>` and register.\n const name = `${table}_${column.name}`;\n if (!enums.some((entry) => entry.name === name)) {\n enums.push({ name, values: enumValues });\n }\n return { type: { enum: name } };\n }\n\n const normalized = normalizeMysqlType({ raw: column.columnType });\n const canonical = CANONICAL_MYSQL[normalized];\n if (canonical !== undefined) return { type: canonical };\n\n const base = normalized.match(/^([a-z_0-9]+)/)?.[1] ?? normalized;\n const scalar = BASE_TO_SCALAR[base];\n if (scalar !== undefined) {\n return { type: scalar, nativeType: column.columnType };\n }\n\n return { type: \"String\", nativeType: column.columnType, isUnsupported: true };\n}\n\n// ─── Default parsing ──────────────────────────────────────────────\n\nfunction parseColumnDefault(params: {\n column: ColumnRow;\n mapped: MappedType;\n}): DefaultValueIR | undefined {\n const { column, mapped } = params;\n\n if (column.extra.includes(\"auto_increment\")) return { kind: \"autoincrement\" };\n\n const raw = column.columnDefault;\n if (raw === null) return undefined;\n\n if (/^current_timestamp(\\(\\d+\\))?$/i.test(raw)) return { kind: \"now\" };\n if (column.extra.includes(\"default_generated\") && (mapped.type === \"String\" || mapped.type === \"Json\")) {\n const expression = raw.startsWith(\"(\") && raw.endsWith(\")\") ? raw.slice(1, -1) : raw;\n const hex = expression.match(/^convert\\((?:0x((?:[0-9a-f]{2})+)|x'((?:[0-9a-f]{2})+)') using utf8mb4\\)$/i);\n if (hex !== null) {\n const digits = hex[1] ?? hex[2]!;\n const bytes = Uint8Array.from(digits.match(/../g) ?? [], (pair) => Number.parseInt(pair, 16));\n const value = new TextDecoder(\"utf-8\", { ignoreBOM: true }).decode(bytes);\n const encoded = new TextEncoder().encode(value);\n // Only invert the renderer's exact UTF-8 form, never guess malformed bytes.\n if (encoded.length === bytes.length && encoded.every((byte, index) => byte === bytes[index])) return { kind: \"literal\", value };\n }\n }\n if (mapped.type === \"Json\") {\n const literal = raw.match(/^\\(?[']((?:[^']|'')*)[']\\)?$/s);\n if (literal !== null) return { kind: \"literal\", value: literal[1]!.replaceAll(\"''\", \"'\") };\n }\n if (column.extra.includes(\"default_generated\")) return { kind: \"dbgenerated\", sql: raw };\n\n if (typeof mapped.type === \"object\") return { kind: \"enumValue\", value: raw };\n if (mapped.type === \"Boolean\") {\n if (raw === \"1\" || raw === \"0\") return { kind: \"literal\", value: raw === \"1\" };\n return { kind: \"dbgenerated\", sql: raw };\n }\n if (isNumericScalar({ type: mapped.type }) && /^-?\\d+(\\.\\d+)?$/.test(raw)) {\n return { kind: \"literal\", value: /^-?\\d+$/.test(raw) ? exactIntegerLiteral({ text: raw }) : Number(raw) };\n }\n return { kind: \"literal\", value: raw };\n}\n\nfunction isNumericScalar(params: { type: ScalarType }): boolean {\n const { type } = params;\n return type === \"Int\" || type === \"BigInt\" || type === \"Float\" || type === \"Decimal\";\n}\n",
|
|
26
|
-
"import { createHash } from \"node:crypto\";\nimport { executionChecksumSuffix } from \"./execution.ts\";\nimport type { MigrationExecution } from \"./execution.ts\";\nimport { desiredStateChecksumSuffix } from \"./desired-state.ts\";\nimport type { MigrationDesiredState } from \"./desired-state.ts\";\nimport { moduleOriginChecksumSuffix } from \"./module-origin.ts\";\nimport type { ModuleMigrationOrigin } from \"./module-origin.ts\";\n\n/** Historical SQL/execution checksum, with optional immutable state and module provenance. */\nexport function migrationChecksum(params: {\n moduleOrigin?: ModuleMigrationOrigin;\n sql: readonly string[];\n execution?: MigrationExecution;\n desiredState?: MigrationDesiredState;\n downSql?: readonly string[];\n downExecution?: MigrationExecution;\n desiredStatePending?: boolean;\n}): string {\n const suffix = executionChecksumSuffix({ ...(params.execution === undefined ? {} : { execution: params.execution }) });\n return createHash(\"sha256\").update(params.sql.join(\"\\n\") + suffix + moduleOriginChecksumSuffix(params) + (params.desiredStatePending === true ? \"\\n-- vibeorm:desired-state unfinalized-v1\" : \"\") + desiredStateChecksumSuffix({ ...(params.desiredState === undefined ? {} : { desiredState: params.desiredState }) }) + (params.desiredState === undefined ? \"\" : `\\n-- vibeorm:down ${JSON.stringify(params.downSql ?? null)}${executionChecksumSuffix({ ...(params.downExecution === undefined ? {} : { execution: params.downExecution }) })}`)).digest(\"hex\");\n}\n",
|
|
27
|
-
"/**\n * Explicit execution semantics for a migration file: which transaction regime\n * it runs in, which session limits it scopes to its own work, and what each of\n * its statements is DECLARED to do.\n *\n * Why declarations and not SQL parsing: a nontransactional migration can die\n * between a statement committing and the journal recording it. Recovery then\n * has to establish what actually happened, and the only honest way to do that\n * is to compare the live catalog against a declared postcondition. Guessing an\n * operation out of SQL text is exactly the class of bug F29/F33 came from.\n *\n * CHECKSUM COMPATIBILITY — the rule this module exists to protect. A migration\n * with no execution block, or one that asks for nothing beyond today's\n * behaviour, hashes byte-for-byte as before ({@link isDefaultExecution} is\n * true ⇒ {@link executionChecksumSuffix} is empty). Every migration file\n * written before this feature existed therefore keeps its historical checksum\n * and no journal row starts looking corrupt. Only an explicitly non-default\n * block folds a canonical description into the hash, so editing execution\n * semantics after a migration was applied surfaces as the existing\n * checksum-mismatch refusal instead of silently changing how it runs.\n */\n\nimport { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect } from \"@vibeorm/schema\";\nimport type { MigrationStep } from \"./types.ts\";\n\n// ─── Model ────────────────────────────────────────────────────────\n\n/**\n * How the runner wraps a migration's statements.\n *\n * - `\"default\"` — the dialect's own regime, unchanged: one transaction per\n * migration on postgres/sqlite, per-statement bookkeeping on mysql.\n * - `\"none\"` — the migration runs OUTSIDE any transaction the runner opens,\n * with per-statement journal progress. Required for statements PostgreSQL\n * refuses inside a transaction block, `CREATE INDEX CONCURRENTLY` first\n * among them.\n */\nexport type MigrationTransactionMode = \"default\" | \"none\";\n\n/**\n * What one statement of a nontransactional migration is declared to do — the\n * postcondition recovery checks against the live catalog. Declared by whoever\n * wrote the migration; never inferred from the SQL text.\n */\nexport type MigrationOperation =\n | {\n readonly kind: \"createIndexConcurrently\";\n readonly index: string;\n readonly table: string;\n readonly unique: boolean;\n /** Access method as PostgreSQL names it (`btree`, `gin`, …). */\n readonly method: string;\n /** Key columns in index order, as PostgreSQL deparses them. */\n readonly columns: readonly string[];\n /** Partial-index predicate, when the index has one. */\n readonly where?: string;\n }\n | { readonly kind: \"dropIndexConcurrently\"; readonly index: string }\n | { readonly kind: \"addConstraintNotValid\"; readonly table: string; readonly constraint: string }\n | { readonly kind: \"validateConstraint\"; readonly table: string; readonly constraint: string }\n | { readonly kind: \"renameTable\"; readonly from: string; readonly to: string }\n | { readonly kind: \"renameColumn\"; readonly table: string; readonly from: string; readonly to: string };\n\n/** One statement's declared operation, keyed by its index in `MigrationFile.sql`. */\nexport type MigrationOperationBinding = {\n /** 0-based index into the migration's statement array. */\n readonly statement: number;\n readonly operation: MigrationOperation;\n};\n\n/** Explicit execution semantics of one direction (up or down) of a migration. */\nexport type MigrationExecution = {\n readonly transaction: MigrationTransactionMode;\n /** Migration-owned `lock_timeout` in milliseconds; 0 = no limit (server default). */\n readonly lockTimeoutMs?: number;\n /** Migration-owned `statement_timeout` in milliseconds; 0 = no limit. */\n readonly statementTimeoutMs?: number;\n readonly operations?: readonly MigrationOperationBinding[];\n};\n\n/** On-disk sidecar filename beside `migration.sql` / `down.sql`. */\nexport const EXECUTION_SIDECAR_FILENAME: string = \"execution.json\";\n\n/** Sidecar format version — bumped only on an incompatible layout change. */\nexport const EXECUTION_SIDECAR_VERSION: number = 1;\n\n// ─── Identity ─────────────────────────────────────────────────────\n\n/** True when the block asks for nothing beyond the dialect's existing behaviour. */\nexport function isDefaultExecution(params: { execution?: MigrationExecution }): boolean {\n const execution = params.execution;\n if (execution === undefined) return true;\n return (\n execution.transaction === \"default\" &&\n (execution.lockTimeoutMs ?? 0) === 0 &&\n (execution.statementTimeoutMs ?? 0) === 0 &&\n (execution.operations ?? []).length === 0\n );\n}\n\n/** Deterministic one-line description of an operation — checksum input and error text. */\nexport function describeOperation(params: { operation: MigrationOperation }): string {\n const operation = params.operation;\n switch (operation.kind) {\n case \"createIndexConcurrently\":\n return `createIndexConcurrently index=${operation.index} table=${operation.table} unique=${String(operation.unique)} method=${operation.method} columns=${operation.columns.join(\",\")}${operation.where === undefined ? \"\" : ` where=${operation.where}`}`;\n case \"dropIndexConcurrently\":\n return `dropIndexConcurrently index=${operation.index}`;\n case \"addConstraintNotValid\":\n return `addConstraintNotValid table=${operation.table} constraint=${operation.constraint}`;\n case \"validateConstraint\":\n return `validateConstraint table=${operation.table} constraint=${operation.constraint}`;\n case \"renameTable\":\n return `renameTable from=${operation.from} to=${operation.to}`;\n case \"renameColumn\":\n return `renameColumn table=${operation.table} from=${operation.from} to=${operation.to}`;\n }\n}\n\n/**\n * The canonical text folded into the migration checksum — EMPTY for a default\n * block, so historical checksums are untouched (see the module doc). The text\n * is built field by field in a fixed order rather than JSON-stringified, so it\n * cannot drift with object key order.\n */\nexport function executionChecksumSuffix(params: { execution?: MigrationExecution }): string {\n if (isDefaultExecution({ ...params })) return \"\";\n const execution = params.execution as MigrationExecution;\n const lines = [\n `-- vibeorm:execution transaction=${execution.transaction} lockTimeoutMs=${String(execution.lockTimeoutMs ?? 0)} statementTimeoutMs=${String(execution.statementTimeoutMs ?? 0)}`,\n ...[...(execution.operations ?? [])]\n .map((binding) => `-- vibeorm:operation ${String(binding.statement)} ${describeOperation({ operation: binding.operation })}`)\n .sort(),\n ];\n return `\\n${lines.join(\"\\n\")}`;\n}\n\n// ─── Validation ───────────────────────────────────────────────────\n\nfunction invalid(params: { migration: string; detail: string }): VibeError {\n return new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `invalid execution metadata for migration \"${params.migration}\": ${params.detail}`,\n meta: { reason: \"execution-metadata-invalid\", migration: params.migration },\n });\n}\n\n/**\n * Structural checks a declared block must pass before the runner trusts it:\n * every operation binding points at a real statement, no statement carries two\n * operations, and the timeouts are non-negative safe integers.\n */\nexport function assertValidExecution(params: {\n execution?: MigrationExecution;\n statements: number;\n migration: string;\n}): void {\n const { execution, statements, migration } = params;\n if (execution === undefined) return;\n if (execution.transaction !== \"default\" && execution.transaction !== \"none\") {\n throw invalid({ migration, detail: `unknown transaction mode ${JSON.stringify(execution.transaction)}` });\n }\n for (const [label, value] of [[\"lockTimeoutMs\", execution.lockTimeoutMs], [\"statementTimeoutMs\", execution.statementTimeoutMs]] as const) {\n if (value === undefined) continue;\n if (!Number.isSafeInteger(value) || value < 0) {\n throw invalid({ migration, detail: `${label} must be a non-negative integer number of milliseconds` });\n }\n }\n const seen = new Set<number>();\n for (const binding of execution.operations ?? []) {\n if (!Number.isSafeInteger(binding.statement) || binding.statement < 0 || binding.statement >= statements) {\n throw invalid({ migration, detail: `operation refers to statement ${String(binding.statement)}, which is outside the migration's ${String(statements)} statement(s)` });\n }\n if (seen.has(binding.statement)) {\n throw invalid({ migration, detail: `statement ${String(binding.statement)} carries more than one declared operation` });\n }\n seen.add(binding.statement);\n }\n}\n\n/** The operation declared for one statement, if any. */\nexport function operationFor(params: {\n execution?: MigrationExecution;\n statement: number;\n}): MigrationOperation | undefined {\n return params.execution?.operations?.find((binding) => binding.statement === params.statement)?.operation;\n}\n\n// ─── Sidecar ──────────────────────────────────────────────────────\n\n/**\n * Serialize the execution sidecar, or `undefined` when both directions are\n * default and no file should be written at all. Keeping the file absent for\n * ordinary migrations is what makes the feature invisible to existing trees.\n */\nexport function serializeExecutionSidecar(params: {\n execution?: MigrationExecution;\n downExecution?: MigrationExecution;\n}): string | undefined {\n if (isDefaultExecution({ ...(params.execution === undefined ? {} : { execution: params.execution }) })\n && isDefaultExecution({ ...(params.downExecution === undefined ? {} : { execution: params.downExecution }) })) {\n return undefined;\n }\n return `${JSON.stringify({\n version: EXECUTION_SIDECAR_VERSION,\n ...(params.execution === undefined ? {} : { up: params.execution }),\n ...(params.downExecution === undefined ? {} : { down: params.downExecution }),\n }, null, 2)}\\n`;\n}\n\n/**\n * Read and validate the sidecar. Nothing here is trusted: an unknown version,\n * a malformed body or an out-of-range operation binding refuses rather than\n * silently degrading to default semantics — a migration that believes it runs\n * outside a transaction and quietly runs inside one is exactly the failure\n * this metadata exists to prevent.\n */\nexport function parseExecutionSidecar(params: {\n text: string;\n migration: string;\n statements: number;\n downStatements: number;\n}): { readonly execution?: MigrationExecution; readonly downExecution?: MigrationExecution } {\n const { migration } = params;\n let parsed: unknown;\n try {\n parsed = JSON.parse(params.text);\n } catch (error) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `invalid execution metadata for migration \"${migration}\": not valid JSON`,\n meta: { reason: \"execution-metadata-invalid\", migration },\n cause: error,\n });\n }\n if (parsed === null || typeof parsed !== \"object\") throw invalid({ migration, detail: \"expected a JSON object\" });\n const body = parsed as { version?: unknown; up?: unknown; down?: unknown };\n if (body.version !== EXECUTION_SIDECAR_VERSION) {\n throw invalid({ migration, detail: `unsupported sidecar version ${String(body.version)} (this build reads version ${String(EXECUTION_SIDECAR_VERSION)})` });\n }\n const up = body.up === undefined ? undefined : (body.up as MigrationExecution);\n const down = body.down === undefined ? undefined : (body.down as MigrationExecution);\n assertValidExecution({ ...(up === undefined ? {} : { execution: up }), statements: params.statements, migration });\n assertValidExecution({ ...(down === undefined ? {} : { execution: down }), statements: params.downStatements, migration });\n return {\n ...(up === undefined ? {} : { execution: up }),\n ...(down === undefined ? {} : { downExecution: down }),\n };\n}\n\n// ─── Dry-run risk ─────────────────────────────────────────────────\n\n/** A reviewable risk a planned migration carries, for dry-run output. */\nexport type MigrationRisk = {\n readonly kind: \"tableRewrite\" | \"exclusiveLock\" | \"concurrentIndex\" | \"validateScan\" | \"notOnline\" | \"integrityLoss\" | \"unknownObjectRemoval\";\n readonly detail: string;\n readonly table?: string;\n};\n\n/**\n * Describe the operational risk of a planned migration, for dry-run output.\n *\n * Deliberately conservative and deliberately incomplete: it reports what the\n * step model can prove (a type change that rewrites the table on postgres, an\n * ALTER/DROP that takes ACCESS EXCLUSIVE, a validation scan) and it always\n * appends the `notOnline` note, because nothing here — `lock_timeout`\n * included — makes a migration online. A short lock WAIT is not a short lock\n * HOLD.\n */\nexport function describeMigrationRisks(params: {\n steps: readonly MigrationStep[];\n dialect: Dialect;\n}): readonly MigrationRisk[] {\n const { steps, dialect } = params;\n const risks: MigrationRisk[] = [];\n for (const step of steps) {\n switch (step.kind) {\n case \"dropExclusion\":\n case \"dropCheck\":\n case \"dropForeignKey\":\n case \"dropPrimaryKey\":\n case \"dropIndex\":\n risks.push({ kind: \"integrityLoss\", detail: `${step.kind} removes a constraint or index; integrity and dependent objects must be checked separately from row loss`, ...(\"table\" in step && step.table !== undefined ? { table: step.table } : {}) });\n break;\n case \"alterColumn\":\n if (step.changes.includes(\"type\")) {\n risks.push({ kind: \"tableRewrite\", table: step.table, detail: `changing the type of \"${step.table}\".\"${step.column}\" rewrites every row of the table while holding ACCESS EXCLUSIVE` });\n } else if (step.changes.includes(\"nullability\") && !step.to.isOptional) {\n risks.push({ kind: \"exclusiveLock\", table: step.table, detail: `SET NOT NULL on \"${step.table}\".\"${step.column}\" scans the whole table under ACCESS EXCLUSIVE${dialect === \"postgres\" ? \" unless a matching validated CHECK already proves it\" : \"\"}` });\n }\n break;\n case \"addColumn\":\n if (step.column.default !== undefined && step.column.default.kind === \"dbgenerated\") {\n risks.push({ kind: \"tableRewrite\", table: step.table, detail: `adding \"${step.table}\".\"${step.column.dbName ?? step.column.name}\" with a volatile default rewrites the table` });\n }\n break;\n case \"createIndex\":\n risks.push({ kind: \"exclusiveLock\", table: step.table, detail: `an ordinary CREATE INDEX on \"${step.table}\" blocks writes for the whole build — see the concurrent-index path in docs/migrations.md` });\n break;\n case \"addForeignKey\":\n risks.push({ kind: \"validateScan\", table: step.table, detail: `adding foreign key \"${step.constraintName}\" scans \"${step.table}\" and locks the referenced table — the staged NOT VALID path splits that` });\n break;\n case \"addCheck\":\n risks.push({ kind: \"validateScan\", table: step.table, detail: `adding check \"${step.name}\" scans \"${step.table}\" under ACCESS EXCLUSIVE — the staged NOT VALID path splits that` });\n break;\n case \"addForeignKeyNotValid\":\n case \"addCheckNotValid\":\n risks.push({ kind: \"exclusiveLock\", table: step.table, detail: `NOT VALID still takes a brief ACCESS EXCLUSIVE lock on \"${step.table}\"; it skips the scan, not the lock` });\n break;\n case \"validateConstraint\":\n risks.push({ kind: \"validateScan\", table: step.table, detail: `validating \"${step.name}\" scans \"${step.table}\" under SHARE UPDATE EXCLUSIVE — concurrent reads and writes continue` });\n break;\n case \"renameTable\":\n risks.push({ kind: \"exclusiveLock\", table: step.from, detail: `renaming \"${step.from}\" to \"${step.to}\" takes ACCESS EXCLUSIVE and breaks every client still using the old name` });\n break;\n case \"renameColumn\":\n risks.push({ kind: \"exclusiveLock\", table: step.table, detail: `renaming \"${step.table}\".\"${step.from}\" to \"${step.to}\" takes ACCESS EXCLUSIVE and breaks every client still using the old name` });\n break;\n case \"dropTable\":\n case \"dropJoinTable\":\n risks.push({ kind: \"integrityLoss\", table: step.table, detail: `${step.kind} also removes the table's constraints and indexes; their integrity loss requires separate acknowledgement` });\n risks.push({ kind: \"exclusiveLock\", detail: `${step.kind} takes ACCESS EXCLUSIVE and is not recoverable by re-running the migration` });\n break;\n case \"dropColumn\":\n risks.push({ kind: \"exclusiveLock\", detail: `${step.kind} takes ACCESS EXCLUSIVE and is not recoverable by re-running the migration` });\n break;\n default:\n break;\n }\n }\n if (risks.length > 0) {\n risks.push({\n kind: \"notOnline\",\n detail: \"lock_timeout bounds how long a statement WAITS for a lock, not how long it HOLDS one. A migration that acquires its lock immediately can still block every other session for the length of the operation.\",\n });\n }\n return risks;\n}\n",
|
|
28
|
-
"import { VibeError, assertValidSchemaIR, isSqlObjectDefinition, isSqlObjectIdentity, providerToDialect, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR, SqlObjectDefinition, SqlObjectIdentity } from \"@vibeorm/schema\";\n\n/** Authored desired state; live catalog observations never become this state implicitly. */\nexport type DesiredState = {\n readonly schema: SchemaIR;\n readonly definitions: readonly SqlObjectDefinition[];\n /** Server context for independently normalized definitions; absent for authored-only records. */\n readonly normalization?: { readonly format: \"catalog-v1\"; readonly dialect: Dialect; readonly serverVersion: string };\n};\n\n/** Immutable metadata shipped beside each new forward migration. */\nexport type MigrationDesiredState = {\n readonly version: 1;\n readonly dialect: Dialect;\n readonly from: DesiredState;\n readonly to: DesiredState;\n /** Actual rollback target when irreversible steps cannot restore from exactly. */\n readonly down?: DesiredState;\n /** Exact unmanaged objects the forward SQL intentionally removes, including collateral. */\n readonly unmanagedRemovals?: readonly SqlObjectIdentity[];\n};\n\n/** Offline shells declare uncertainty until reviewed before/after metadata is supplied. */\nexport const UNFINALIZED_DESIRED_STATE: Readonly<{ version: 1; status: \"unfinalized\" }> = Object.freeze({ version: 1, status: \"unfinalized\" });\n\n/** Recognize only the exact offline placeholder, never malformed finalized metadata. */\nexport function isUnfinalizedDesiredState(params: { text: string }): boolean {\n const value: unknown = JSON.parse(params.text);\n return record(value) && value.version === 1 && value.status === \"unfinalized\" && Object.keys(value).length === 2;\n}\n\n/** On-disk desired-state format. */\nexport const DESIRED_STATE_METADATA: Readonly<{ filename: string; version: 1 }> = Object.freeze({ filename: \"desired-state.json\", version: 1 });\n\n/** Construct metadata from declarations, never from the database being verified. */\nexport function createDesiredState(params: { schema: SchemaIR; dialect: Dialect; definitions?: readonly SqlObjectDefinition[] }): DesiredState {\n assertValidSchemaIR({ schema: params.schema });\n const provider = providerToDialect({ provider: params.schema.datasource.provider }) === params.dialect ? params.schema.datasource.provider : params.dialect === \"postgres\" ? \"postgresql\" : params.dialect;\n const schema: SchemaIR = { ...params.schema, datasource: { provider } };\n const definitions = params.definitions ?? (schema.migrationObjects ?? []).flatMap((object) => object.expected === undefined ? [] : [object.expected]);\n const seen = new Set<string>();\n for (const definition of definitions) {\n if (!isSqlObjectDefinition(definition)) throw invalid({ migration: \"declaration\", detail: \"malformed expected definition\" });\n const key = sqlObjectKey({ identity: definition.identity });\n if (seen.has(key)) throw invalid({ migration: \"declaration\", detail: `duplicate definition ${key}` });\n seen.add(key);\n }\n return { schema, definitions };\n}\n\nfunction invalid(params: { migration: string; detail: string; cause?: unknown }): VibeError {\n return new VibeError({ code: \"VIBE_MIGRATION\", message: `Invalid desired state for migration \"${params.migration}\": ${params.detail}`, meta: { reason: \"desired-state-invalid\", migration: params.migration }, ...(params.cause === undefined ? {} : { cause: params.cause }) });\n}\nfunction record(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction keysOnly(value: Record<string, unknown>, allowed: readonly string[]): boolean {\n return Object.keys(value).every((key) => allowed.includes(key));\n}\nfunction modelShape(value: unknown): boolean {\n if (!record(value) || typeof value.name !== \"string\" || !Array.isArray(value.fields) || !Array.isArray(value.relations) || !Array.isArray(value.indexes)) return false;\n return value.fields.every((field) => record(field) && typeof field.name === \"string\"\n && (typeof field.type === \"string\" || (record(field.type) && typeof field.type.enum === \"string\"))\n && [\"isId\", \"isUnique\", \"isOptional\", \"isList\"].every((key) => typeof field[key] === \"boolean\"))\n && value.relations.every(record)\n && value.indexes.every((index) => record(index) && Array.isArray(index.fields) && index.fields.every(record))\n && (value.checks === undefined || (Array.isArray(value.checks) && value.checks.every((check) => record(check) && typeof check.name === \"string\" && typeof check.expression === \"string\")));\n}\nfunction state(value: unknown): value is DesiredState {\n if (!record(value) || !keysOnly(value, [\"schema\", \"definitions\", \"normalization\"]) || !record(value.schema) || !Array.isArray(value.definitions) || !value.definitions.every(isSqlObjectDefinition)) return false;\n const schema = value.schema;\n return record(schema.datasource) && [\"postgresql\", \"pglite\", \"sqlite\", \"mysql\"].includes(String(schema.datasource.provider))\n && keysOnly(schema, [\"datasource\", \"models\", \"enums\", \"extensions\", \"rls\", \"migrationObjects\"])\n && keysOnly(schema.datasource, [\"provider\"]) && Array.isArray(schema.models) && schema.models.every(modelShape)\n && Array.isArray(schema.enums) && schema.enums.every((entry) => record(entry) && typeof entry.name === \"string\" && Array.isArray(entry.values) && entry.values.every((label) => typeof label === \"string\")) && Array.isArray(schema.extensions) && schema.extensions.every(record)\n && (value.normalization === undefined || (record(value.normalization) && value.normalization.format === \"catalog-v1\" && [\"postgres\", \"sqlite\", \"mysql\"].includes(String(value.normalization.dialect)) && typeof value.normalization.serverVersion === \"string\"));\n}\n\n/** Validate untrusted sidecars, including their Schema IR, before planning or checksumming. */\nexport function assertDesiredState(params: { value: unknown; migration: string }): asserts params is { value: MigrationDesiredState; migration: string } {\n const value = params.value;\n if (!record(value) || !keysOnly(value, [\"version\", \"dialect\", \"from\", \"to\", \"down\", \"unmanagedRemovals\"]) || value.version !== 1 || ![\"postgres\", \"sqlite\", \"mysql\"].includes(String(value.dialect)) || !state(value.from) || !state(value.to) || (value.down !== undefined && !state(value.down))) {\n throw invalid({ migration: params.migration, detail: \"unsupported version or malformed state\" });\n }\n if (value.unmanagedRemovals !== undefined && (!Array.isArray(value.unmanagedRemovals) || !value.unmanagedRemovals.every(isSqlObjectIdentity))) throw invalid({ migration: params.migration, detail: \"malformed unmanaged-removal identities\" });\n for (const entry of [value.from, value.to, ...(value.down === undefined ? [] : [value.down as DesiredState])]) {\n assertValidSchemaIR({ schema: entry.schema });\n if (providerToDialect({ provider: entry.schema.datasource.provider }) !== value.dialect) throw invalid({ migration: params.migration, detail: \"schema provider differs from sidecar dialect\" });\n if (entry.normalization !== undefined && entry.normalization.dialect !== value.dialect) throw invalid({ migration: params.migration, detail: \"normalization dialect differs from sidecar dialect\" });\n const keys = entry.definitions.map((definition) => sqlObjectKey({ identity: definition.identity }));\n if (new Set(keys).size !== keys.length) throw invalid({ migration: params.migration, detail: \"duplicate definition\" });\n }\n}\n\n/** Canonical metadata bytes. Array order is retained because declarations may be ordered. */\nexport function canonicalMigrationJson(params: { value: unknown }): string {\n const value = params.value;\n if (Array.isArray(value)) return `[${value.map((entry) => canonicalMigrationJson({ value: entry })).join(\",\")}]`;\n if (record(value)) return `{${Object.keys(value).filter((key) => value[key] !== undefined).sort().map((key) => `${JSON.stringify(key)}:${canonicalMigrationJson({ value: value[key] })}`).join(\",\")}}`;\n return JSON.stringify(value) ?? \"null\";\n}\n\n/** Absent metadata contributes no checksum bytes, preserving old applied migrations. */\nexport function desiredStateChecksumSuffix(params: { desiredState?: MigrationDesiredState }): string {\n if (params.desiredState === undefined) return \"\";\n assertDesiredState({ value: params.desiredState, migration: \"checksum\" });\n return `\\n-- vibeorm:desired-state ${canonicalMigrationJson({ value: params.desiredState })}`;\n}\n\n/** Serialize metadata for a NEW migration; never retrofit an applied directory. */\nexport function serializeDesiredStateSidecar(params: { desiredState: MigrationDesiredState }): string {\n assertDesiredState({ value: params.desiredState, migration: \"serialize\" });\n return JSON.stringify(params.desiredState, null, 2) + \"\\n\";\n}\n\n/** Parse and validate a reviewed desired-state file. */\nexport function parseDesiredStateSidecar(params: { text: string; migration: string }): MigrationDesiredState {\n return parseMigrationMetadata({ text: params.text, parse: (value) => {\n const checked = { value, migration: params.migration };\n assertDesiredState(checked);\n return checked.value;\n }, failure: (cause) => invalid({ migration: params.migration, detail: \"malformed metadata\", cause }) });\n}\n\n/** Shared typed JSON boundary for desired-state and immutable module metadata. */\nexport function parseMigrationMetadata<T>(params: { text: string; parse: (value: unknown) => T; failure: (cause: unknown) => VibeError }): T {\n try {\n return params.parse(JSON.parse(params.text) as unknown);\n } catch (cause) {\n throw params.failure(cause);\n }\n}\n",
|
|
29
|
-
"import { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { SqlObjectIdentity } from \"@vibeorm/schema\";\nimport { canonicalMigrationJson } from \"./desired-state.ts\";\nimport type { DesiredState, MigrationDesiredState } from \"./desired-state.ts\";\nimport type { ModuleMigrationOrigin } from \"./module-origin.ts\";\nimport { schemaObjectIdentities } from \"./object-ownership.ts\";\nimport { inspectMigrationInventory } from \"./inventory.ts\";\nimport { introspectPhysicalPostgres } from \"./introspect/postgres.ts\";\nimport { introspectMysql } from \"./introspect/mysql.ts\";\nimport { introspectSqlite } from \"./introspect/sqlite.ts\";\nimport { migrationNamespace } from \"./inspect-objects.ts\";\nimport type { SqlExecutor } from \"./types.ts\";\n\nfunction refusal(params: { reason: string; moduleId?: string; identity?: SqlObjectIdentity }): VibeError {\n return new VibeError({ code: \"VIBE_MIGRATION\", message: \"Module ownership or dependencies cannot be reconciled with the declared and live schema; no package SQL was authorized\", meta: params });\n}\nfunction identities(params: { state: DesiredState; dialect: MigrationDesiredState[\"dialect\"]; namespace: string }): SqlObjectIdentity[] {\n return [...schemaObjectIdentities({ schema: params.state.schema, dialect: params.dialect, namespace: params.namespace }), ...(params.state.schema.migrationObjects ?? []).map((object) => object.identity), ...params.state.definitions.map((definition) => definition.identity)];\n}\n\n/** Baked placement; MySQL authors must name the actual application database. */\nexport function moduleNamespace(params: { origin: ModuleMigrationOrigin }): string {\n if (params.origin.dialect !== \"mysql\") return params.origin.dialect === \"sqlite\" ? \"main\" : \"public\";\n const first = params.origin.owned[0];\n if (first === undefined) throw refusal({ reason: \"module-namespace-required\", moduleId: params.origin.moduleId });\n return \"table\" in first ? first.table.namespace : first.name.namespace;\n}\n\n/** Derive the complete exact ownership set from source declarations, not a naming prefix. */\nexport function moduleOwnedObjects(params: { desiredState: MigrationDesiredState; namespace?: string }): readonly SqlObjectIdentity[] {\n const { desiredState } = params;\n const namespace = params.namespace ?? (desiredState.dialect === \"sqlite\" ? \"main\" : \"public\");\n const all = [desiredState.from, desiredState.to, ...(desiredState.down === undefined ? [] : [desiredState.down])].flatMap((state) => identities({ state, dialect: desiredState.dialect, namespace }));\n return [...new Map(all.map((identity) => [sqlObjectKey({ identity }), identity])).values()].sort((a, b) => sqlObjectKey({ identity: a }).localeCompare(sqlObjectKey({ identity: b })));\n}\n\n/** A checksum does not turn extra ownership claims into authority over application objects. */\nexport function assertModuleOwnership(params: { origin: ModuleMigrationOrigin; desiredState?: MigrationDesiredState }): void {\n const { origin } = params;\n const state = origin.source.desiredState!;\n const namespace = moduleNamespace({ origin });\n const expected = moduleOwnedObjects({ desiredState: state, namespace });\n const owned = new Set(origin.owned.map((identity) => sqlObjectKey({ identity })));\n if (expected.length !== owned.size || expected.some((identity) => !owned.has(sqlObjectKey({ identity })))) throw refusal({ reason: \"module-ownership-invalid\", moduleId: origin.moduleId });\n for (const identity of expected) {\n const name = \"table\" in identity ? identity.table : typeof identity.name === \"object\" ? identity.name : undefined;\n if (name?.namespace !== namespace || name.name === \"_vibe_migrations\") throw refusal({ reason: \"module-ownership-invalid\", moduleId: origin.moduleId, identity });\n }\n for (const target of [state.from, state.to, ...(state.down === undefined ? [] : [state.down])]) {\n if (target.schema.rls !== undefined || target.schema.extensions.length > 0) throw refusal({ reason: \"module-schema-unsupported\", moduleId: origin.moduleId });\n for (const dependency of [...target.definitions.flatMap((definition) => definition.dependencies), ...(target.schema.migrationObjects ?? []).flatMap((object) => object.dependsOn), ...(state.unmanagedRemovals ?? [])]) {\n if (!owned.has(sqlObjectKey({ identity: dependency }))) throw refusal({ reason: \"module-external-dependency\", moduleId: origin.moduleId, identity: dependency });\n }\n }\n if (params.desiredState === undefined) return;\n const local = params.desiredState;\n const rest = (actual: DesiredState, source: DesiredState): unknown => {\n const tables = new Set(source.schema.models.map((model) => model.dbName ?? model.name));\n const enums = new Set(source.schema.enums.map((entry) => entry.dbName ?? entry.name));\n const selected = actual.schema.models.filter((model) => tables.has(model.dbName ?? model.name));\n const selectedEnums = actual.schema.enums.filter((entry) => enums.has(entry.dbName ?? entry.name));\n if (canonicalMigrationJson({ value: selected }) !== canonicalMigrationJson({ value: source.schema.models }) || canonicalMigrationJson({ value: selectedEnums }) !== canonicalMigrationJson({ value: source.schema.enums })) throw refusal({ reason: \"module-source-state-mismatch\", moduleId: origin.moduleId });\n const selectedObjects = (actual.schema.migrationObjects ?? []).filter((object) => owned.has(sqlObjectKey({ identity: object.identity })));\n const selectedDefinitions = actual.definitions.filter((definition) => owned.has(sqlObjectKey({ identity: definition.identity })));\n if (canonicalMigrationJson({ value: selectedObjects }) !== canonicalMigrationJson({ value: source.schema.migrationObjects ?? [] }) || canonicalMigrationJson({ value: selectedDefinitions }) !== canonicalMigrationJson({ value: source.definitions })) throw refusal({ reason: \"module-source-state-mismatch\", moduleId: origin.moduleId });\n return { ...actual, schema: { ...actual.schema, models: actual.schema.models.filter((model) => !tables.has(model.dbName ?? model.name)), enums: actual.schema.enums.filter((entry) => !enums.has(entry.dbName ?? entry.name)), migrationObjects: (actual.schema.migrationObjects ?? []).filter((object) => !owned.has(sqlObjectKey({ identity: object.identity }))) }, definitions: actual.definitions.filter((definition) => !owned.has(sqlObjectKey({ identity: definition.identity }))) };\n };\n const before = canonicalMigrationJson({ value: rest(local.from, state.from) });\n if (before !== canonicalMigrationJson({ value: rest(local.to, state.to) }) || before !== canonicalMigrationJson({ value: rest(local.down ?? local.from, state.down ?? state.from) })) throw refusal({ reason: \"module-mutates-application-state\", moduleId: origin.moduleId });\n}\n\n/** Inspect full physical inventory: new objects cannot claim existing app objects or external dependents. */\nexport async function assertLiveModuleOwnership(params: { executor: SqlExecutor; origin: ModuleMigrationOrigin; resume?: boolean }): Promise<void> {\n const { executor, origin } = params;\n const namespace = moduleNamespace({ origin });\n if (await migrationNamespace({ executor, dialect: origin.dialect }) !== namespace) throw refusal({ reason: \"module-placement-mismatch\", moduleId: origin.moduleId });\n const inventory = await inspectMigrationInventory({ executor, dialect: origin.dialect, namespace });\n const before = new Set(identities({ state: origin.source.desiredState!.from, dialect: origin.dialect, namespace }).map((identity) => sqlObjectKey({ identity })));\n const owned = new Set(origin.owned.map((identity) => sqlObjectKey({ identity })));\n const tables = new Set(origin.owned.flatMap((identity) => identity.kind === \"table\" ? [identity.name.name] : []));\n for (const object of inventory) {\n const key = sqlObjectKey({ identity: object.identity });\n if (params.resume !== true && owned.has(key) && !before.has(key)) throw refusal({ reason: \"module-object-collision\", moduleId: origin.moduleId, identity: object.identity });\n if (!owned.has(key) && ([\"function\", \"view\", \"trigger\"].includes(object.identity.kind) || \"table\" in object.identity && tables.has(object.identity.table.name) && object.backingConstraint === undefined)) throw refusal({ reason: \"module-external-dependency\", moduleId: origin.moduleId, identity: object.identity });\n if (object.inspectionUnavailable !== undefined && (owned.has(key) || \"table\" in object.identity && tables.has(object.identity.table.name))) throw refusal({ reason: \"module-dependency-unavailable\", moduleId: origin.moduleId, identity: object.identity });\n }\n const physical = origin.dialect === \"postgres\" ? await introspectPhysicalPostgres({ executor }) : origin.dialect === \"mysql\" ? await introspectMysql({ executor }) : await introspectSqlite({ executor });\n for (const model of physical.models) for (const relation of model.relations) {\n const target = physical.models.find((candidate) => candidate.name === relation.targetModel);\n if (target !== undefined && tables.has(model.dbName ?? model.name) !== tables.has(target.dbName ?? target.name)) throw refusal({ reason: \"module-external-dependency\", moduleId: origin.moduleId });\n }\n}\n",
|
|
30
|
-
"import { VibeError, sqlObjectKey, enumStorageOf } from \"@vibeorm/schema\";\nimport type { Dialect, ExtensionArtifact, MigrationObjectIR, SchemaIR, SqlObjectIdentity } from \"@vibeorm/schema\";\nimport type { MigrationStep } from \"./types.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { normalizeSchema } from \"./normalize.ts\";\n\n/** Legacy artifact registrations enter the same identity pipeline as migration-only objects. */\nexport function legacyMigrationObjects(params: { artifacts: readonly ExtensionArtifact[]; dialect: Dialect; namespace: string }): MigrationObjectIR[] {\n return params.artifacts.map((artifact) => {\n const owner = artifact.owns;\n const table = \"table\" in owner ? { namespace: params.namespace, name: owner.table } : undefined;\n let identity: SqlObjectIdentity;\n switch (owner.kind) {\n case \"postgresExtension\": case \"table\": identity = { kind: owner.kind, name: { namespace: params.namespace, name: owner.name } }; break;\n case \"column\": identity = { kind: \"column\", table: table!, column: owner.column }; break;\n case \"index\": case \"trigger\": identity = { kind: owner.kind, table: table!, name: owner.name }; break;\n }\n return { id: artifact.id, dialect: params.dialect, identity, create: artifact.create, drop: artifact.drop, dependsOn: artifact.expected?.dependencies ?? [], ...(artifact.expected === undefined ? {} : { expected: artifact.expected }) };\n });\n}\n\n/** Remove only migration-owned portions of physical IR, preserving unrelated fields and constraints. */\nexport function preserveMigrationObjects(params: { from: SchemaIR; to: SchemaIR; objects: readonly MigrationObjectIR[]; namespace?: string }): SchemaIR {\n const namespace = params.namespace ?? (params.to.datasource.provider === \"sqlite\" ? \"main\" : \"public\");\n const objects = params.objects.filter((object) => (\"table\" in object.identity ? object.identity.table.namespace : object.identity.name.namespace) === namespace);\n const models = params.from.models.flatMap((model) => {\n const table = model.dbName ?? model.name;\n const target = params.to.models.find((entry) => (entry.dbName ?? entry.name) === table);\n if (objects.some((object) => (object.identity.kind === \"table\" || object.identity.kind === \"view\") && object.identity.name.name === table)) return [];\n const owners = objects.map((object) => object.identity).filter((identity) => \"table\" in identity && identity.table.name === table);\n return [{ ...model,\n fields: model.fields.flatMap((field) => {\n const column = field.dbName ?? field.name;\n if (owners.some((owner) => owner.kind === \"column\" && owner.column === column)) return [];\n if (owners.some((owner) => (owner.kind === \"columnDefault\" || owner.kind === \"generatedColumn\") && owner.column === column)) {\n const authored = target?.fields.find((entry) => (entry.dbName ?? entry.name) === column);\n if (authored === undefined) return [field];\n const { default: ignored, ...rest } = field;\n return [{ ...rest, ...(authored.default === undefined ? {} : { default: authored.default }) }];\n }\n return [field];\n }),\n exclusions: (model.exclusions ?? []).filter((exclusion) => !owners.some((owner) => owner.kind === \"constraint\" && owner.constraintType === \"exclusion\" && owner.name === exclusion.name)),\n checks: (model.checks ?? []).filter((check) => !owners.some((owner) => owner.kind === \"constraint\" && owner.constraintType === \"check\" && owner.name === check.name)),\n indexes: model.indexes.filter((index) => !owners.some((owner) => owner.kind === \"index\" && owner.name === index.name)),\n relations: model.relations.filter((relation) => !owners.some((owner) => owner.kind === \"constraint\" && owner.constraintType === \"foreignKey\" && owner.name === relation.constraintName)),\n }];\n });\n const enums = params.from.enums.filter((enumDef) => enumStorageOf({ enumDef }) === \"string\" || !objects.some((object) => object.identity.kind === \"enum\" && object.identity.name.name === (enumDef.dbName ?? enumDef.name)));\n return { ...params.from, models, enums };\n}\n\n/** Rebuild targets must retain migration-owned constraints and indexes that the core diff excludes. */\nexport function sqlitePreservedSchema(params: { from: SchemaIR; to: SchemaIR; objects: readonly MigrationObjectIR[] }): SchemaIR {\n return { ...params.to, models: params.to.models.map((model) => {\n const table = model.dbName ?? model.name;\n const before = params.from.models.find((entry) => (entry.dbName ?? entry.name) === table);\n if (before === undefined) return model;\n const owners = params.objects.map((object) => object.identity).filter((owner) => \"table\" in owner && owner.table.namespace === \"main\" && owner.table.name === table);\n return { ...model,\n checks: [...(model.checks ?? []), ...(before.checks ?? []).filter((check) => !model.checks?.some((entry) => entry.name === check.name) && owners.some((owner) => owner.kind === \"constraint\" && owner.constraintType === \"check\" && owner.name === check.name))],\n indexes: [...model.indexes, ...before.indexes.filter((index) => !model.indexes.some((entry) => entry.name === index.name) && owners.some((owner) => owner.kind === \"index\" && owner.name === index.name))],\n relations: [...model.relations, ...before.relations.filter((relation) => !model.relations.some((entry) => entry.constraintName === relation.constraintName) && owners.some((owner) => owner.kind === \"constraint\" && owner.constraintType === \"foreignKey\" && owner.name === relation.constraintName))],\n };\n }) };\n}\n\n/** Physical identity of a removal proposed by the core differ. */\nexport function removalIdentity(params: { step: MigrationStep; namespace: string }): SqlObjectIdentity | undefined {\n const { step, namespace } = params;\n const table = \"table\" in step && step.table !== undefined ? { namespace, name: step.table } : undefined;\n switch (step.kind) {\n case \"dropEnum\": return { kind: \"enum\", name: { namespace, name: step.enumName } };\n case \"dropTable\": case \"dropJoinTable\": return { kind: \"table\", name: table! };\n case \"dropView\": return { kind: \"view\", name: table! };\n case \"dropColumn\": return { kind: \"column\", table: table!, column: step.column };\n case \"alterColumn\": return step.changes.includes(\"default\") && step.from.default !== undefined ? { kind: \"columnDefault\", table: table!, column: step.column } : undefined;\n case \"dropIndex\": return table === undefined ? undefined : step.constraintName === undefined ? { kind: \"index\", table, name: step.name } : { kind: \"constraint\", constraintType: \"unique\", table, name: step.constraintName };\n case \"dropExclusion\": return { kind: \"constraint\", constraintType: \"exclusion\", table: table!, name: step.exclusion.name };\n case \"dropCheck\": return { kind: \"constraint\", constraintType: \"check\", table: table!, name: step.name };\n case \"dropForeignKey\": return { kind: \"constraint\", constraintType: \"foreignKey\", table: table!, name: step.constraintName };\n case \"dropPrimaryKey\": return { kind: \"constraint\", constraintType: \"primaryKey\", table: table!, name: step.constraintName ?? `${step.table}_pkey` };\n default: return undefined;\n }\n}\n\n/** Known ownership from the previous authored declaration, not a target snapshot. */\nexport function schemaObjectIdentities(params: { schema: SchemaIR; dialect: Dialect; namespace: string }): SqlObjectIdentity[] {\n const normalized = normalizeSchema({ schema: params.schema, dialect: params.dialect });\n const result: SqlObjectIdentity[] = [];\n if (params.dialect === \"postgres\") for (const name of normalized.enums.keys()) result.push({ kind: \"enum\", name: { namespace: params.namespace, name } });\n for (const [name, model] of normalized.tables) {\n const table = { namespace: params.namespace, name };\n result.push({ kind: \"table\", name: table });\n for (const [column, definition] of model.columns) {\n result.push({ kind: \"column\", table, column });\n if (definition.defaultKey !== null) result.push({ kind: \"columnDefault\", table, column });\n if (params.dialect === \"postgres\" && definition.field.default?.kind === \"autoincrement\") result.push({ kind: \"sequence\", name: { namespace: params.namespace, name: `${name}_${column}_seq` } });\n }\n for (const exclusion of model.model.exclusions ?? []) result.push({ kind: \"constraint\", constraintType: \"exclusion\", table, name: exclusion.name });\n for (const check of model.checks.keys()) result.push({ kind: \"constraint\", constraintType: \"check\", table, name: check });\n for (const index of model.indexes.values()) {\n result.push({ kind: \"index\", table, name: index.name });\n if (index.constraintName !== undefined) result.push({ kind: \"constraint\", constraintType: \"unique\", table, name: index.constraintName });\n }\n for (const fk of model.fks.values()) result.push({ kind: \"constraint\", constraintType: \"foreignKey\", table, name: fk.constraintName });\n if (model.pk.length > 0) result.push({ kind: \"constraint\", constraintType: \"primaryKey\", table, name: model.model.primaryKeyConstraintName ?? (params.dialect === \"mysql\" ? \"PRIMARY\" : `${name}_pkey`) });\n }\n for (const name of normalized.joinTables.keys()) {\n const table = { namespace: params.namespace, name };\n result.push({ kind: \"table\", name: table });\n for (const column of [\"A\", \"B\"]) result.push({ kind: \"column\", table, column }, { kind: \"constraint\", constraintType: \"foreignKey\", table, name: `${name}_${column}_fkey` });\n for (const suffix of [\"AB_unique\", \"B_index\"]) result.push({ kind: \"index\", table, name: `${name}_${suffix}` });\n }\n for (const name of normalized.views.keys()) result.push({ kind: \"view\", name: { namespace: params.namespace, name } });\n return result;\n}\n\n/** A removed registration cannot silently surrender previously trusted ownership. */\nexport function assertRetainedMigrationObjects(params: { from: readonly MigrationObjectIR[]; to: readonly MigrationObjectIR[] }): void {\n const keys = new Set(params.to.map((object) => sqlObjectKey({ identity: object.identity })));\n const removed = params.from.filter((object) => !keys.has(sqlObjectKey({ identity: object.identity })));\n if (removed.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Removing migration ownership requires a reviewed hand-authored migration and new desired state\", meta: { reason: \"migration-object-removal-review-required\", objects: removed.map((object) => object.identity) } });\n}\n\n/** One dependency order for live planning, authored generation and reverse artifact removal. */\nexport function orderedMigrationObjects(params: { objects: readonly MigrationObjectIR[] }): MigrationObjectIR[] {\n const byKey = new Map(params.objects.map((object) => [sqlObjectKey({ identity: object.identity }), object]));\n const result: MigrationObjectIR[] = [];\n const visiting = new Set<string>();\n const visited = new Set<string>();\n const visit = (object: MigrationObjectIR): void => {\n const key = sqlObjectKey({ identity: object.identity });\n if (visited.has(key)) return;\n if (visiting.has(key)) throw new VibeError({ code: \"VIBE_SCHEMA_INVALID\", message: \"Migration object dependency cycle\", meta: { id: object.id } });\n visiting.add(key);\n for (const dependency of object.dependsOn) { const target = byKey.get(sqlObjectKey({ identity: dependency })); if (target !== undefined) visit(target); }\n visiting.delete(key);\n visited.add(key);\n result.push(object);\n };\n for (const object of params.objects) visit(object);\n return result;\n}\n\n/** Exact unmanaged identities require acknowledgement even when removal is collateral DDL. */\nexport function assertNamedRemovals(params: { removals: readonly SqlObjectIdentity[]; approved?: readonly SqlObjectIdentity[]; acceptIntegrityLoss?: boolean }): void {\n const approved = new Set((params.approved ?? []).map((identity) => sqlObjectKey({ identity })));\n const missing = params.removals.filter((identity) => !approved.has(sqlObjectKey({ identity })));\n if (missing.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Unmanaged removals require individually named approvals\", meta: { reason: \"unmanaged-removal-required\", objects: missing } });\n const integrity = params.removals.filter((identity) => identity.kind === \"constraint\" || identity.kind === \"index\");\n if (integrity.length > 0 && params.acceptIntegrityLoss !== true) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Named constraint or index removals also require acceptIntegrityLoss\", meta: { reason: \"integrity-acknowledgement-required\", objects: integrity } });\n}\n\n/** Independent authorizations: row loss does not authorize integrity loss or unnamed removals. */\nexport function assertRemovalAuthorization(params: { steps: readonly MigrationStep[]; previous?: DesiredState; dialect: Dialect; namespace: string; acceptIntegrityLoss?: boolean; removeUnmanaged?: readonly SqlObjectIdentity[] }): void {\n const declared = params.previous === undefined ? [] : schemaObjectIdentities({ schema: params.previous.schema, dialect: params.dialect, namespace: params.namespace });\n const known = new Set(declared.map((identity) => sqlObjectKey({ identity })));\n const approved = new Set((params.removeUnmanaged ?? []).map((identity) => sqlObjectKey({ identity })));\n const unknown: SqlObjectIdentity[] = [];\n const integrity: SqlObjectIdentity[] = [];\n for (const step of params.steps) {\n const identity = removalIdentity({ step, namespace: params.namespace });\n if (identity === undefined) continue;\n const key = sqlObjectKey({ identity });\n if (!known.has(key) && !approved.has(key)) unknown.push(identity);\n if (identity.kind === \"constraint\" || identity.kind === \"index\") integrity.push(identity);\n if (step.kind === \"dropTable\" || step.kind === \"dropJoinTable\") {\n for (const child of [...declared, ...(params.removeUnmanaged ?? [])]) {\n if ((child.kind === \"constraint\" || child.kind === \"index\") && child.table.namespace === params.namespace && child.table.name === step.table) integrity.push(child);\n }\n }\n }\n if (unknown.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Unknown object removals require individually named removeUnmanaged decisions\", meta: { reason: \"unmanaged-removal-required\", objects: unknown } });\n if (integrity.length > 0 && params.acceptIntegrityLoss !== true) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Constraint or index removal requires acceptIntegrityLoss; data-loss acknowledgement does not authorize it\", meta: { reason: \"integrity-acknowledgement-required\", objects: integrity } });\n}\n",
|
|
31
|
-
"import { VibeError, isSqlObjectIdentity, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, QualifiedSqlName, SqlObjectIdentity } from \"@vibeorm/schema\";\nimport { getSqlDialect, renderMigrationInventory, renderSqliteColumnInventory, renderMysqlObjectMembers, sqliteTableConstraints, renderSqliteForeignKeyInventory } from \"@vibeorm/sql\";\nimport type { SqlExecutor } from \"./types.ts\";\nimport { assertCatalogVisibility } from \"./inspect-objects.ts\";\nimport { parseSqliteNamedChecks } from \"./sqlite-types.ts\";\n\n/** Live identities remain observations and cannot establish desired ownership. */\nexport type CatalogObject = { readonly identity: SqlObjectIdentity; readonly backingConstraint?: string; readonly inspectionUnavailable?: string };\n\n/** Enumerate live objects in the migration namespace. Permission errors propagate as unavailable. */\nexport async function inspectMigrationInventory(params: { executor: SqlExecutor; dialect: Dialect; namespace: string }): Promise<readonly CatalogObject[]> {\n await assertCatalogVisibility(params);\n const query = renderMigrationInventory({ dialect: getSqlDialect({ dialect: params.dialect }), namespace: params.namespace });\n const rows = await params.executor({ text: query.text, values: [...query.values] });\n const objects: CatalogObject[] = [];\n const kinds: Readonly<Record<string, \"check\" | \"foreignKey\" | \"exclusion\" | \"unique\" | \"primaryKey\">> = {\n c: \"check\", f: \"foreignKey\", x: \"exclusion\", u: \"unique\", p: \"primaryKey\", CHECK: \"check\", \"FOREIGN KEY\": \"foreignKey\", UNIQUE: \"unique\", \"PRIMARY KEY\": \"primaryKey\",\n };\n for (const row of rows) {\n const name = row.name;\n if (typeof name !== \"string\" || typeof row.kind !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Malformed catalog identity\", meta: { reason: \"inventory-unavailable\" } });\n const qualified: QualifiedSqlName = { namespace: params.namespace, name };\n const table: QualifiedSqlName = { namespace: params.namespace, name: String(row.parent ?? \"\") };\n let identity: SqlObjectIdentity;\n switch (row.kind) {\n case \"table\": case \"view\": case \"sequence\": identity = { kind: row.kind, name: qualified }; break;\n case \"trigger\": case \"index\": identity = { kind: row.kind, table, name }; break;\n case \"column\": case \"columnDefault\": case \"generatedColumn\": identity = { kind: row.kind, table, column: name }; break;\n case \"constraint\": {\n const constraintType = kinds[String(row.subtype)];\n if (constraintType === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Unknown constraint catalog kind\", meta: { reason: \"inventory-unavailable\" } });\n identity = { kind: \"constraint\", table, name, constraintType };\n break;\n }\n case \"function\": {\n let argumentTypes: unknown = JSON.parse(String(row.signature));\n if (params.dialect === \"mysql\") {\n const query = renderMysqlObjectMembers({ dialect: getSqlDialect({ dialect: params.dialect }), identity: { kind: \"function\", name: qualified, argumentTypes: [] } })!;\n const members = await params.executor({ text: query.text, values: [...query.values] });\n if (members.length === 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"MySQL function signature unavailable\", meta: { reason: \"inventory-unavailable\", name } });\n argumentTypes = members.filter((member) => member.mode !== null).map((member) => ({ namespace: \"mysql\", name: String(member.type) }));\n }\n const candidate = { kind: \"function\", name: qualified, argumentTypes };\n if (!isSqlObjectIdentity(candidate)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Invalid function signature in catalog\", meta: { reason: \"inventory-unavailable\" } });\n identity = candidate;\n break;\n }\n default: throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Unknown catalog object kind ${row.kind}`, meta: { reason: \"inventory-unavailable\" } });\n }\n objects.push({ identity, ...(typeof row.backing === \"string\" ? { backingConstraint: row.backing } : {}) });\n if (params.dialect === \"sqlite\" && row.kind === \"table\" && typeof row.definition === \"string\" && !/^\\s*CREATE\\s+VIRTUAL\\s+TABLE\\b/i.test(row.definition)) {\n const clauses = sqliteTableConstraints({ sql: row.definition });\n for (const constraint of clauses) {\n if (constraint.type === \"check\") continue;\n const name = constraint.named ? constraint.name : constraint.type === \"primaryKey\" ? `${qualified.name}_pkey` : constraint.type === \"foreignKey\" ? `${qualified.name}_${constraint.columns.join(\"_\")}_fkey` : constraint.name;\n objects.push({ identity: { kind: \"constraint\", constraintType: constraint.type, table: qualified, name }, ...(constraint.type === \"unique\" && !constraint.named ? { inspectionUnavailable: \"sqlite-anonymous-unique-constraint\" } : {}) });\n }\n const checks = parseSqliteNamedChecks({ tableSql: row.definition });\n for (const check of checks) objects.push({ identity: { kind: \"constraint\", constraintType: \"check\", table: qualified, name: check.name } });\n // This is a conservative detector, not a SQL expression parser. Unnamed\n // CHECKs cannot be individually represented by the core IR and must not\n // disappear in a rebuild. A token in a literal may conservatively refuse.\n if ([...row.definition.matchAll(/\\bCHECK\\s*\\(/gi)].length > checks.length) objects.push({ identity: { kind: \"table\", name: qualified }, inspectionUnavailable: \"sqlite-unnamed-check-definition-unavailable\" });\n const query = renderSqliteColumnInventory({ dialect: getSqlDialect({ dialect: params.dialect }), namespace: params.namespace, table: name });\n const columns = await params.executor({ text: query.text, values: [...query.values] });\n if (columns.some((column) => Number(column.pk) > 0) && !clauses.some((clause) => clause.type === \"primaryKey\")) objects.push({ identity: { kind: \"constraint\", constraintType: \"primaryKey\", table: qualified, name: `${qualified.name}_pkey` } });\n const fkQuery = renderSqliteForeignKeyInventory({ dialect: getSqlDialect({ dialect: params.dialect }), namespace: params.namespace, table: name });\n const foreignKeys = await params.executor({ text: fkQuery.text, values: [...fkQuery.values] });\n const groups = new Map<number, string[]>();\n for (const fk of foreignKeys) groups.set(Number(fk.id), [...(groups.get(Number(fk.id)) ?? []), String(fk.from)]);\n for (const fields of groups.values()) {\n if (clauses.some((clause) => clause.type === \"foreignKey\" && JSON.stringify(clause.columns) === JSON.stringify(fields))) continue;\n objects.push({ identity: { kind: \"constraint\", constraintType: \"foreignKey\", table: qualified, name: `${qualified.name}_${fields.join(\"_\")}_fkey` }, inspectionUnavailable: \"sqlite-inline-foreign-key-definition-unavailable\" });\n }\n for (const column of columns) {\n objects.push({ identity: { kind: \"column\", table: qualified, column: String(column.name) } });\n if (Number(column.hidden) > 1) objects.push({ identity: { kind: \"generatedColumn\", table: qualified, column: String(column.name) } });\n else if (column.definition !== null && column.definition !== undefined) objects.push({ identity: { kind: \"columnDefault\", table: qualified, column: String(column.name) } });\n }\n }\n }\n return [...new Map(objects.map((object) => [sqlObjectKey({ identity: object.identity }), object])).values()];\n}\n",
|
|
32
|
-
"import { randomUUID } from \"node:crypto\";\nimport { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { SchemaIR, ExclusionIR, SqlObjectIdentity } from \"@vibeorm/schema\";\nimport { postgresDialect, renderExclusionCatalog, renderExclusionProbe } from \"@vibeorm/sql\";\nimport type { SqlExecutor } from \"./types.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport type { MigrationObjectState, MigrationStateDifference } from \"./inspect-objects.ts\";\n\n/** Normalize an independently authored definition on an empty clone, rolled back by the caller's session. */\nexport async function deparseExclusion(params: { executor: SqlExecutor; table: string; definition: string }): Promise<string> {\n const probe = `vibe_exclusion_${randomUUID().replaceAll(\"-\", \"\")}`;\n await params.executor({ text: \"SAVEPOINT vibe_exclusion_probe\" });\n try {\n for (const text of renderExclusionProbe({ dialect: postgresDialect, table: params.table, probe, definition: params.definition })) await params.executor({ text });\n const rows = await params.executor({ text: renderExclusionCatalog({ dialect: postgresDialect, probe }) });\n if (typeof rows[0]?.definition !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Exclusion probe unavailable\", meta: { reason: \"exclusion-inspection-unavailable\" } });\n return rows[0].definition;\n } finally {\n await params.executor({ text: \"ROLLBACK TO SAVEPOINT vibe_exclusion_probe\" });\n await params.executor({ text: \"RELEASE SAVEPOINT vibe_exclusion_probe\" });\n }\n}\n\n/** Establish definition equivalence before the pure differ sees catalog SQL. */\nexport async function prepareExclusionDiff(params: { executor: SqlExecutor; from: SchemaIR; to: SchemaIR; previous?: DesiredState; probe?: string; replaceChecks?: readonly SqlObjectIdentity[] }): Promise<SchemaIR> {\n const models = [];\n for (const model of params.from.models) {\n const table = model.dbName ?? model.name;\n const target = params.to.models.find((entry) => (entry.dbName ?? entry.name) === table);\n const exclusions: ExclusionIR[] = [];\n for (const before of model.exclusions ?? []) {\n const next = target?.exclusions?.find((entry) => entry.name === before.name);\n if (next === undefined || next.definition === before.definition) { exclusions.push(before); continue; }\n const identity: SqlObjectIdentity = { kind: \"constraint\", constraintType: \"exclusion\", table: { namespace: \"public\", name: table }, name: before.name };\n if (params.probe === \"rollback\") {\n const normalized = await deparseExclusion({ executor: params.executor, table, definition: next.definition });\n exclusions.push(normalized === before.definition ? next : { name: before.name, definition: before.definition, requiredExtensions: before.requiredExtensions });\n continue;\n }\n const previous = params.previous?.schema.models.find((entry) => (entry.dbName ?? entry.name) === table)?.exclusions?.find((entry) => entry.name === before.name);\n if (previous !== undefined) { exclusions.push(previous); continue; }\n if (params.replaceChecks?.some((entry) => sqlObjectKey({ identity: entry }) === sqlObjectKey({ identity }))) { exclusions.push({ name: before.name, definition: before.definition, requiredExtensions: before.requiredExtensions }); continue; }\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Exclusion equivalence requires a rollback probe or explicit replacement\", meta: { reason: \"explicit-replacement-required\", identity } });\n }\n models.push({ ...model, exclusions });\n }\n return { ...params.from, models };\n}\n\n/** Verify definition and enforcement without treating a backing index as an ordinary index. */\nexport async function verifyExclusions(params: { executor: SqlExecutor; expected: DesiredState; probe?: string }): Promise<MigrationObjectState[]> {\n if (!params.expected.schema.models.some((model) => (model.exclusions?.length ?? 0) > 0)) return [];\n const rows = await params.executor({ text: renderExclusionCatalog({ dialect: postgresDialect }) });\n const objects: MigrationObjectState[] = [];\n for (const model of params.expected.schema.models) for (const exclusion of model.exclusions ?? []) {\n const table = model.dbName ?? model.name;\n const identity: SqlObjectIdentity = { kind: \"constraint\", constraintType: \"exclusion\", table: { namespace: \"public\", name: table }, name: exclusion.name };\n const row = rows.find((entry) => entry.table_name === table && entry.constraint_name === exclusion.name);\n if (row === undefined) { objects.push({ identity, ownership: \"schema\", state: \"missing\", differences: [] }); continue; }\n const differences: MigrationStateDifference[] = [\"validated\", \"valid\", \"ready\"].flatMap((attribute) => row[attribute] === true ? [] : [{ attribute, expected: true, actual: row[attribute] }]);\n const independentlyVerified = params.expected.definitions.some((entry) => sqlObjectKey({ identity: entry.identity }) === sqlObjectKey({ identity }));\n const definition = independentlyVerified ? row.definition : params.probe === \"rollback\" ? await deparseExclusion({ executor: params.executor, table, definition: exclusion.definition }) : (exclusion.normalizationSource === exclusion.definition ? exclusion.normalizedDefinition : undefined) ?? exclusion.definition;\n if (definition !== row.definition) differences.push({ attribute: \"definition\", expected: definition, actual: row.definition });\n objects.push({ identity, ownership: \"schema\", state: differences.length === 0 ? \"matching\" : params.probe === \"rollback\" ? \"changed\" : \"unavailable\", differences });\n }\n return objects;\n}\n",
|
|
33
|
-
"import { verifyExclusions } from \"./exclusions.ts\";\nimport { randomUUID } from \"node:crypto\";\nimport { VibeError, sqlObjectKey, DIALECT_CAPABILITIES } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR, SqlObjectDefinition, SqlObjectFacts, SqlObjectIdentity } from \"@vibeorm/schema\";\nimport { getSqlDialect, renderMigrationObjectQuery, renderCheckProbe, renderMigrationNamespace, renderMigrationDependencies, renderMysqlObjectMembers, renderMysqlCheckProbe, sqliteColumnClauses, renderMigrationVisibility, sqliteTableConstraints } from \"@vibeorm/sql\";\nimport type { SqlExecutor } from \"./types.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { canonicalMigrationJson } from \"./desired-state.ts\";\nimport { parseSqliteNamedChecks } from \"./sqlite-types.ts\";\nimport { introspectPhysicalPostgres } from \"./introspect/postgres.ts\";\nimport { introspectMysql } from \"./introspect/mysql.ts\";\nimport { introspectSqlite, introspectSqliteBeforeForeignKeyRestore } from \"./introspect/sqlite.ts\";\nimport { executeStatement } from \"./execute.ts\";\nimport { normalizeSchema } from \"./normalize.ts\";\nimport { equivalentPostgresDefaultFunction } from \"./postgres-default-equivalence.ts\";\nimport { schemaObjectIdentities } from \"./object-ownership.ts\";\n\n/** A single difference, not a boolean that hides disabled or changed objects. */\nexport type MigrationStateDifference = { readonly attribute: string; readonly expected: unknown; readonly actual: unknown };\n/** Ownership and live condition are independent dimensions. */\nexport type MigrationObjectState = {\n readonly identity: SqlObjectIdentity;\n readonly ownership: \"schema\" | \"migration\" | \"unknown\";\n readonly state: \"matching\" | \"missing\" | \"changed\" | \"unavailable\";\n readonly differences: readonly MigrationStateDifference[];\n readonly reason?: string;\n};\n/** A report only claims convergence when every requested definition was verified. */\nexport type MigrationStateReport = { readonly inSync: boolean; readonly objects: readonly MigrationObjectState[] };\n/** Catalog read outcome; missing is never substituted for insufficient privileges. */\nexport type InspectedSqlObject =\n | { readonly state: \"present\"; readonly definition: SqlObjectDefinition }\n | { readonly state: \"missing\" }\n | { readonly state: \"unavailable\"; readonly reason: string };\n\nfunction factsOf(params: { row: Record<string, unknown> }): SqlObjectFacts | undefined {\n const facts: Record<string, string | number | boolean | null | readonly string[]> = {};\n for (const [name, value] of Object.entries(params.row)) {\n if (value === null || typeof value === \"string\" || typeof value === \"boolean\" || (typeof value === \"number\" && Number.isFinite(value))) facts[name] = value;\n else if (Array.isArray(value) && value.every((entry) => typeof entry === \"string\")) facts[name] = value;\n else return undefined;\n }\n return facts;\n}\n\n/** Read an explicitly qualified object using the dialect's catalog renderer. */\nexport async function inspectSqlObject(params: { executor: SqlExecutor; dialect: Dialect; identity: SqlObjectIdentity }): Promise<InspectedSqlObject> {\n return Promise.resolve().then(async (): Promise<InspectedSqlObject> => {\n const namespace = \"table\" in params.identity ? params.identity.table.namespace : params.identity.name.namespace;\n const query = renderMigrationObjectQuery({ dialect: getSqlDialect({ dialect: params.dialect }), identity: params.identity });\n if (params.dialect === \"mysql\") await assertCatalogVisibility({ executor: params.executor, dialect: params.dialect, namespace });\n const rows = await params.executor({ text: query.text, values: [...query.values] });\n if (rows.length === 0) return { state: \"missing\" };\n if (rows.length !== 1) return { state: \"unavailable\", reason: \"ambiguous-catalog-identity\" };\n let facts = factsOf({ row: rows[0]! });\n if (facts === undefined) return { state: \"unavailable\", reason: \"unsupported-catalog-value\" };\n if (params.dialect === \"mysql\" && (params.identity.kind === \"function\" || params.identity.kind === \"view\") && facts.definition === null) return { state: \"unavailable\", reason: \"definition-not-visible\" };\n if (params.dialect === \"sqlite\" && params.identity.kind === \"constraint\") {\n const name = params.identity.name;\n if (params.identity.constraintType === \"check\") {\n const check = parseSqliteNamedChecks({ tableSql: String(facts.definition ?? \"\") }).find((entry) => entry.name === name);\n if (check === undefined) return { state: \"missing\" };\n facts = { type: \"check\", definition: check.expression };\n } else {\n const constraintType = params.identity.constraintType;\n const constraint = sqliteTableConstraints({ sql: String(facts.definition ?? \"\") }).find((entry) => entry.name === name && entry.type === constraintType);\n if (constraint === undefined) return { state: \"unavailable\", reason: \"constraint-definition-inspection-unavailable\" };\n facts = { type: constraint.type, definition: constraint.sql };\n }\n }\n if (params.dialect === \"sqlite\" && (params.identity.kind === \"column\" || params.identity.kind === \"columnDefault\" || params.identity.kind === \"generatedColumn\")) {\n const column = params.identity.column;\n const clause = sqliteColumnClauses({ sql: String(facts.tableDefinition ?? \"\") }).find((entry) => entry.name === column);\n if (clause === undefined) return { state: \"unavailable\", reason: \"column-definition-inspection-unavailable\" };\n const { tableDefinition: ignored, ...attributes } = facts;\n facts = { ...attributes, columnDefinition: clause.sql };\n }\n if (params.identity.kind === \"columnDefault\") facts = { definition: facts.definition ?? null };\n if (params.dialect === \"postgres\") {\n const query = renderMigrationDependencies({ dialect: getSqlDialect({ dialect: params.dialect }), identity: params.identity });\n const rows = await params.executor({ text: query.text, values: [...query.values] });\n if (rows.some((row) => typeof row.address !== \"string\")) return { state: \"unavailable\", reason: \"dependency-inspection-unavailable\" };\n facts = { ...facts, dependencyAddresses: rows.map((row) => String(row.address)).sort() };\n }\n if (params.dialect === \"mysql\") {\n const query = renderMysqlObjectMembers({ dialect: getSqlDialect({ dialect: params.dialect }), identity: params.identity });\n if (query !== undefined) {\n const rows = await params.executor({ text: query.text, values: [...query.values] });\n if (params.identity.kind === \"function\" && rows.length === 0) return { state: \"unavailable\", reason: \"function-signature-unavailable\" };\n if (params.identity.kind === \"function\") {\n const signature = rows.filter((row) => row.mode !== null).map((row) => ({ namespace: \"mysql\", name: String(row.type) }));\n if (canonicalMigrationJson({ value: signature }) !== canonicalMigrationJson({ value: params.identity.argumentTypes })) return { state: \"missing\" };\n }\n facts = { ...facts, members: rows.map((row) => canonicalMigrationJson({ value: row })) };\n }\n }\n const dependencies: SqlObjectIdentity[] = [];\n if (params.identity.kind === \"trigger\" && params.dialect === \"postgres\") {\n if (facts.functionArguments !== \"\") return { state: \"unavailable\", reason: \"trigger-function-signature-unavailable\" };\n dependencies.push({ kind: \"function\", name: { namespace: String(facts.functionNamespace), name: String(facts.functionName) }, argumentTypes: [] });\n }\n return { state: \"present\", definition: { identity: params.identity, facts, dependencies, format: \"catalog-v1\" } };\n }).catch((error: unknown): InspectedSqlObject => ({ state: \"unavailable\", reason: error instanceof VibeError ? String(error.meta.feature ?? error.code) : \"catalog-query-failed\" }));\n}\n\n/** Require provable catalog visibility; role-only/partial grants report unavailable rather than missing. */\nexport async function assertCatalogVisibility(params: { executor: SqlExecutor; dialect: Dialect; namespace: string }): Promise<void> {\n if (params.dialect !== \"mysql\") return;\n const query = renderMigrationVisibility({ dialect: getSqlDialect({ dialect: params.dialect }), namespace: params.namespace });\n const rows = await params.executor({ text: query.text, values: [...query.values] });\n const grants = new Set(rows.map((row) => row.privilege));\n const missing = [\"SELECT\", \"TRIGGER\", \"SHOW VIEW\", \"EXECUTE\"].filter((privilege) => !grants.has(privilege));\n if (missing.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"MySQL catalog visibility requires direct database-wide grants; role-only or partial grants cannot prove object absence\", meta: { reason: \"inventory-unavailable\", missing } });\n}\n\nfunction compare(params: { expected: SqlObjectDefinition; live: SqlObjectDefinition }): MigrationStateDifference[] {\n const differences: MigrationStateDifference[] = [];\n for (const key of new Set([...Object.keys(params.expected.facts), ...Object.keys(params.live.facts)])) {\n const expected = params.expected.facts[key];\n const actual = params.live.facts[key];\n if ((expected === undefined) !== (actual === undefined) || canonicalMigrationJson({ value: expected }) !== canonicalMigrationJson({ value: actual })) differences.push({ attribute: key, expected, actual });\n }\n const expected = params.expected.dependencies.map((identity) => sqlObjectKey({ identity })).sort();\n const actual = params.live.dependencies.map((identity) => sqlObjectKey({ identity })).sort();\n if (JSON.stringify(expected) !== JSON.stringify(actual)) differences.push({ attribute: \"dependencies\", expected, actual });\n return differences;\n}\n\n/** Probe modes make database writes and required privileges explicit. */\nexport function assertProbeMode(params: { dialect: Dialect; probe?: \"none\" | \"rollback\" | \"temporary\" }): void {\n if (params.probe !== undefined && params.probe !== \"none\" && DIALECT_CAPABILITIES[params.dialect].checkNormalization !== params.probe) throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: `${params.probe} CHECK probes are unavailable on ${params.dialect}`, meta: { feature: \"checkProbe\", dialect: params.dialect } });\n}\n\n/** Read-only by default. The report never treats an absent expectation as a match. */\nexport async function verifyMigrationState(params: { executor: SqlExecutor; expected: DesiredState; dialect: Dialect; probe?: \"none\" | \"rollback\" | \"temporary\" }): Promise<MigrationStateReport> {\n return verifyState(params);\n}\n\nasync function verifyState(params: Parameters<typeof verifyMigrationState>[0] & { sqliteRestorePending?: true }): Promise<MigrationStateReport> {\n assertProbeMode({ dialect: params.dialect, probe: params.probe });\n const declarations = params.expected.schema.migrationObjects ?? [];\n const owned = new Set(declarations.map((object) => sqlObjectKey({ identity: object.identity })));\n const definitions = new Map(params.expected.definitions.map((definition) => [sqlObjectKey({ identity: definition.identity }), definition]));\n const identities = new Map(params.expected.definitions.map((definition) => [sqlObjectKey({ identity: definition.identity }), definition.identity]));\n for (const object of declarations) identities.set(sqlObjectKey({ identity: object.identity }), object.identity);\n const objects: MigrationObjectState[] = [];\n for (const [key, identity] of identities) {\n const ownership = owned.has(key) ? \"migration\" : \"schema\";\n const expected = definitions.get(key);\n const live = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n if (live.state !== \"present\") {\n objects.push({ identity, ownership, state: live.state, differences: [], ...(live.state === \"unavailable\" ? { reason: live.reason } : {}) });\n } else if (expected === undefined) {\n objects.push({ identity, ownership, state: \"unavailable\", reason: \"independent-definition-required\", differences: [] });\n } else if (params.dialect === \"postgres\" && identity.kind === \"table\" && (expected.facts.persistence === undefined || expected.facts.options === undefined)) {\n objects.push({ identity, ownership, state: \"unavailable\", reason: \"table-physical-reference-required\", differences: compare({ expected, live: live.definition }) });\n } else {\n const differences = compare({ expected, live: live.definition });\n objects.push({ identity, ownership, state: differences.length === 0 ? \"matching\" : \"changed\", differences });\n }\n }\n if (params.expected.schema.models.length > 0 || params.expected.schema.enums.length > 0) objects.push(...await verifySchemaObjects(params));\n if (params.dialect === \"postgres\") objects.push(...await verifyExclusions(params));\n return { inSync: objects.every((object) => object.state === \"matching\"), objects };\n}\n\nasync function verifySchemaObjects(params: Parameters<typeof verifyMigrationState>[0] & { sqliteRestorePending?: true }): Promise<MigrationObjectState[]> {\n const physical = params.dialect === \"postgres\" ? await introspectPhysicalPostgres({ executor: params.executor })\n : params.dialect === \"mysql\" ? await introspectMysql({ executor: params.executor })\n : params.sqliteRestorePending === true ? await introspectSqliteBeforeForeignKeyRestore({ executor: params.executor }) : await introspectSqlite({ executor: params.executor });\n const expected = normalizeSchema({ schema: params.expected.schema, dialect: params.dialect });\n const actual = normalizeSchema({ schema: physical, dialect: params.dialect });\n const objects: MigrationObjectState[] = [];\n const namespace = await migrationNamespace({ executor: params.executor, dialect: params.dialect });\n const sqliteTableOptions = params.dialect === \"sqlite\" && expected.tables.size > 0\n ? await params.executor({ text: \"PRAGMA main.table_list;\", values: [] }) : undefined;\n if (params.dialect === \"postgres\") for (const [name, desired] of expected.enums) {\n const identity: SqlObjectIdentity = { kind: \"enum\", name: { namespace, name } };\n const live = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n if (live.state !== \"present\") {\n objects.push({ identity, ownership: \"schema\", state: live.state, differences: [], ...(live.state === \"unavailable\" ? { reason: live.reason } : {}) });\n continue;\n }\n const values = live.definition.facts.values;\n if (!Array.isArray(values) || !values.every((value) => typeof value === \"string\")) {\n objects.push({ identity, ownership: \"schema\", state: \"unavailable\", reason: \"enum-values-unavailable\", differences: [] });\n continue;\n }\n const matching = canonicalMigrationJson({ value: desired.values }) === canonicalMigrationJson({ value: values });\n objects.push({ identity, ownership: \"schema\", state: matching ? \"matching\" : \"changed\", differences: matching ? [] : [{ attribute: \"values\", expected: desired.values, actual: values }] });\n }\n for (const [name, desired] of expected.tables) {\n const table = { namespace, name };\n const live = actual.tables.get(name);\n if (live === undefined) {\n const presence = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity: { kind: \"table\", name: table } });\n objects.push({ identity: { kind: \"table\", name: table }, ownership: \"schema\", state: presence.state === \"missing\" ? \"missing\" : \"unavailable\", ...(presence.state === \"missing\" ? {} : { reason: \"schema-definition-not-visible\" }), differences: [] });\n continue;\n }\n if (sqliteTableOptions !== undefined) {\n const options = sqliteTableOptions.find((row) => row.schema === namespace && row.name === name);\n if (options?.strict !== 0 || options.wr !== 0) {\n objects.push({ identity: { kind: \"table\", name: table }, ownership: \"schema\", state: \"unavailable\", reason: \"sqlite-table-options-unrepresented\", differences: [{ attribute: \"tableOptions\", expected: { strict: 0, wr: 0 }, actual: options === undefined ? undefined : { strict: options.strict, wr: options.wr } }] });\n continue;\n }\n }\n const differences: MigrationStateDifference[] = [];\n const pin = (attribute: string, expected: unknown, actual: unknown): void => {\n if (canonicalMigrationJson({ value: expected }) !== canonicalMigrationJson({ value: actual })) differences.push({ attribute, expected, actual });\n };\n pin(\"primaryKey\", desired.pk, live.pk);\n for (const [column, field] of desired.columns) {\n const stored = live.columns.get(column);\n pin(`columns.${column}.type`, field.typeKey, stored?.typeKey);\n pin(`columns.${column}.nullable`, field.nullable, stored?.nullable);\n if (params.dialect === \"mysql\" && field.field.collation !== undefined) {\n pin(`columns.${column}.collation`, field.field.collation.toLowerCase(), stored?.field.collation?.toLowerCase());\n }\n const ownedDefault = params.expected.schema.migrationObjects?.some((object) => (object.identity.kind === \"columnDefault\" || object.identity.kind === \"generatedColumn\") && object.identity.table.namespace === namespace && object.identity.table.name === name && object.identity.column === column);\n if (!ownedDefault) {\n const desiredDefault = field.field.default;\n const actualDefault = stored?.field.default;\n const equivalent = params.dialect === \"postgres\" && field.defaultKey !== stored?.defaultKey &&\n desiredDefault?.kind === \"dbgenerated\" && actualDefault?.kind === \"dbgenerated\" &&\n await equivalentPostgresDefaultFunction({ executor: params.executor, table, column, expected: desiredDefault.sql, actual: actualDefault.sql });\n if (!equivalent) pin(`columns.${column}.default`, field.defaultKey, stored?.defaultKey);\n }\n }\n for (const [key, fk] of desired.fks) {\n const stored = live.fks.get(key);\n pin(`foreignKeys.${fk.constraintName}`, { columns: fk.columns, refTable: fk.refTable, refColumns: fk.refColumns, onDelete: fk.onDelete, onUpdate: fk.onUpdate }, stored === undefined ? undefined : { columns: stored.columns, refTable: stored.refTable, refColumns: stored.refColumns, onDelete: stored.onDelete, onUpdate: stored.onUpdate });\n if (params.dialect === \"postgres\" && stored !== undefined) {\n const identity: SqlObjectIdentity = { kind: \"constraint\", constraintType: \"foreignKey\", table, name: stored.constraintName };\n // A reviewed catalog definition can deliberately describe a staged NOT VALID FK.\n if (params.expected.definitions.some((definition) => sqlObjectKey({ identity: definition.identity }) === sqlObjectKey({ identity }))) continue;\n const inspection = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n if (inspection.state !== \"present\") {\n objects.push({ identity, ownership: \"schema\", state: inspection.state, differences: [], ...(inspection.state === \"unavailable\" ? { reason: inspection.reason } : {}) });\n } else {\n const differences = [\"validated\", \"triggersEnabled\"].flatMap((attribute) => inspection.definition.facts[attribute] === true ? [] : [{ attribute, expected: true, actual: inspection.definition.facts[attribute] }]);\n objects.push({ identity, ownership: \"schema\", state: differences.length === 0 ? \"matching\" : \"changed\", differences });\n }\n }\n }\n for (const [key, index] of desired.indexes) {\n pin(`indexes.${index.name}`, key, live.indexes.get(key)?.key);\n if (params.dialect !== \"postgres\" || !live.indexes.has(key)) continue;\n const identity: SqlObjectIdentity = { kind: \"index\", table, name: live.indexes.get(key)!.name };\n if (params.expected.definitions.some((definition) => sqlObjectKey({ identity: definition.identity }) === sqlObjectKey({ identity }))) continue;\n const inspection = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n if (inspection.state !== \"present\") {\n objects.push({ identity, ownership: \"schema\", state: inspection.state, differences: [], ...(inspection.state === \"unavailable\" ? { reason: inspection.reason } : {}) });\n } else {\n const differences = [\"valid\", \"ready\"].flatMap((attribute) => inspection.definition.facts[attribute] === true ? [] : [{ attribute, expected: true, actual: inspection.definition.facts[attribute] }]);\n objects.push({ identity, ownership: \"schema\", state: differences.length === 0 ? \"matching\" : \"changed\", differences });\n }\n }\n objects.push({ identity: { kind: \"table\", name: table }, ownership: \"schema\", state: differences.length === 0 ? \"matching\" : \"changed\", differences });\n for (const [check, expression] of desired.checks) {\n const identity: SqlObjectIdentity = { kind: \"constraint\", constraintType: \"check\", table, name: check };\n if (params.expected.definitions.some((definition) => sqlObjectKey({ identity: definition.identity }) === sqlObjectKey({ identity }))) continue;\n const stored = live.checks.get(check);\n if (stored === undefined) { objects.push({ identity, ownership: \"schema\", state: \"missing\", differences: [] }); continue; }\n if (params.dialect !== \"sqlite\") {\n const inspection = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n if (inspection.state !== \"present\") { objects.push({ identity, ownership: \"schema\", state: inspection.state, differences: [] }); continue; }\n const disabled = params.dialect === \"postgres\" ? inspection.definition.facts.validated !== true : inspection.definition.facts.enforced !== \"YES\";\n if (disabled) { objects.push({ identity, ownership: \"schema\", state: \"changed\", differences: [{ attribute: params.dialect === \"postgres\" ? \"validated\" : \"enforced\", expected: params.dialect === \"postgres\" ? true : \"YES\", actual: params.dialect === \"postgres\" ? inspection.definition.facts.validated : inspection.definition.facts.enforced }] }); continue; }\n }\n if (stored === expression) { objects.push({ identity, ownership: \"schema\", state: \"matching\", differences: [] }); continue; }\n if (params.dialect === \"postgres\" && params.probe === \"rollback\") {\n const normalized = await deparsePostgresCheck({ executor: params.executor, table, expression, probe: \"rollback\" });\n const read = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n const actual = read.state === \"present\" ? read.definition.facts.definition : undefined;\n objects.push({ identity, ownership: \"schema\", state: normalized === actual ? \"matching\" : \"changed\", differences: normalized === actual ? [] : [{ attribute: \"definition\", expected: normalized, actual }] });\n } else if (params.dialect === \"mysql\" && params.probe === \"temporary\") {\n const normalized = await deparseMysqlCheck({ executor: params.executor, table, expression, probe: \"temporary\" });\n const inspection = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n const actual = inspection.state === \"present\" ? inspection.definition.facts.definition : undefined;\n const match = normalized === actual;\n objects.push({ identity, ownership: \"schema\", state: inspection.state === \"unavailable\" ? \"unavailable\" : match ? \"matching\" : \"changed\", differences: match ? [] : [{ attribute: \"definition\", expected: normalized, actual }] });\n } else objects.push({ identity, ownership: \"schema\", state: \"unavailable\", reason: \"explicit-replacement-required\", differences: [{ attribute: \"definition\", expected: expression, actual: stored }] });\n }\n }\n for (const [name, join] of expected.joinTables) {\n const stored = actual.joinTables.get(name);\n const shape = (value: typeof join | undefined): unknown => value === undefined ? undefined : { a: { table: value.a.table, column: value.a.column }, b: { table: value.b.table, column: value.b.column } };\n const matching = canonicalMigrationJson({ value: shape(join) }) === canonicalMigrationJson({ value: shape(stored) });\n objects.push({ identity: { kind: \"table\", name: { namespace, name } }, ownership: \"schema\", state: stored === undefined ? \"missing\" : matching ? \"matching\" : \"changed\", differences: matching ? [] : [{ attribute: \"joinTable\", expected: shape(join), actual: shape(stored) }] });\n }\n for (const [name] of expected.views) {\n if (!params.expected.definitions.some((definition) => definition.identity.kind === \"view\" && definition.identity.name.namespace === namespace && definition.identity.name.name === name)) objects.push({ identity: { kind: \"view\", name: { namespace, name } }, ownership: \"schema\", state: actual.views.has(name) ? \"unavailable\" : \"missing\", reason: \"independent-definition-required\", differences: [] });\n }\n return objects;\n}\n\n/** A transition verifies intended removals as well as definitions that should remain. */\nexport async function verifyMigrationTransition(params: { executor: SqlExecutor; dialect: Dialect; from: DesiredState; to: DesiredState; removals?: readonly SqlObjectIdentity[]; probe?: \"none\" | \"rollback\" | \"temporary\" }): Promise<MigrationStateReport> {\n return verifyTransition(params);\n}\n\n/** @internal Only for a validated rebuild script immediately before COMMIT/FK restoration. */\nexport async function verifySqliteTransitionBeforeRestore(params: Parameters<typeof verifyMigrationTransition>[0]): Promise<MigrationStateReport> {\n if (params.dialect !== \"sqlite\") throw new VibeError({ code: \"VIBE_INTERNAL\", message: \"SQLite rebuild verification requires the SQLite dialect\" });\n await executeStatement({ executor: params.executor, dialect: \"sqlite\", statement: \"PRAGMA foreign_key_check;\" });\n return verifyTransition({ ...params, sqliteRestorePending: true });\n}\n\nasync function verifyTransition(params: Parameters<typeof verifyMigrationTransition>[0] & { sqliteRestorePending?: true }): Promise<MigrationStateReport> {\n const report = await verifyState({ executor: params.executor, dialect: params.dialect, expected: params.to, ...(params.sqliteRestorePending === true ? { sqliteRestorePending: true } : {}), ...(params.probe === undefined ? {} : { probe: params.probe }) });\n const namespace = await migrationNamespace(params);\n const identities = (state: DesiredState): SqlObjectIdentity[] => [...schemaObjectIdentities({ schema: state.schema, dialect: params.dialect, namespace }), ...(state.schema.migrationObjects ?? []).map((object) => object.identity), ...state.definitions.map((definition) => definition.identity)];\n const retained = new Set(identities(params.to).map((identity) => sqlObjectKey({ identity })));\n const removed = new Map([...identities(params.from).filter((identity) => !retained.has(sqlObjectKey({ identity }))), ...(params.removals ?? [])].map((identity) => [sqlObjectKey({ identity }), identity]));\n const objects = [...report.objects];\n for (const identity of removed.values()) {\n const live = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n const absent = live.state === \"missing\" || (identity.kind === \"columnDefault\" && live.state === \"present\" && live.definition.facts.definition === null);\n if (!absent) objects.push({ identity, ownership: \"schema\", state: live.state === \"unavailable\" ? \"unavailable\" : \"changed\", reason: live.state === \"unavailable\" ? live.reason : \"expected-absent\", differences: [{ attribute: \"presence\", expected: false, actual: live.state === \"present\" ? true : undefined }] });\n }\n return { inSync: report.inSync && objects.every((object) => object.state === \"matching\"), objects };\n}\n\n/** Resolve the physical namespace once; never invent a MySQL database name. */\nexport async function migrationNamespace(params: { executor: SqlExecutor; dialect: Dialect }): Promise<string> {\n if (params.dialect !== \"mysql\") return params.dialect === \"sqlite\" ? \"main\" : \"public\";\n const query = renderMigrationNamespace({ dialect: getSqlDialect({ dialect: params.dialect }) });\n const rows = await params.executor({ text: query.text, values: [] });\n const namespace = rows[0]?.namespace;\n if (typeof namespace !== \"string\" || namespace.length === 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot determine the migration namespace\", meta: { reason: \"inspection-unavailable\" } });\n return namespace;\n}\n\n/** Refuse mutation/adoption when verification is incomplete. */\nexport function assertMigrationState(params: { report: MigrationStateReport }): void {\n if (!params.report.inSync) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Migration state could not be verified\", meta: { reason: \"migration-state-unverified\", objects: params.report.objects.filter((object) => object.state !== \"matching\") } });\n}\n\n/** Normalize a trusted authored CHECK in the real type context without retaining DDL. Caller owns transaction. */\nexport async function deparsePostgresCheck(params: { executor: SqlExecutor; table: { namespace: string; name: string }; expression: string; probe: \"rollback\" }): Promise<string> {\n const definition = await deparsePostgresCheckDefinition({ ...params, constraint: \"vibeorm_check_probe\" });\n return String(definition.facts.definition);\n}\n\n/** Compile a trusted CHECK declaration into normalized metadata using only the authored expression. */\nexport async function deparsePostgresCheckDefinition(params: { executor: SqlExecutor; table: { namespace: string; name: string }; expression: string; constraint: string; probe: \"rollback\" }): Promise<SqlObjectDefinition> {\n const name = \"vibeorm_check_probe\";\n await params.executor({ text: \"SAVEPOINT vibeorm_check_probe\" });\n try {\n const query = renderCheckProbe({ dialect: getSqlDialect({ dialect: \"postgres\" }), table: params.table, expression: params.expression, name });\n await params.executor({ text: query.text });\n const result = await inspectSqlObject({ executor: params.executor, dialect: \"postgres\", identity: { kind: \"constraint\", constraintType: \"check\", table: params.table, name } });\n if (result.state !== \"present\" || typeof result.definition.facts.definition !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"CHECK normalization probe unavailable\", meta: { reason: \"check-inspection-unavailable\" } });\n return { ...result.definition, identity: { kind: \"constraint\", constraintType: \"check\", table: params.table, name: params.constraint }, facts: { ...result.definition.facts, definition: result.definition.facts.definition.replace(/ NOT VALID$/, \"\"), validated: true } };\n } finally {\n await params.executor({ text: \"ROLLBACK TO SAVEPOINT vibeorm_check_probe\" });\n await params.executor({ text: \"RELEASE SAVEPOINT vibeorm_check_probe\" });\n }\n}\n\n/** Normalize on a private MySQL temporary clone; cleanup is mandatory even after a failed expression. */\nexport async function deparseMysqlCheck(params: { executor: SqlExecutor; table: { namespace: string; name: string }; expression: string; probe: \"temporary\" }): Promise<string> {\n const probe = `vibe_check_${randomUUID().replaceAll(\"-\", \"\")}`;\n const dialect = getSqlDialect({ dialect: \"mysql\" });\n const clone = renderMysqlCheckProbe({ dialect, probe, operation: \"clone\", table: params.table });\n await params.executor({ text: clone.text });\n let created = true;\n try {\n const read = renderMysqlCheckProbe({ dialect, probe, operation: \"read\" });\n const source = await params.executor({ text: read.text, values: [] });\n const definition = source[0]?.[\"Create Table\"];\n if (typeof definition !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot read temporary clone definition\" });\n const drop = renderMysqlCheckProbe({ dialect, probe, operation: \"drop\" });\n await params.executor({ text: drop.text });\n created = false;\n // CREATE/DROP TEMPORARY TABLE preserve the caller's transaction; ALTER TABLE does not.\n const add = renderMysqlCheckProbe({ dialect, probe, operation: \"add\", expression: params.expression, definition });\n await params.executor({ text: add.text });\n created = true;\n const rows = await params.executor({ text: read.text, values: [] });\n const normalizedDefinition = rows[0]?.[\"Create Table\"];\n const check = typeof normalizedDefinition === \"string\" ? parseSqliteNamedChecks({ tableSql: normalizedDefinition }).find((entry) => entry.name === probe) : undefined;\n if (check === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"MySQL temporary CHECK deparse unavailable\", meta: { reason: \"check-inspection-unavailable\" } });\n return check.expression;\n } finally {\n if (created) {\n const drop = renderMysqlCheckProbe({ dialect, probe, operation: \"drop\" });\n await params.executor({ text: drop.text });\n }\n }\n}\n\n/** Resolve raw CHECK comparisons; unequal unnormalized text never silently produces an empty diff. */\nexport async function prepareCheckDiff(params: { executor: SqlExecutor; from: SchemaIR; to: SchemaIR; dialect: Dialect; probe?: \"none\" | \"rollback\" | \"temporary\"; previous?: DesiredState; replaceChecks?: readonly SqlObjectIdentity[] }): Promise<SchemaIR> {\n assertProbeMode({ dialect: params.dialect, probe: params.probe });\n const models = [];\n for (const model of params.from.models) {\n const table = model.dbName ?? model.name;\n const target = params.to.models.find((entry) => (entry.dbName ?? entry.name) === table);\n const checks = [];\n for (const check of model.checks ?? []) {\n const next = target?.checks?.find((entry) => entry.name === check.name);\n if (next === undefined || next.expression === check.expression) { checks.push({ name: check.name, expression: check.expression }); continue; }\n const identity: SqlObjectIdentity = { kind: \"constraint\", constraintType: \"check\", table: { namespace: await migrationNamespace({ executor: params.executor, dialect: params.dialect }), name: table }, name: check.name };\n if (params.dialect === \"postgres\" && params.probe === \"rollback\") {\n const desired = await deparsePostgresCheck({ executor: params.executor, table: identity.table, expression: next.expression, probe: \"rollback\" });\n const live = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n if (live.state !== \"present\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Live CHECK inspection unavailable\", meta: { reason: \"check-inspection-unavailable\", identity } });\n if (live.definition.facts.definition === desired) { checks.push(next); continue; }\n checks.push({ name: check.name, expression: check.expression });\n continue;\n }\n if (params.dialect === \"mysql\" && params.probe === \"temporary\") {\n const desired = await deparseMysqlCheck({ executor: params.executor, table: identity.table, expression: next.expression, probe: \"temporary\" });\n const live = await inspectSqlObject({ executor: params.executor, dialect: params.dialect, identity });\n if (live.state !== \"present\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Live CHECK inspection unavailable\", meta: { reason: \"check-inspection-unavailable\", identity } });\n checks.push(desired === live.definition.facts.definition ? next : { name: check.name, expression: check.expression });\n continue;\n }\n const previous = params.previous?.schema.models.find((entry) => (entry.dbName ?? entry.name) === table)?.checks?.find((entry) => entry.name === check.name);\n if (previous !== undefined) {\n // The planner verified this independent baseline before comparing authored text.\n checks.push(previous.expression === next.expression ? next : { name: check.name, expression: check.expression });\n continue;\n }\n if (params.replaceChecks?.some((entry) => sqlObjectKey({ identity: entry }) === sqlObjectKey({ identity }))) { checks.push({ name: check.name, expression: check.expression }); continue; }\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Cannot establish CHECK equivalence for ${table}.${check.name}; request a rollback probe or an explicit replacement`, meta: { reason: \"explicit-replacement-required\", identity } });\n }\n models.push({ ...model, checks });\n }\n return { ...params.from, models };\n}\n",
|
|
28
|
+
"/**\n * SQLite introspection: live database → SchemaIR, from `sqlite_master` (table\n * and index SQL text) plus `PRAGMA table_info / index_list / index_xinfo /\n * foreign_key_list`.\n *\n * THE TEXT-TYPE AMBIGUITY, stated honestly: sqlite stores only the four\n * storage classes we emit, so the reverse mapping is TEXT→String,\n * INTEGER→Int, REAL→Float, BLOB→Bytes — ALWAYS. A DateTime/Decimal/Json\n * column pulls back as String and a Boolean/BigInt as Int; there is no marker\n * to recover the richer type. The differ compensates by comparing columns by\n * storage class on sqlite (normalize.ts), so round-trips stay diff-clean.\n * Two markers DO survive:\n * - enums: our named CHECK constraints (`<table>_<column>_enum_<Enum>`)\n * recover both the enum's name and values;\n * - autoincrement: the literal `PRIMARY KEY AUTOINCREMENT` text on a\n * single-column INTEGER PK.\n * Any other declared type (VARCHAR(30), DATETIME, … from a foreign database)\n * becomes an `isUnsupported` field with the raw type preserved in\n * `nativeType` (F3: keep, don't drop).\n *\n * Representation mirrors introspect/postgres.ts exactly (shared.ts is the one\n * relation/join-table rule): unnamed relation pairs, structural join-table\n * detection, single-column uniques folded into `isUnique`, composite PKs on\n * `model.primaryKey` (PK columns are never optional), views with columns\n * only. Skipped: the `_vibe_migrations` table, `sqlite_*` internals\n * (sqlite_sequence comes with AUTOINCREMENT), and expression indexes\n * (index_xinfo reports no column name for them).\n *\n * Every row-returning query passes `values: []` — through `toSqlExecutor` a\n * value-less text runs on the adapter's multi-statement batch path, which\n * returns no rows (adapter-sqlite contract).\n */\n\nimport { exactIntegerLiteral } from \"@vibeorm/schema\";\n\nimport type {\n CascadeAction,\n DefaultValueIR,\n EnumIR,\n FieldIR,\n FieldType,\n IndexIR,\n ModelIR,\n SchemaIR,\n} from \"@vibeorm/schema\";\nimport { sqliteDialect, sqliteTableConstraints, sqliteColumnClauses } from \"@vibeorm/sql\";\nimport { MIGRATIONS_TABLE_NAME } from \"../journal-table.ts\";\nimport { parseSqliteEnumChecks, parseSqliteNamedChecks, sqliteEnumCheckName } from \"../sqlite-types.ts\";\nimport {\n addFkRelations,\n addJoinTableRelations,\n detectJoinTable,\n} from \"./shared.ts\";\nimport type { FkGroup, IntrospectedIndex, JoinTableInfo } from \"./shared.ts\";\nimport type { SqlExecutor } from \"../types.ts\";\n\n// ─── Row shapes ───────────────────────────────────────────────────\n\ntype MasterRow = { name: string; type: string; sql: string | null };\n\ntype ColumnInfo = {\n name: string;\n declaredType: string;\n notNull: boolean;\n defaultValue: string | null;\n /** 1-based position within the PK, 0 = not part of it. */\n pkPosition: number;\n catalogComplete: boolean;\n};\n\nconst SQLITE_ACTION_TO_CASCADE: Readonly<Record<string, CascadeAction>> = {\n \"NO ACTION\": \"NoAction\",\n RESTRICT: \"Restrict\",\n CASCADE: \"Cascade\",\n \"SET NULL\": \"SetNull\",\n \"SET DEFAULT\": \"SetDefault\",\n};\n\n// ─── Public API ───────────────────────────────────────────────────\n\n/** Introspect a live sqlite database into SchemaIR. */\nexport async function introspectSqlite(params: { executor: SqlExecutor }): Promise<SchemaIR> {\n return introspectSqliteCatalog(params);\n}\n\n/** @internal The runner verifies foreign_key_check and restores enforcement after COMMIT. */\nexport async function introspectSqliteBeforeForeignKeyRestore(params: { executor: SqlExecutor }): Promise<SchemaIR> {\n return introspectSqliteCatalog({ ...params, restorePending: true });\n}\n\nasync function introspectSqliteCatalog(params: { executor: SqlExecutor; restorePending?: true }): Promise<SchemaIR> {\n const { executor } = params;\n\n const masterRows = await executor({\n // `_` is a LIKE wildcard: the prefix is escaped so only SQLite's own\n // `sqlite_*` objects are hidden, never a user table named `SqliteAudit`.\n text: `SELECT name, type, sql FROM sqlite_master WHERE type IN ('table', 'view') AND name NOT LIKE 'sqlite\\\\_%' ESCAPE '\\\\' AND name <> '${MIGRATIONS_TABLE_NAME}' ORDER BY name`,\n values: [],\n });\n const indexSqlRows = await executor({\n text: `SELECT name, tbl_name, sql FROM sqlite_master WHERE type = 'index' ORDER BY name`,\n values: [],\n });\n\n const entries: MasterRow[] = masterRows.map((row) => ({\n name: row.name as string,\n type: row.type as string,\n sql: (row.sql as string | null) ?? null,\n }));\n const tables = entries.filter((entry) => entry.type === \"table\");\n const views = entries.filter((entry) => entry.type === \"view\");\n\n const indexSqlByName = new Map<string, string | null>();\n for (const row of indexSqlRows) {\n indexSqlByName.set(row.name as string, (row.sql as string | null) ?? null);\n }\n\n // Per-table catalog: columns, indexes, FKs, enum checks.\n const columnsByTable = new Map<string, ColumnInfo[]>();\n const indexes: IntrospectedIndex[] = [];\n const indexEvidence = new Map<string, boolean>();\n const uniqueSinglesByTable = new Map<string, Set<string>>();\n const modelIndexesByTable = new Map<string, IndexIR[]>();\n const checksByTable = new Map<string, { name: string; expression: string }[]>();\n const fkGroups: FkGroup[] = [];\n const enumsByColumn = new Map<string, { enumName: string; values: readonly string[] }>();\n const enumRegistry = new Map<string, EnumIR>();\n const autoincrementTables = new Set<string>();\n\n for (const table of tables) {\n const columns = await readColumns({ executor, table: table.name });\n columnsByTable.set(table.name, columns);\n\n // Enum CHECK markers from the table's SQL text.\n const enumCheckNames = new Set<string>();\n for (const check of parseSqliteEnumChecks({ tableSql: table.sql ?? \"\" })) {\n enumsByColumn.set(`${table.name}.${check.column}`, {\n enumName: check.enumName,\n values: check.values,\n });\n enumCheckNames.add(\n sqliteEnumCheckName({ table: table.name, column: check.column, enumName: check.enumName }),\n );\n if (!enumRegistry.has(check.enumName)) {\n enumRegistry.set(check.enumName, { name: check.enumName, values: check.values });\n }\n }\n\n // User CHECK constraints — every named check that is NOT enum machinery.\n checksByTable.set(\n table.name,\n parseSqliteNamedChecks({ tableSql: table.sql ?? \"\" }).filter(\n (check) => !enumCheckNames.has(check.name),\n ),\n );\n\n // Autoincrement marker (single-column INTEGER PK only).\n if (/PRIMARY KEY AUTOINCREMENT/i.test(table.sql ?? \"\")) {\n autoincrementTables.add(table.name);\n }\n\n // Indexes.\n const { tableIndexes, uniqueSingles, modelIndexes, compressionSafe } = await readIndexes({\n executor,\n table: table.name,\n indexSqlByName,\n });\n indexes.push(...tableIndexes);\n indexEvidence.set(table.name, compressionSafe);\n uniqueSinglesByTable.set(table.name, uniqueSingles);\n modelIndexesByTable.set(table.name, modelIndexes);\n\n // Foreign keys.\n fkGroups.push(...(await readForeignKeys({ executor, table: table.name, columns, tableSql: table.sql ?? \"\" })));\n }\n\n // Implicit join tables (the shared structural rule).\n const joinTables = new Map<string, JoinTableInfo>();\n let foreignKeysEnabled: boolean | undefined;\n for (const table of tables) {\n if (!table.name.startsWith(\"_\") || table.sql === null || indexEvidence.get(table.name) !== true) continue;\n // Catalog SQL is valid SQL; remove quoted names/literals and comments before\n // testing for clauses the implicit representation cannot retain.\n const keywords = table.sql.replace(/--[^\\n]*|\\/\\*[\\s\\S]*?\\*\\/|\"(?:\"\"|[^\"])*\"|'(?:''|[^'])*'|`(?:``|[^`])*`|\\[[^\\]]*\\]/g, \" \");\n if (/\\b(?:CHECK|PRIMARY|GENERATED|COLLATE|DEFERRABLE|STRICT|WITHOUT|CONFLICT|AS)\\b/i.test(keywords) || sqliteColumnClauses({ sql: table.sql }).length !== 2) continue;\n const tableColumns = columnsByTable.get(table.name) ?? [];\n if (tableColumns.some((column) => !column.catalogComplete || column.pkPosition !== 0 || column.defaultValue !== null)) continue;\n if (fkGroups.filter((fk) => fk.table === table.name).some((fk) => fk.columns.some((name, index) => {\n const source = tableColumns.find((column) => column.name === name);\n const target = columnsByTable.get(fk.refTable)?.find((column) => column.name === fk.refColumns[index]);\n return source === undefined || target === undefined || !target.catalogComplete || source.declaredType.trim().toUpperCase() !== target.declaredType.trim().toUpperCase();\n }))) continue;\n const detected = detectJoinTable({\n table: table.name,\n columnNames: (columnsByTable.get(table.name) ?? []).map((column) => column.name),\n fkGroups,\n indexes,\n });\n if (detected === null) continue;\n if (foreignKeysEnabled === undefined) {\n const enabled = await executor({ text: \"PRAGMA foreign_keys\", values: [] });\n const deferred = await executor({ text: \"PRAGMA defer_foreign_keys\", values: [] });\n foreignKeysEnabled = (enabled[0]?.foreign_keys === 1 || params.restorePending === true && enabled[0]?.foreign_keys === 0) && deferred[0]?.defer_foreign_keys === 0;\n }\n if (!foreignKeysEnabled) continue;\n const violations = await executor({ text: `PRAGMA foreign_key_check(${q(table.name)})`, values: [] });\n if (violations.length === 0) joinTables.set(table.name, detected);\n }\n\n // Models.\n const models: ModelIR[] = [];\n for (const table of tables) {\n if (joinTables.has(table.name)) continue;\n models.push(\n buildModel({\n table: table.name,\n isView: false,\n columns: columnsByTable.get(table.name) ?? [],\n uniqueSingles: uniqueSinglesByTable.get(table.name) ?? new Set(),\n modelIndexes: modelIndexesByTable.get(table.name) ?? [],\n enumsByColumn,\n autoincrement: autoincrementTables.has(table.name),\n checks: checksByTable.get(table.name) ?? [],\n }),\n );\n }\n for (const view of views) {\n models.push(\n buildModel({\n table: view.name,\n isView: true,\n columns: await readColumns({ executor, table: view.name }),\n uniqueSingles: new Set(),\n modelIndexes: [],\n enumsByColumn,\n autoincrement: false,\n checks: [],\n }),\n );\n }\n\n addFkRelations({ models, fkGroups, joinTables });\n addJoinTableRelations({ models, joinTables });\n\n return {\n datasource: { provider: \"sqlite\" },\n models,\n enums: [...enumRegistry.values()],\n extensions: [],\n };\n}\n\n// ─── Catalog readers ──────────────────────────────────────────────\n\nasync function readColumns(params: {\n executor: SqlExecutor;\n table: string;\n}): Promise<ColumnInfo[]> {\n const rows = await params.executor({\n text: `PRAGMA table_info(${q(params.table)})`,\n values: [],\n });\n return rows.map((row) => ({\n name: row.name as string,\n declaredType: (row.type as string | null) ?? \"\",\n notNull: Number(row.notnull) === 1,\n defaultValue: row.dflt_value === null || row.dflt_value === undefined ? null : String(row.dflt_value),\n pkPosition: Number(row.pk),\n catalogComplete: typeof row.type === \"string\" && row.type.trim().length > 0 && (row.notnull === 0 || row.notnull === 1) && (row.dflt_value === null || typeof row.dflt_value === \"string\") && typeof row.pk === \"number\",\n }));\n}\n\nasync function readIndexes(params: {\n executor: SqlExecutor;\n table: string;\n indexSqlByName: ReadonlyMap<string, string | null>;\n}): Promise<{\n tableIndexes: IntrospectedIndex[];\n uniqueSingles: Set<string>;\n modelIndexes: IndexIR[];\n compressionSafe: boolean;\n}> {\n const { executor, table, indexSqlByName } = params;\n const listRows = await executor({ text: `PRAGMA index_list(${q(table)})`, values: [] });\n\n const tableIndexes: IntrospectedIndex[] = [];\n const uniqueSingles = new Set<string>();\n const modelIndexes: IndexIR[] = [];\n let compressionSafe = true;\n\n for (const listRow of listRows) {\n if (![\"c\", \"u\", \"pk\"].includes(String(listRow.origin)) || (listRow.unique !== 0 && listRow.unique !== 1) || (listRow.partial !== 0 && listRow.partial !== 1)) compressionSafe = false;\n const origin = listRow.origin as string;\n if (origin === \"pk\") continue; // The PK itself — table_info carries it.\n\n const name = listRow.name as string;\n const unique = Number(listRow.unique) === 1;\n const partial = Number(listRow.partial) === 1;\n if (partial) compressionSafe = false;\n\n const infoRows = await executor({ text: `PRAGMA index_xinfo(${q(name)})`, values: [] });\n const keyRows = infoRows\n .filter((row) => Number(row.key) === 1)\n .sort((a, b) => Number(a.seqno) - Number(b.seqno));\n if (keyRows.length === 0 || !keyRows.every((row) => typeof row.name === \"string\" && row.coll === \"BINARY\" && row.desc === 0)) compressionSafe = false;\n let columns: { name: string; desc: boolean }[];\n if (keyRows.some((row) => row.name === null || row.name === undefined)) {\n // Expression index. OUR OWN Decimal form — CAST(\"col\" AS REAL), emitted\n // by the sqlite DDL renderer (SQLITE-2) — is recovered from the index's\n // sqlite_master SQL so `diff(introspect(push(X)), X)` stays [] and push\n // stays idempotent. Any OTHER expression index is skipped (documented\n // non-support), exactly as before.\n const recovered = parseIndexColumnsFromSql({ sql: indexSqlByName.get(name) ?? null });\n if (recovered === null) continue;\n columns = recovered;\n } else {\n columns = keyRows.map((row) => ({\n name: row.name as string,\n desc: Number(row.desc) === 1,\n }));\n }\n\n let where: string | undefined;\n if (partial) {\n const sql = indexSqlByName.get(name);\n const match = sql?.match(/\\sWHERE\\s+(.*)$/is);\n where = match?.[1]?.trim();\n }\n\n tableIndexes.push({\n table,\n name,\n unique,\n kind: \"btree\",\n columns,\n ...(where === undefined ? {} : { where }),\n });\n\n if (unique && columns.length === 1 && where === undefined) {\n uniqueSingles.add((columns[0] as { name: string }).name);\n if (name.startsWith(\"sqlite_autoindex_\") || name === `${table}_${columns[0]!.name}_key`) continue;\n }\n modelIndexes.push({\n name,\n kind: unique ? \"unique\" : \"btree\",\n fields: columns.map((column) => ({\n name: column.name,\n ...(column.desc ? { sort: \"desc\" as const } : {}),\n })),\n ...(where === undefined ? {} : { where }),\n });\n }\n\n return { tableIndexes, uniqueSingles, modelIndexes, compressionSafe };\n}\n\n/** One parsed index-column term: `\"col\" [DESC]` or `CAST(\"col\" AS REAL) [DESC]`. */\nconst PLAIN_INDEX_COLUMN = /^\"((?:[^\"]|\"\")+)\"(?:\\s+(ASC|DESC))?$/i;\nconst CAST_REAL_INDEX_COLUMN = /^CAST\\s*\\(\\s*\"((?:[^\"]|\"\")+)\"\\s+AS\\s+REAL\\s*\\)(?:\\s+(ASC|DESC))?$/i;\n\n/**\n * Recover an expression index's column list from its `sqlite_master.sql`\n * (SQLITE-2). Only shapes WE emit parse — plain quoted columns and\n * `CAST(\"col\" AS REAL)`, each with an optional direction; a trailing partial\n * WHERE clause is fine (it sits OUTSIDE the column list — closure item 2).\n * Anything else (other expressions, COLLATE clauses) returns null and the\n * caller skips the index as before.\n */\nexport function parseIndexColumnsFromSql(params: {\n sql: string | null;\n}): { name: string; desc: boolean }[] | null {\n const { sql } = params;\n if (sql === null) return null;\n // Locate the column list's OPENING paren after `ON \"table\"` and walk to its\n // matching close with a depth tracker — a greedy regex capture would swallow\n // through a PARTIAL index's WHERE clause (closure item 2: our own emitted\n // partial Decimal expression index then failed to parse, was skipped as\n // foreign, and every push re-created it).\n const onMatch = /\\sON\\s+\"(?:[^\"]|\"\")+\"\\s*\\(/i.exec(sql);\n if (onMatch === null) return null;\n const open = onMatch.index + onMatch[0].length - 1;\n let listDepth = 0;\n let close = -1;\n for (let index = open; index < sql.length; index++) {\n const char = sql[index];\n if (char === \"(\") listDepth += 1;\n else if (char === \")\") {\n listDepth -= 1;\n if (listDepth === 0) {\n close = index;\n break;\n }\n }\n }\n if (close === -1) return null;\n const list = sql.slice(open + 1, close);\n\n // Split on top-level commas — CAST(…) carries its own parens.\n const terms: string[] = [];\n let depth = 0;\n let start = 0;\n for (let index = 0; index < list.length; index++) {\n const char = list[index];\n if (char === \"(\") depth += 1;\n else if (char === \")\") depth -= 1;\n else if (char === \",\" && depth === 0) {\n terms.push(list.slice(start, index));\n start = index + 1;\n }\n }\n terms.push(list.slice(start));\n\n const columns: { name: string; desc: boolean }[] = [];\n for (const term of terms) {\n const trimmed = term.trim();\n const match = PLAIN_INDEX_COLUMN.exec(trimmed) ?? CAST_REAL_INDEX_COLUMN.exec(trimmed);\n if (match === null) return null;\n columns.push({\n name: (match[1] as string).replaceAll('\"\"', '\"'),\n desc: (match[2] ?? \"\").toUpperCase() === \"DESC\",\n });\n }\n return columns;\n}\n\nasync function readForeignKeys(params: {\n executor: SqlExecutor;\n table: string;\n columns: readonly ColumnInfo[];\n tableSql: string;\n}): Promise<FkGroup[]> {\n const { executor, table, columns } = params;\n const rows = await executor({ text: `PRAGMA foreign_key_list(${q(table)})`, values: [] });\n\n type MutableGroup = {\n columns: string[];\n refTable: string;\n refColumns: string[];\n onDelete: CascadeAction;\n onUpdate: CascadeAction;\n };\n const groups = new Map<number, MutableGroup>();\n const ordered = [...rows].sort(\n (a, b) => Number(a.id) - Number(b.id) || Number(a.seq) - Number(b.seq),\n );\n for (const row of ordered) {\n const id = Number(row.id);\n const from = row.from as string;\n // `to` is null when the FK references the parent's implicit PK — we never\n // emit that form, but resolve it defensively to the parent's rowid alias.\n const to = (row.to as string | null) ?? \"rowid\";\n const existing = groups.get(id);\n if (existing === undefined) {\n groups.set(id, {\n columns: [from],\n refTable: row.table as string,\n refColumns: [to],\n onDelete: SQLITE_ACTION_TO_CASCADE[(row.on_delete as string) ?? \"NO ACTION\"] ?? \"NoAction\",\n onUpdate: SQLITE_ACTION_TO_CASCADE[(row.on_update as string) ?? \"NO ACTION\"] ?? \"NoAction\",\n });\n } else {\n existing.columns.push(from);\n existing.refColumns.push(to);\n }\n }\n\n return [...groups.values()].map((group) => ({\n // sqlite does not surface FK constraint names — recompute the convention\n // the differ's normalization uses, so keys line up.\n constraintName: sqliteTableConstraints({ sql: params.tableSql }).find((clause) => clause.named && clause.type === \"foreignKey\" && JSON.stringify(clause.columns) === JSON.stringify(group.columns))?.name ?? `${table}_${group.columns.join(\"_\")}_fkey`,\n table,\n columns: group.columns,\n refTable: group.refTable,\n refColumns: group.refColumns,\n onDelete: group.onDelete,\n onUpdate: group.onUpdate,\n required: group.columns.every((columnName) => {\n const column = columns.find((candidate) => candidate.name === columnName);\n return column === undefined ? true : column.notNull;\n }),\n }));\n}\n\n// ─── Model building ───────────────────────────────────────────────\n\nfunction buildModel(params: {\n table: string;\n isView: boolean;\n columns: readonly ColumnInfo[];\n uniqueSingles: ReadonlySet<string>;\n modelIndexes: readonly IndexIR[];\n enumsByColumn: ReadonlyMap<string, { enumName: string; values: readonly string[] }>;\n autoincrement: boolean;\n checks: readonly { readonly name: string; readonly expression: string }[];\n}): ModelIR {\n const { table, isView, columns, uniqueSingles, modelIndexes, enumsByColumn, autoincrement } =\n params;\n\n const pk = columns\n .filter((column) => column.pkPosition > 0)\n .sort((a, b) => a.pkPosition - b.pkPosition)\n .map((column) => column.name);\n\n const fields: FieldIR[] = columns.map((column) => {\n const enumRef = enumsByColumn.get(`${table}.${column.name}`);\n const mapped = reverseMapType({ column, enumRef });\n const isId = pk.length === 1 && pk[0] === column.name;\n const isAutoincrement =\n autoincrement && isId && column.declaredType.toUpperCase() === \"INTEGER\";\n const defaultValue: DefaultValueIR | undefined = isAutoincrement\n ? { kind: \"autoincrement\" }\n : parseColumnDefault({ column, mapped });\n\n return {\n name: column.name,\n type: mapped.type,\n isList: false,\n // PK columns are never optional: sqlite's table_info reports notnull=0\n // for `INTEGER PRIMARY KEY` rowid aliases, but the column cannot\n // actually hold NULL (postgres-parity rule).\n isOptional: column.pkPosition > 0 ? false : !column.notNull,\n isId,\n isUnique: uniqueSingles.has(column.name),\n isUpdatedAt: false,\n ...(defaultValue === undefined ? {} : { default: defaultValue }),\n ...(mapped.nativeType === undefined ? {} : { nativeType: mapped.nativeType }),\n ...(mapped.isUnsupported === true ? { isUnsupported: true as const } : {}),\n };\n });\n\n return {\n name: table,\n fields,\n relations: [],\n indexes: [...modelIndexes],\n ...(params.checks.length === 0 ? {} : { checks: params.checks.map((check) => ({ ...check, catalogExpression: true as const })) }),\n isView,\n ...(pk.length > 1 ? { primaryKey: { fields: pk } } : {}),\n };\n}\n\n// ─── Reverse type mapping (the TEXT-ambiguity rule) ───────────────\n\ntype MappedType = {\n type: FieldType;\n nativeType?: string;\n isUnsupported?: true;\n};\n\nfunction reverseMapType(params: {\n column: ColumnInfo;\n enumRef: { enumName: string; values: readonly string[] } | undefined;\n}): MappedType {\n const { column, enumRef } = params;\n const declared = column.declaredType.trim().toUpperCase();\n\n if (enumRef !== undefined && declared === \"TEXT\") {\n return { type: { enum: enumRef.enumName } };\n }\n switch (declared) {\n case \"TEXT\":\n return { type: \"String\" };\n case \"INTEGER\":\n return { type: \"Int\" };\n case \"REAL\":\n return { type: \"Float\" };\n case \"BLOB\":\n return { type: \"Bytes\" };\n default:\n // Foreign declared type (VARCHAR(30), DATETIME, …) — preserved, not\n // guessed at (F3: keep, don't drop).\n return { type: \"String\", nativeType: column.declaredType, isUnsupported: true };\n }\n}\n\n// ─── Default parsing ──────────────────────────────────────────────\n\nfunction parseColumnDefault(params: {\n column: ColumnInfo;\n mapped: MappedType;\n}): DefaultValueIR | undefined {\n const { column, mapped } = params;\n const raw = column.defaultValue;\n if (raw === null) return undefined;\n\n if (/^-?\\d+(\\.\\d+)?$/.test(raw)) return { kind: \"literal\", value: /^-?\\d+$/.test(raw) ? exactIntegerLiteral({ text: raw }) : Number(raw) };\n\n const quoted = raw.match(/^'((?:[^']|'')*)'$/);\n if (quoted !== null) {\n const value = (quoted[1] as string).replaceAll(\"''\", \"'\");\n if (typeof mapped.type === \"object\") return { kind: \"enumValue\", value };\n if ((mapped.type === \"Int\" || mapped.type === \"Float\") && /^-?\\d+(\\.\\d+)?$/.test(value)) {\n return { kind: \"literal\", value: /^-?\\d+$/.test(value) ? exactIntegerLiteral({ text: value }) : Number(value) };\n }\n return { kind: \"literal\", value };\n }\n\n return { kind: \"dbgenerated\", sql: raw };\n}\n\n// ─── Quoting ──────────────────────────────────────────────────────\n\nfunction q(name: string): string {\n return sqliteDialect.quoteIdent({ name });\n}\n",
|
|
34
29
|
"/**\n * Statement-execution helpers shared by push and the migration runner.\n *\n * Two sqlite realities live here:\n *\n * - SELF-MANAGED SCRIPTS: the table-rebuild recipe (ddl/sqlite.ts) carries its\n * own `PRAGMA foreign_keys=OFF; BEGIN; … COMMIT; PRAGMA foreign_keys=ON;`\n * sequence, because `PRAGMA foreign_keys` is a no-op inside a transaction.\n * Callers must NOT wrap such scripts in an outer BEGIN/COMMIT —\n * `usesSelfManagedTransactions` detects them. Plain statements in a\n * self-managed script auto-commit individually (documented sqlite\n * limitation: a mixed script is not atomic as a whole; each rebuild block\n * is). Because of that, the migration runner records per-statement progress\n * for these scripts and resumes with `selfManagedResumeStart`, which rewinds\n * INTO the enclosing block so the session-scoped `PRAGMA foreign_keys=OFF`\n * is re-issued before the block replays.\n * - `PRAGMA foreign_key_check` RETURNS VIOLATION ROWS instead of failing —\n * `executeStatement` runs it row-returning (`values: []`, the adapter-sqlite\n * contract for reads) and throws VIBE_MIGRATION when any come back.\n */\n\nimport { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect } from \"@vibeorm/schema\";\nimport type { SqlExecutor } from \"./types.ts\";\n\n/** Marker statement opening a self-managed sqlite script (rebuild recipe). */\nconst SELF_MANAGED_MARKER = \"PRAGMA foreign_keys=OFF\";\n\n/** Marker statement CLOSING a self-managed block (restores FK enforcement). */\nconst SELF_MANAGED_RESTORE_MARKER = \"PRAGMA foreign_keys=ON\";\n\nconst FK_CHECK_PREFIX = \"PRAGMA foreign_key_check\";\n\n/** True when the script manages its own transactions (sqlite rebuilds). */\nexport function usesSelfManagedTransactions(params: { sql: readonly string[] }): boolean {\n return params.sql.some((statement) => statement.startsWith(SELF_MANAGED_MARKER));\n}\n\n// ─── Script shape ───────────────────────────────────────────\n\n/**\n * What one statement of a self-managed script means to the foreign-key region\n * and the transaction around it. Everything the runner's recovery reasons\n * about is one of these; `\"plain\"` is every ordinary statement.\n */\ntype SelfManagedControl = \"fkOff\" | \"fkOn\" | \"begin\" | \"endTransaction\" | \"abandon\" | \"plain\";\n\n/**\n * Classify a statement's effect on the region and the transaction.\n *\n * Whitespace is collapsed and case folded first, so `COMMIT ;` and `commit;`\n * read the same as the generated `COMMIT;`. `PRAGMA foreign_key_check` is a\n * read, not a region marker, and must not be mistaken for one.\n */\nfunction classifySelfManagedStatement(params: { statement: string }): SelfManagedControl {\n const text = params.statement.trim().replace(/\\s+/g, \" \").toUpperCase();\n if (/^PRAGMA FOREIGN_KEYS *= *OFF/.test(text)) return \"fkOff\";\n if (/^PRAGMA FOREIGN_KEYS *= *ON/.test(text)) return \"fkOn\";\n if (/^BEGIN\\b/.test(text)) return \"begin\";\n if (/^(COMMIT|END)\\b/.test(text)) return \"endTransaction\";\n // sqlite ends or re-scopes a transaction with these too. The generated\n // recipe emits none of them, and recovery cannot reason about a script that\n // does, so they are refused rather than silently mis-scanned.\n if (/^(ROLLBACK|SAVEPOINT|RELEASE)\\b/.test(text)) return \"abandon\";\n return \"plain\";\n}\n\n/**\n * Where a resume of a self-managed sqlite script must actually restart.\n *\n * A recorded statement_index can point INSIDE a rebuild block: the progress\n * UPDATE issued after `PRAGMA foreign_keys=OFF;` auto-commits (no transaction\n * is open yet), while every UPDATE after the block's `BEGIN;` is rolled back\n * with the crash — so the persisted index lands on the block's `BEGIN;`, one\n * past a pragma that is SESSION-scoped and gone in the new session. Resuming\n * there would run the rebuild — `DROP TABLE` of a possibly-referenced parent\n * included — with foreign keys ON.\n *\n * This rewinds `start` to the nearest preceding `PRAGMA foreign_keys=OFF` that\n * is not already closed by a `PRAGMA foreign_keys=ON`. Replaying from a\n * block's start is safe only for an uncommitted block: the runner checkpoints\n * past COMMIT inside the transaction, so a committed block is never replayed.\n * Legacy journals pointing AT COMMIT are ambiguous and refused by the runner.\n * Scripts with no marker before `start` are returned unchanged.\n */\nexport function selfManagedResumeStart(params: {\n sql: readonly string[];\n start: number;\n}): number {\n const { sql, start } = params;\n for (let index = start - 1; index >= 0; index -= 1) {\n const control = classifySelfManagedStatement({ statement: sql[index] as string });\n // Nearest marker wins, and a CLOSED transaction is a marker too. A block's\n // COMMIT ends the only thing protecting the statements above it, so\n // nothing below that COMMIT may be rewound past: those statements are on\n // disk, and re-running them is the silent double-apply this whole path\n // exists to prevent. `PRAGMA foreign_keys=ON` closes the region the same\n // way. Either way `start` is already the correct restart point.\n if (control === \"endTransaction\" || control === \"abandon\" || control === \"fkOn\") return start;\n if (control === \"fkOff\") return index;\n }\n return start;\n}\n\n/** True when a supported block must checkpoint BEFORE committing its transaction. */\nexport function isSelfManagedCommit(params: { statement: string }): boolean {\n return classifySelfManagedStatement(params) === \"endTransaction\";\n}\n\n/**\n * An old writer could persist an index AT COMMIT after the block committed.\n * The new writer checkpoints past it atomically and cannot produce this state.\n * Keep historical uncertainty visible until an operator establishes the result.\n */\nexport function assertSelfManagedResumeSafe(params: {\n sql: readonly string[];\n start: number;\n migration: string;\n direction: \"up\" | \"down\";\n}): void {\n const statement = params.sql[params.start];\n if (statement === undefined || !isSelfManagedCommit({ statement })) return;\n const completedIndex = params.direction === \"up\" ? params.start + 1 : -(params.start + 2);\n const rewind = selfManagedResumeStart({ sql: params.sql, start: params.start });\n const retryIndex = params.direction === \"up\" ? rewind : -(rewind + 1);\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `migration \"${params.migration}\" has a legacy sqlite checkpoint at ${params.direction} COMMIT (statement ${params.start + 1}). The block may already have committed; replay is refused. Inspect the block's effects. If it committed, set its journal statement_index to ${completedIndex} and error to NULL to resume the remaining statements. Only if the entire block did not commit, set statement_index to ${retryIndex} and error to NULL to retry the block. Do not mark the whole migration applied unless all remaining statements also ran.`,\n meta: { reason: \"uncertain-statement\", migration: params.migration, statementIndex: params.start, direction: params.direction, dialect: \"sqlite\" },\n });\n}\n\n/**\n * Statements sqlite will not run inside a transaction, plus transaction\n * control itself. Everything else sqlite CAN run there — its DDL is\n * transactional, unlike mysql's — so everything else can commit together with\n * its journal checkpoint.\n *\n * This is a legality list, not an attempt to understand what a statement does.\n * A statement wrongly kept off it would fail loudly on `BEGIN`, never silently,\n * and every entry is idempotent anyway, so leaving one unwrapped costs nothing.\n */\nconst NOT_TRANSACTIONAL_IN_SQLITE: readonly string[] = [\n \"PRAGMA\",\n \"BEGIN\",\n \"COMMIT\",\n \"END\",\n \"ROLLBACK\",\n \"SAVEPOINT\",\n \"RELEASE\",\n \"VACUUM\",\n \"ATTACH\",\n \"DETACH\",\n];\n\n/**\n * Can this statement of a self-managed sqlite script commit together with its\n * own journal checkpoint?\n *\n * True for a statement that sits OUTSIDE every rebuild block and that sqlite\n * allows inside a transaction. Wrapping such a statement with its checkpoint in\n * one `BEGIN`/`COMMIT` closes the crash window entirely: either both landed or\n * neither did, so a resume never has to guess whether it already ran.\n *\n * Block membership is decided by {@link selfManagedResumeStart}, the SAME\n * backward scan the resume path uses — the two can never disagree about where a\n * block starts. Inside a block no wrapping is possible or needed: the block\n * carries its own transaction, so nothing of it survives a crash and\n * `selfManagedResumeStart` rewinds to its opening pragma.\n */\nexport function canCheckpointAtomically(params: {\n sql: readonly string[];\n index: number;\n}): boolean {\n const statement = (params.sql[params.index] ?? \"\").trimStart().toUpperCase();\n if (NOT_TRANSACTIONAL_IN_SQLITE.some((keyword) => statement.startsWith(keyword))) return false;\n return selfManagedResumeStart({ sql: params.sql, start: params.index }) === params.index;\n}\n\n/** The shape the sqlite table-rebuild generator emits, quoted in refusals. */\nconst SUPPORTED_BLOCK_SHAPE =\n \"PRAGMA foreign_keys=OFF; BEGIN; ...; COMMIT; PRAGMA foreign_keys=ON;\";\n\nfunction unsupportedScript(params: {\n migration: string;\n direction: \"up\" | \"down\";\n index: number;\n statements: number;\n problem: string;\n found: string;\n}): VibeError {\n const { migration, direction, index, problem, found } = params;\n const subject = direction === \"down\" ? `the down script of migration \"${migration}\"` : `migration \"${migration}\"`;\n const position = `${direction === \"down\" ? \"down statement\" : \"statement\"} ${index + 1} of ${params.statements}`;\n return new VibeError({\n code: \"VIBE_MIGRATION\",\n message:\n `${subject} manages its own sqlite transactions, and ${position} breaks the shape recovery depends on: ${found}. `\n + `A table-rebuild block must be written exactly as \\`${SUPPORTED_BLOCK_SHAPE}\\`. `\n + \"Inside that block a crash rolls everything back, so a resume can replay it safely. \"\n + \"A statement that sits in a foreign-keys-off region with no transaction around it commits on its own, \"\n + \"and the resume would run it a second time with no error raised either time. \"\n + \"Nothing has been executed. Move the statement after `PRAGMA foreign_keys=ON`, where it commits together \"\n + \"with its own journal checkpoint, or give it its own `BEGIN;` and `COMMIT;`. \"\n + \"See \\\"Self-managed sqlite scripts\\\" in docs/migrations.md.\",\n meta: { reason: \"unsupported-self-managed-script\", problem, migration, statementIndex: index, direction },\n });\n}\n\n/**\n * Refuse a self-managed sqlite script whose control flow the resume path\n * cannot honour, BEFORE any statement of it runs.\n *\n * The generated rebuild recipe (ddl/sqlite.ts) always emits\n * `PRAGMA foreign_keys=OFF;` immediately followed by `BEGIN;`, and `COMMIT;`\n * immediately followed by `PRAGMA foreign_keys=ON;`. Recovery relies on that\n * adjacency: it is what makes \"inside a foreign-keys-off region\" and \"inside a\n * transaction\" the same statement set, so rewinding to the region's pragma can\n * never replay anything that already committed.\n *\n * A hand-authored script that deviates breaks the equivalence silently. An\n * unclosed pragma, or a statement between `COMMIT;` and the restore, commits on\n * its own while still counting as region-internal, so a crash replays it. That\n * is a data defect with no error attached, so the script is refused up front\n * instead. `resolveMigration` and `migrationStatus` are deliberately not\n * gated by this: an operator must still be able to read and repair the journal\n * row of a migration that is refused.\n */\nexport function assertSupportedSelfManagedScript(params: {\n sql: readonly string[];\n migration: string;\n direction: \"up\" | \"down\";\n}): void {\n const { sql, migration, direction } = params;\n const statements = sql.length;\n const refuse = (index: number, problem: string, found: string): VibeError =>\n unsupportedScript({ migration, direction, index, statements, problem, found });\n\n let state: \"outside\" | \"fkOff\" | \"inBlock\" | \"committed\" = \"outside\";\n let openedAt = -1;\n\n for (let index = 0; index < statements; index += 1) {\n const control = classifySelfManagedStatement({ statement: sql[index] as string });\n\n if (state === \"fkOff\") {\n if (control !== \"begin\") {\n throw refuse(index, \"fk-off-without-transaction\", \"`PRAGMA foreign_keys=OFF` is not followed by `BEGIN;`\");\n }\n state = \"inBlock\";\n continue;\n }\n\n if (state === \"committed\") {\n if (control !== \"fkOn\") {\n throw refuse(index, \"commit-without-restore\", \"`COMMIT;` is not followed by `PRAGMA foreign_keys=ON;`\");\n }\n state = \"outside\";\n continue;\n }\n\n if (state === \"inBlock\") {\n if (control === \"endTransaction\") {\n state = \"committed\";\n continue;\n }\n if (control === \"plain\") continue;\n throw refuse(index, \"unsupported-control-in-block\", \"transaction or pragma control appears inside an open rebuild block\");\n }\n\n // state === \"outside\": no region is open and no transaction is running.\n if (control === \"fkOff\") {\n state = \"fkOff\";\n openedAt = index;\n continue;\n }\n if (control === \"begin\" || control === \"endTransaction\" || control === \"abandon\") {\n throw refuse(index, \"transaction-control-outside-block\", \"transaction control appears outside any rebuild block\");\n }\n }\n\n if (state !== \"outside\") {\n throw refuse(\n openedAt,\n state === \"committed\" ? \"commit-without-restore\" : \"unclosed-block\",\n state === \"committed\"\n ? \"the block commits but never restores foreign keys with `PRAGMA foreign_keys=ON;`\"\n : \"`PRAGMA foreign_keys=OFF` is never closed by `COMMIT;` and `PRAGMA foreign_keys=ON;`\",\n );\n }\n}\n\n/**\n * Execute one migration statement. On sqlite, `PRAGMA foreign_key_check` is\n * executed row-returning and its violations become a VIBE_MIGRATION error.\n */\nexport async function executeStatement(params: {\n executor: SqlExecutor;\n statement: string;\n dialect: Dialect;\n}): Promise<void> {\n const { executor, statement, dialect } = params;\n if (dialect === \"sqlite\" && statement.startsWith(FK_CHECK_PREFIX)) {\n const rows = await executor({ text: statement, values: [] });\n if (rows.length > 0) {\n const sample = rows\n .slice(0, 5)\n .map((row) => `${String(row.table)} rowid ${String(row.rowid)} → ${String(row.parent)}`)\n .join(\"; \");\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `foreign key check failed after table rebuild: ${rows.length} violation(s) — ${sample}`,\n meta: { violations: rows },\n });\n }\n return;\n }\n await executor({ text: statement });\n}\n\n/**\n * Best-effort cleanup after a failed self-managed sqlite script: roll back a\n * possibly-open rebuild transaction and restore FK enforcement. Never throws\n * — the original failure matters more.\n */\nexport async function cleanupSelfManagedFailure(params: { executor: SqlExecutor }): Promise<void> {\n try {\n await params.executor({ text: \"ROLLBACK;\" });\n } catch {\n // No transaction was open — fine.\n }\n try {\n await params.executor({ text: \"PRAGMA foreign_keys=ON;\" });\n } catch {\n // Restoring the pragma is best-effort.\n }\n}\n",
|
|
35
30
|
"import { VibeError } from \"@vibeorm/schema\";\nimport type { QualifiedSqlName } from \"@vibeorm/schema\";\nimport { postgresDialect, renderPostgresDefaultFunctionIdentity } from \"@vibeorm/sql\";\nimport type { SqlExecutor } from \"./types.ts\";\n\ntype FunctionCall = { readonly namespace?: string; readonly name: string };\n\n// Only an entire, zero-argument call is supported. No comments, casts,\n// operators, arguments or quoted literal contents are rewritten.\nconst IDENTIFIER = '(?:\"(?:[^\"\\\\u0000]|\"\")+\"|[A-Za-z_][A-Za-z_0-9$]*)';\nconst CALL: RegExp = new RegExp(`^\\\\s*(${IDENTIFIER})(?:\\\\s*\\\\.\\\\s*(${IDENTIFIER}))?\\\\s*\\\\(\\\\s*\\\\)\\\\s*$`);\n\nfunction parseCall(params: { expression: string }): FunctionCall | undefined {\n const match = CALL.exec(params.expression);\n if (match === null) return undefined;\n const identifier = (value: string): string => value.startsWith('\"') ? value.slice(1, -1).replaceAll('\"\"', '\"') : value.toLowerCase();\n const first = identifier(match[1]!);\n return match[2] === undefined ? { name: first } : { namespace: first, name: identifier(match[2]) };\n}\n\n/** Prove only qualified zero-argument default calls against the stored catalog identity. */\nexport async function equivalentPostgresDefaultFunction(params: {\n executor: SqlExecutor;\n table: QualifiedSqlName;\n column: string;\n expected: string;\n actual: string;\n}): Promise<boolean> {\n const expected = parseCall({ expression: params.expected });\n const observed = parseCall({ expression: params.actual });\n // An unqualified declaration has no independent namespace identity. Never\n // resolve it against the target's search_path to manufacture an expectation.\n if (expected?.namespace === undefined || observed === undefined) return false;\n const query = renderPostgresDefaultFunctionIdentity({ dialect: postgresDialect, table: params.table, column: params.column });\n const rows = await params.executor({ text: query.text, values: [...query.values] }).catch((cause: unknown) => {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot inspect the stored default function identity\", meta: { reason: \"default-inspection-unavailable\", table: params.table, column: params.column }, cause });\n });\n if (rows.length !== 1) return false;\n const row = rows[0]!;\n if (row.zeroArguments !== true || row.exactResultType !== true || typeof row.expression !== \"string\") return false;\n const stored = parseCall({ expression: row.expression });\n if (stored === undefined) return false;\n return row.functionNamespace === expected.namespace && row.functionName === expected.name &&\n stored.name === row.functionName && (stored.namespace === undefined || stored.namespace === row.functionNamespace) &&\n observed.name === row.functionName && (observed.namespace === undefined || observed.namespace === row.functionNamespace);\n}\n",
|
|
36
31
|
"import { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect } from \"@vibeorm/schema\";\n\n/** Shared SQL-file splitting. Unaffected statement bytes remain checksum-compatible. */\nconst COMPOUND_BODY_HEADER =\n /^(?:\\s|--[^\\n]*\\n|\\/\\*[\\s\\S]*?\\*\\/)*CREATE\\s+(?:OR\\s+REPLACE\\s+)?(?:(?:TEMP|TEMPORARY)\\s+)?(?:DEFINER\\s*=\\s*\\S+\\s+)?(?:TRIGGER|PROCEDURE|FUNCTION|EVENT)\\b/i;\nconst BLOCK_OPENERS = new Set([\"BEGIN\", \"CASE\", \"IF\", \"LOOP\", \"WHILE\", \"REPEAT\"]);\n\n/** Split statements without splitting quoted strings or stored-program bodies. */\nexport function splitSqlStatements(params: { sql: string; dialect?: Dialect }): string[] {\n const { sql, dialect } = params;\n const statements: string[] = [];\n let current = \"\";\n let hasContent = false;\n let i = 0;\n let blockDepth = 0;\n let compound = false;\n let afterEnd = false;\n const push = (): void => {\n const trimmed = current.trim();\n if (trimmed.length > 0 && hasContent) statements.push(trimmed);\n current = \"\";\n hasContent = false;\n blockDepth = 0;\n compound = false;\n afterEnd = false;\n };\n while (i < sql.length) {\n const ch = sql[i]!;\n const next = sql[i + 1];\n if ((ch === \"-\" && next === \"-\" && (dialect !== \"mysql\" || /\\s/.test(sql[i + 2] ?? \"\\n\"))) || (ch === \"#\" && dialect === \"mysql\")) {\n while (i < sql.length && sql[i] !== \"\\n\") { current += sql[i]; i++; }\n continue;\n }\n if (ch === \"/\" && next === \"*\") {\n current += sql.slice(i, i + 2);\n i += 2;\n let depth = 1;\n while (i < sql.length && depth > 0) {\n if (sql[i] === \"/\" && sql[i + 1] === \"*\" && (dialect === undefined || dialect === \"postgres\")) {\n depth++;\n current += \"/*\";\n i += 2;\n } else if (sql[i] === \"*\" && sql[i + 1] === \"/\") {\n depth--;\n current += \"*/\";\n i += 2;\n } else { current += sql[i]; i++; }\n }\n continue;\n }\n const escapeString = (dialect === undefined || dialect === \"postgres\") && (ch === \"e\" || ch === \"E\") && next === \"'\" && !/[A-Za-z0-9_$]/.test(sql[i - 1] ?? \"\");\n if (escapeString) { current += ch; i++; }\n const quote = sql[i]!;\n if (escapeString || quote === \"'\" || quote === '\"' || (quote === \"`\" && dialect !== \"postgres\") || (quote === \"[\" && (dialect === undefined || dialect === \"sqlite\"))) {\n hasContent = true;\n const endQuote = quote === \"[\" ? \"]\" : quote;\n current += quote;\n i++;\n while (i < sql.length) {\n const value = sql[i]!;\n current += value;\n if (value === \"\\\\\" && (quote === \"'\" || quote === '\"')) {\n if (escapeString) {\n if (sql[i + 1] !== undefined) current += sql[i + 1];\n i += 2;\n continue;\n }\n if (dialect === \"mysql\" || dialect === undefined) {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"SQL string backslash escaping depends on the session SQL mode; use mode-independent quoting and pass the migration dialect\", meta: { reason: \"sql-mode-ambiguous\", dialect } });\n }\n }\n if (value === endQuote) {\n if (quote !== \"[\" && sql[i + 1] === endQuote) { current += endQuote; i += 2; continue; }\n i++;\n break;\n }\n i++;\n }\n continue;\n }\n if (ch === \"$\" && (dialect === undefined || dialect === \"postgres\") && !/[A-Za-z0-9_$]/.test(sql[i - 1] ?? \"\")) {\n const tagMatch = /^\\$(?:[A-Za-z_][A-Za-z_0-9]*)?\\$/.exec(sql.slice(i));\n if (tagMatch !== null) {\n hasContent = true;\n const tag = tagMatch[0];\n const end = sql.indexOf(tag, i + tag.length);\n const stop = end === -1 ? sql.length : end + tag.length;\n current += sql.slice(i, stop);\n i = stop;\n continue;\n }\n }\n if (ch === \";\") {\n if (blockDepth > 0) { current += ch; i++; continue; }\n push();\n i++;\n continue;\n }\n const word = /^[A-Za-z_][A-Za-z_0-9]*/.exec(sql.slice(i))?.[0];\n if (word !== undefined) {\n hasContent = true;\n if (!compound && COMPOUND_BODY_HEADER.test(current + word)) compound = true;\n if (compound) {\n const upper = word.toUpperCase();\n const rest = sql.slice(i + word.length);\n const opens = !afterEnd && (upper === \"BEGIN\" || (blockDepth > 0 && BLOCK_OPENERS.has(upper)\n && !/^\\s*\\(/.test(rest) && !(upper === \"IF\" && /^\\s+(?:NOT\\s+)?EXISTS\\b/i.test(rest))));\n afterEnd = upper === \"END\";\n if (opens) blockDepth += 1;\n else if (upper === \"END\" && blockDepth > 0) blockDepth -= 1;\n }\n current += word;\n i += word.length;\n continue;\n }\n if (!/\\s/.test(ch)) hasContent = true;\n current += ch;\n i++;\n }\n push();\n return statements;\n}\n\n/** Render the historical semicolon-terminated migration-file representation. */\nexport function joinSqlStatements(params: { sql: readonly string[] }): string {\n return params.sql.map((statement) => `${statement.trimEnd()};`).join(\"\\n\\n\") + \"\\n\";\n}\n",
|
|
37
32
|
"import { assertModuleOwnership } from \"./module-ownership.ts\";\nimport { splitSqlStatements } from \"./sql-statements.ts\";\nimport { createHash } from \"node:crypto\";\nimport { VibeError, isSqlObjectIdentity, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, SqlObjectIdentity } from \"@vibeorm/schema\";\nimport { assertDesiredState, canonicalMigrationJson, parseMigrationMetadata } from \"./desired-state.ts\";\nimport type { MigrationFile } from \"./types.ts\";\n\n/** Complete package-authored source, retained even when application state is composed later. */\nexport type ModuleMigrationSource = Omit<MigrationFile, \"moduleOrigin\">;\n\n/** Immutable provenance for one ordered package upgrade, not proof that it was applied. */\nexport type ModuleMigrationOrigin = {\n readonly version: 1;\n readonly moduleId: string;\n readonly dialect: Dialect;\n readonly previousRevision: string | null;\n readonly revision: string;\n readonly contracts: readonly string[];\n readonly owned: readonly SqlObjectIdentity[];\n readonly source: ModuleMigrationSource;\n readonly artifactChecksum: string;\n};\n\n/** The source snapshot carries all execution/security/reverse metadata in one data-only sidecar. */\nexport const MODULE_ORIGIN_METADATA: Readonly<{ filename: string; version: 1 }> = Object.freeze({ filename: \"module-origin.json\", version: 1 });\n\nfunction invalid(): VibeError {\n return new VibeError({ code: \"VIBE_MIGRATION\", message: \"Module migration origin is malformed or differs from its immutable package artifact; restore the reviewed artifact\", meta: { reason: \"module-origin-invalid\" } });\n}\nfunction record(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction identifier(value: unknown): value is string {\n return typeof value === \"string\" && value.trim().length > 0 && !value.includes(\"\\0\");\n}\nfunction strings(value: unknown): value is readonly string[] {\n return Array.isArray(value) && value.every((entry) => typeof entry === \"string\");\n}\nfunction checksum(params: { value: Omit<ModuleMigrationOrigin, \"artifactChecksum\"> }): string {\n return createHash(\"sha256\").update(canonicalMigrationJson({ value: params.value })).digest(\"hex\");\n}\nfunction freezeData(params: { value: unknown }): void {\n if (params.value === null || typeof params.value !== \"object\" || Object.isFrozen(params.value)) return;\n for (const value of Object.values(params.value)) freezeData({ value });\n Object.freeze(params.value);\n}\n\n/** Validate sidecar shape and the checksum of the complete source plus ownership/compatibility metadata. */\nexport function assertModuleOrigin(params: { value: unknown }): asserts params is { value: ModuleMigrationOrigin } {\n const value = params.value;\n if (!record(value) || value.version !== 1 || !identifier(value.moduleId) || !identifier(value.revision)\n || !(value.previousRevision === null || identifier(value.previousRevision)) || value.previousRevision === value.revision\n || ![\"postgres\", \"sqlite\", \"mysql\"].includes(String(value.dialect))\n || !strings(value.contracts) || value.contracts.length === 0 || !value.contracts.every(identifier) || new Set(value.contracts).size !== value.contracts.length\n || !Array.isArray(value.owned) || !value.owned.every(isSqlObjectIdentity)\n || !record(value.source) || \"moduleOrigin\" in value.source || !identifier(value.source.name) || !strings(value.source.sql)\n || typeof value.source.destructive !== \"boolean\" || (value.source.downSql !== undefined && !strings(value.source.downSql))\n || value.source.desiredState === undefined || value.source.desiredStatePending !== undefined\n || typeof value.artifactChecksum !== \"string\" || !/^[a-f0-9]{64}$/.test(value.artifactChecksum)) throw invalid();\n if (new Set(value.owned.map((identity) => sqlObjectKey({ identity }))).size !== value.owned.length) throw invalid();\n const desired = { value: value.source.desiredState, migration: value.source.name };\n assertDesiredState(desired);\n if (desired.value.dialect !== value.dialect) throw invalid();\n const { artifactChecksum, ...payload } = value;\n if (checksum({ value: payload as Omit<ModuleMigrationOrigin, \"artifactChecksum\"> }) !== artifactChecksum) throw invalid();\n assertModuleOwnership({ origin: value as ModuleMigrationOrigin });\n}\n\n/** Snapshot the package's authored upgrade; later mutation of author inputs cannot alter it. */\nexport function createModuleOrigin(params: Omit<ModuleMigrationOrigin, \"version\" | \"artifactChecksum\">): ModuleMigrationOrigin {\n const payload = { ...params, version: 1 as const };\n const candidate = { value: { ...payload, artifactChecksum: checksum({ value: payload }) } };\n assertModuleOrigin(candidate);\n const result = JSON.parse(canonicalMigrationJson({ value: candidate.value })) as ModuleMigrationOrigin;\n freezeData({ value: result });\n return result;\n}\n\n/** Absent module metadata contributes zero bytes to every historical checksum. */\nexport function moduleOriginChecksumSuffix(params: { moduleOrigin?: ModuleMigrationOrigin }): string {\n if (params.moduleOrigin === undefined) return \"\";\n assertModuleOrigin({ value: params.moduleOrigin });\n return `\\n-- vibeorm:module-origin ${canonicalMigrationJson({ value: params.moduleOrigin })}`;\n}\n\n/** Read the sidecar through the same typed JSON boundary as desired-state metadata. */\nexport function parseModuleOrigin(params: { text: string }): ModuleMigrationOrigin {\n return parseMigrationMetadata({ text: params.text, parse: (value) => {\n const checked = { value };\n assertModuleOrigin(checked);\n return checked.value;\n }, failure: invalid });\n}\n\n\n/** Applying a module cannot discard the source's execution, reverse, security or desired-state metadata. */\nexport function assertMaterializedModuleMigration(params: { migration: MigrationFile }): void {\n const { migration } = params;\n if (migration.moduleOrigin === undefined) return;\n const restored = restoreModuleMigration({ migration, origin: migration.moduleOrigin });\n if (migration.desiredState === undefined || canonicalMigrationJson({ value: restored }) !== canonicalMigrationJson({ value: migration })) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Materialized module metadata differs from its immutable source\", meta: { reason: \"module-source-state-mismatch\", moduleId: migration.moduleOrigin.moduleId } });\n}\n\n/** Restore the complete source metadata while allowing a separately reviewed application desired state. */\nexport function restoreModuleMigration(params: { migration: MigrationFile; origin: ModuleMigrationOrigin }): MigrationFile {\n const { migration, origin } = params;\n assertModuleOrigin({ value: origin });\n for (const key of [\"sql\", \"downSql\"] as const) {\n const actual = migration[key];\n if (actual === undefined) continue;\n const normalized = (sql: readonly string[]): string[] => sql.flatMap((text) => splitSqlStatements({ sql: text, dialect: origin.dialect }));\n if (canonicalMigrationJson({ value: normalized(actual) }) !== canonicalMigrationJson({ value: normalized(origin.source[key] ?? []) })) throw invalid();\n }\n for (const key of [\"execution\", \"downExecution\", \"rls\", \"securityChanges\", \"downSecurityChanges\"] as const) {\n if (migration[key] !== undefined && canonicalMigrationJson({ value: migration[key] }) !== canonicalMigrationJson({ value: origin.source[key] })) throw invalid();\n }\n return { ...origin.source, name: migration.name, ...(migration.desiredState === undefined ? {} : { desiredState: migration.desiredState }), moduleOrigin: origin };\n}\n",
|
|
38
|
-
"import { VibeError
|
|
33
|
+
"import { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect } from \"@vibeorm/schema\";\nimport { getSqlDialect, renderShadowOperation } from \"@vibeorm/sql\";\nimport type { SqlExecutor } from \"./types.ts\";\n\nconst replayExecutors = new WeakSet<SqlExecutor>();\n\n/** Refuse application migration writes to databases claimed for disposable replay. */\nexport async function assertDatabaseNotShadow(params: { executor: SqlExecutor; dialect: Dialect }): Promise<void> {\n if (params.dialect === \"sqlite\" || replayExecutors.has(params.executor)) return;\n const [query] = renderShadowOperation({ dialect: getSqlDialect({ dialect: params.dialect }), operation: { kind: \"markerExists\" } });\n const rows = await params.executor({ text: query!.text, values: [...query!.values] });\n if (rows.length !== 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"This database is claimed as a disposable migration shadow. Application migrations must use the deployment target.\", meta: { reason: \"shadow-database-is-not-target\" } });\n}\n\n/** @internal Permit only the already pinned session during lifecycle-owned replay. */\nexport function runShadowReplay<T>(params: { executor: SqlExecutor; run: () => Promise<T> }): Promise<T> {\n replayExecutors.add(params.executor);\n return Promise.resolve().then(params.run).finally(() => { replayExecutors.delete(params.executor); });\n}\n",
|
|
34
|
+
"import { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport { canonicalMigrationJson } from \"./desired-state.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { migrationChecksum } from \"./migration-checksum.ts\";\nimport type { ModuleJournalRecord } from \"./module-journal.ts\";\nimport type { ModuleMigrationOrigin } from \"./module-origin.ts\";\nimport { assertModuleOwnership } from \"./module-ownership.ts\";\nimport type { MigrationFile } from \"./types.ts\";\n\nfunction refusal(params: { reason: string; moduleId: string; revision?: string }): VibeError {\n return new VibeError({ code: \"VIBE_MIGRATION\", message: `Module ${params.moduleId} history, ownership or predecessor state is inconsistent; restore or complete the reviewed upgrade first`, meta: params });\n}\n\n/** Validate ordered chains, never selecting an earlier completed entry past a later incomplete one. */\nexport function moduleHistoryHeads(params: { records: ReadonlyMap<string, ModuleJournalRecord> }): Map<string, ModuleJournalRecord> {\n const heads = new Map<string, ModuleJournalRecord>();\n const revisions = new Map<string, Set<string>>();\n for (const record of params.records.values()) {\n const origin = record.entry?.migration.moduleOrigin;\n if (origin === undefined) continue;\n const previous = heads.get(origin.moduleId);\n const seen = revisions.get(origin.moduleId) ?? new Set<string>();\n if (seen.has(origin.revision) || origin.previousRevision !== (previous?.entry?.migration.moduleOrigin?.revision ?? null)) throw refusal({ reason: \"module-chain-invalid\", moduleId: origin.moduleId, revision: origin.revision });\n if (previous !== undefined && (!previous.entry!.complete || previous.row.error !== undefined || previous.row.statementIndex !== previous.entry!.migration.sql.length)) throw refusal({ reason: \"module-chain-incomplete\", moduleId: origin.moduleId });\n if (previous !== undefined && canonicalMigrationJson({ value: previous.entry!.migration.moduleOrigin!.source.desiredState!.to }) !== canonicalMigrationJson({ value: origin.source.desiredState!.from })) throw refusal({ reason: \"module-predecessor-state\", moduleId: origin.moduleId });\n seen.add(origin.revision);\n revisions.set(origin.moduleId, seen);\n heads.set(origin.moduleId, record);\n }\n return heads;\n}\n\n/** Installed module expectations for an ordinary application file, including subset runners. */\nexport function applicationModuleOrigins(params: { migration: MigrationFile; records: ReadonlyMap<string, ModuleJournalRecord> }): readonly ModuleMigrationOrigin[] {\n if (params.migration.moduleOrigin !== undefined || params.migration.desiredState !== undefined) return [];\n const origins: ModuleMigrationOrigin[] = [];\n for (const [moduleId, head] of moduleHistoryHeads(params)) {\n if (!head.entry!.complete || head.row.error !== undefined || head.row.statementIndex !== head.entry!.migration.sql.length) throw refusal({ reason: \"module-chain-incomplete\", moduleId });\n origins.push(head.entry!.migration.moduleOrigin!);\n }\n return origins;\n}\n\nfunction preserves(params: { actual: DesiredState; expected: DesiredState; moduleId: string }): void {\n const tables = new Set(params.expected.schema.models.map((model) => model.dbName ?? model.name));\n const enums = new Set(params.expected.schema.enums.map((entry) => entry.dbName ?? entry.name));\n const models = params.actual.schema.models.filter((model) => tables.has(model.dbName ?? model.name));\n const declaredEnums = params.actual.schema.enums.filter((entry) => enums.has(entry.dbName ?? entry.name));\n if (canonicalMigrationJson({ value: models }) !== canonicalMigrationJson({ value: params.expected.schema.models }) || canonicalMigrationJson({ value: declaredEnums }) !== canonicalMigrationJson({ value: params.expected.schema.enums })) throw refusal({ reason: \"module-application-mutation\", moduleId: params.moduleId });\n const objectKeys = new Set((params.expected.schema.migrationObjects ?? []).map((object) => sqlObjectKey({ identity: object.identity })));\n const definitionKeys = new Set(params.expected.definitions.map((definition) => sqlObjectKey({ identity: definition.identity })));\n if (canonicalMigrationJson({ value: (params.actual.schema.migrationObjects ?? []).filter((object) => objectKeys.has(sqlObjectKey({ identity: object.identity }))) }) !== canonicalMigrationJson({ value: params.expected.schema.migrationObjects ?? [] }) || canonicalMigrationJson({ value: params.actual.definitions.filter((definition) => definitionKeys.has(sqlObjectKey({ identity: definition.identity }))) }) !== canonicalMigrationJson({ value: params.expected.definitions })) throw refusal({ reason: \"module-application-mutation\", moduleId: params.moduleId });\n for (const model of params.actual.schema.models) for (const relation of model.relations) {\n const target = params.actual.schema.models.find((candidate) => candidate.name === relation.targetModel);\n if (target !== undefined && tables.has(model.dbName ?? model.name) !== tables.has(target.dbName ?? target.name)) throw refusal({ reason: \"module-external-dependency\", moduleId: params.moduleId });\n }\n}\n\n/** Lock-held admission for the full pending sequence, including conflicts with prior module ownership. */\nexport function assertModuleUpgradeHistory(params: { migrations: readonly MigrationFile[]; records: ReadonlyMap<string, ModuleJournalRecord> }): void {\n const heads = moduleHistoryHeads(params);\n const owners = new Map<string, string>();\n const register = (migration: MigrationFile): void => {\n const origin = migration.moduleOrigin!;\n for (const identity of origin.owned) {\n const key = sqlObjectKey({ identity });\n if (owners.has(key) && owners.get(key) !== origin.moduleId) throw refusal({ reason: \"module-object-collision\", moduleId: origin.moduleId });\n owners.set(key, origin.moduleId);\n }\n };\n for (const record of params.records.values()) if (record.entry !== undefined) register(record.entry.migration);\n for (const migration of params.migrations) {\n const stored = params.records.get(migration.name);\n const origin = migration.moduleOrigin;\n if (stored !== undefined) {\n if (origin !== undefined && (stored.entry === undefined || stored.row.checksum !== migrationChecksum(migration))) throw refusal({ reason: \"module-history-invalid\", moduleId: origin.moduleId });\n continue;\n }\n if (origin === undefined) {\n for (const [moduleId, head] of heads) {\n // Plain SQL is protected by live module checks inside the execution boundary.\n if (migration.desiredState === undefined) continue;\n const expected = head.entry!.migration.moduleOrigin!.source.desiredState!.to;\n for (const actual of [migration.desiredState.from, migration.desiredState.to, migration.desiredState.down ?? migration.desiredState.from]) preserves({ actual, expected, moduleId });\n }\n continue;\n }\n assertModuleOwnership({ origin, desiredState: migration.desiredState });\n const previous = heads.get(origin.moduleId);\n if (origin.previousRevision !== (previous?.entry?.migration.moduleOrigin?.revision ?? null)) throw refusal({ reason: \"module-chain-invalid\", moduleId: origin.moduleId, revision: origin.revision });\n if (previous === undefined) {\n const before = origin.source.desiredState!.from;\n if (before.schema.models.length > 0 || before.schema.enums.length > 0 || (before.schema.migrationObjects?.length ?? 0) > 0 || before.definitions.length > 0) throw refusal({ reason: \"module-adoption-required\", moduleId: origin.moduleId });\n } else {\n if (!previous.entry!.complete || previous.row.error !== undefined || previous.row.statementIndex !== previous.entry!.migration.sql.length) throw refusal({ reason: \"module-chain-incomplete\", moduleId: origin.moduleId });\n if (canonicalMigrationJson({ value: previous.entry!.migration.moduleOrigin!.source.desiredState!.to }) !== canonicalMigrationJson({ value: origin.source.desiredState!.from })) throw refusal({ reason: \"module-predecessor-state\", moduleId: origin.moduleId });\n }\n register(migration);\n heads.set(origin.moduleId, { row: { checksum: migrationChecksum(migration), statementIndex: migration.sql.length }, entry: { version: 1, migration, complete: true } });\n }\n}\n",
|
|
39
35
|
"import { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect } from \"@vibeorm/schema\";\nimport { getSqlDialect, MODULE_JOURNAL_COLUMN, renderModuleJournal } from \"@vibeorm/sql\";\nimport { canonicalMigrationJson, parseMigrationMetadata } from \"./desired-state.ts\";\nimport { migrationChecksum } from \"./migration-checksum.ts\";\nimport { assertModuleOrigin, assertMaterializedModuleMigration } from \"./module-origin.ts\";\nimport { assertModuleOwnership } from \"./module-ownership.ts\";\nimport { readJournalRows } from \"./journal-read.ts\";\nimport type { JournalRow } from \"./journal-read.ts\";\nimport { MIGRATIONS_TABLE_NAME } from \"./journal-table.ts\";\nimport type { MigrationFile, SqlExecutor } from \"./types.ts\";\n\n/** Completion is independent of cursor position: final verification may still fail. */\nexport type ModuleJournalEntry = { readonly version: 1; readonly migration: MigrationFile; readonly complete: boolean };\nexport type ModuleJournalRecord = { readonly row: JournalRow; readonly entry?: ModuleJournalEntry };\n\nfunction invalid(): VibeError {\n return new VibeError({ code: \"VIBE_MIGRATION\", message: \"Module migration history is missing, altered or inconsistent; restore the reviewed history before using this module\", meta: { reason: \"module-history-invalid\" } });\n}\n\n/** Validate both stored source provenance and the local execution checksum. */\nexport function parseModuleJournalEntry(params: { text: string; name: string; checksum: string }): ModuleJournalEntry {\n return parseMigrationMetadata({ text: params.text, failure: invalid, parse: (value) => {\n if (value === null || typeof value !== \"object\" || !(\"version\" in value) || value.version !== 1 || !(\"complete\" in value) || typeof value.complete !== \"boolean\" || !(\"migration\" in value) || value.migration === null || typeof value.migration !== \"object\") throw invalid();\n const migration = value.migration as MigrationFile;\n assertModuleOrigin({ value: migration.moduleOrigin });\n if (migration.name !== params.name || migrationChecksum(migration) !== params.checksum) throw invalid();\n assertMaterializedModuleMigration({ migration });\n assertModuleOwnership({ origin: migration.moduleOrigin!, desiredState: migration.desiredState });\n return { version: 1, complete: value.complete, migration };\n } });\n}\n\n/** Read-only journal access: an absent journal or old journal without the optional column is not upgraded. */\nexport async function readModuleJournal(params: { executor: SqlExecutor; dialect: Dialect }): Promise<ReadonlyMap<string, ModuleJournalRecord>> {\n const query = renderModuleJournal({ dialect: getSqlDialect({ dialect: params.dialect }), table: MIGRATIONS_TABLE_NAME, operation: { kind: \"read\" } });\n const rows = await readJournalRows({ ...params, query });\n return new Map([...(rows ?? [])].map(([name, row]) => {\n const entry = row.moduleEntry === undefined ? undefined : parseModuleJournalEntry({ text: row.moduleEntry, name, checksum: row.checksum });\n if (entry !== undefined && entry.migration.moduleOrigin!.dialect !== params.dialect) throw invalid();\n return [name, { row, ...(entry === undefined ? {} : { entry }) }];\n }));\n}\n\n/** Deployment-only, lock-held schema upgrade on the existing history table. */\nexport async function ensureModuleJournal(params: { executor: SqlExecutor; dialect: Dialect }): Promise<void> {\n const dialect = getSqlDialect({ dialect: params.dialect });\n const columns = await params.executor(renderModuleJournal({ dialect, table: MIGRATIONS_TABLE_NAME, operation: { kind: \"columns\" } }));\n if (columns.some((row) => row.name === MODULE_JOURNAL_COLUMN)) return;\n await params.executor(renderModuleJournal({ dialect, table: MIGRATIONS_TABLE_NAME, operation: { kind: \"addColumn\" } }));\n}\n\n/** First record is complete only on the transactional path, within the same commit as its SQL. */\nexport async function insertModuleJournal(params: { executor: SqlExecutor; dialect: Dialect; migration: MigrationFile; index: number; complete: boolean }): Promise<void> {\n await params.executor(renderModuleJournal({ dialect: getSqlDialect({ dialect: params.dialect }), table: MIGRATIONS_TABLE_NAME, operation: {\n kind: \"insert\", name: params.migration.name, checksum: migrationChecksum(params.migration), index: params.index,\n entry: canonicalMigrationJson({ value: { version: 1, migration: params.migration, complete: params.complete } }),\n } }));\n}\n\n/** Called only after statement progress and final desired-state verification have completed. */\nexport async function completeModuleJournal(params: { executor: SqlExecutor; dialect: Dialect; migration: MigrationFile }): Promise<void> {\n await params.executor(renderModuleJournal({ dialect: getSqlDialect({ dialect: params.dialect }), table: MIGRATIONS_TABLE_NAME, operation: {\n kind: \"complete\", name: params.migration.name, entry: canonicalMigrationJson({ value: { version: 1, migration: params.migration, complete: true } }),\n } }));\n}\n\n/** Neither repair sentinels nor a completed cursor can manufacture a completed module revision. */\nexport function moduleRecordComplete(params: { migration: MigrationFile; stored: JournalRow }): boolean {\n const { migration, stored } = params;\n if (stored.moduleEntry === undefined || stored.checksum === \"\") throw invalid();\n const entry = parseModuleJournalEntry({ text: stored.moduleEntry, name: migration.name, checksum: stored.checksum });\n if (migrationChecksum(migration) !== stored.checksum) throw invalid();\n return entry.complete && stored.error === undefined && stored.statementIndex === migration.sql.length;\n}\n",
|
|
40
36
|
"import { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect } from \"@vibeorm/schema\";\nimport { inspectSqlObject } from \"./inspect-objects.ts\";\nimport { MIGRATIONS_TABLE_NAME } from \"./journal-table.ts\";\nimport type { SqlExecutor } from \"./types.ts\";\n\n/** Validated journal data, shared by the runner and read-only history API. */\nexport type JournalRow = { readonly checksum: string; readonly statementIndex: number; readonly error?: string; readonly moduleEntry?: string };\n\nconst MISSING_TABLE_IDENTIFIERS: ReadonlySet<string> = new Set([\"42P01\", \"42S02\", \"ER_NO_SUCH_TABLE\"]);\n\nfunction isMissingTable(params: { cause: unknown }): boolean {\n let current = params.cause;\n for (let depth = 0; depth < 6 && current !== null && typeof current === \"object\"; depth++) {\n const record = current as Record<string, unknown>;\n for (const key of [\"code\", \"errno\", \"sqlState\"]) {\n const value = record[key];\n if (typeof value === \"string\" && MISSING_TABLE_IDENTIFIERS.has(value)) return true;\n }\n current = record.cause;\n }\n return false;\n}\n\n/**\n * Execute a journal read without creating it. Undefined means proven absence,\n * never a denied read. SQLite has no missing-table error code, so an unsuccessful\n * read is followed by catalog inspection rather than matching error messages.\n * This module never imports runner/history, keeping their shared reader acyclic.\n */\nexport async function readJournalRows(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n query: { readonly text: string; readonly values?: readonly unknown[] };\n}): Promise<Map<string, JournalRow> | undefined> {\n const rows = await params.executor({ text: params.query.text, values: [...(params.query.values ?? [])] }).catch(async (cause: unknown) => {\n if (params.dialect !== \"sqlite\" && isMissingTable({ cause })) return undefined;\n if (params.dialect === \"sqlite\") {\n const presence = await inspectSqlObject({ executor: params.executor, dialect: \"sqlite\", identity: { kind: \"table\", name: { namespace: \"main\", name: MIGRATIONS_TABLE_NAME } } });\n if (presence.state === \"missing\") return undefined;\n }\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot inspect migration history; check SELECT privileges\", meta: { reason: \"history-unavailable\" }, cause });\n });\n if (rows === undefined) return undefined;\n const result = new Map<string, JournalRow>();\n for (const row of rows) {\n const index = row.statement_index;\n if (typeof row.name !== \"string\" || typeof row.checksum !== \"string\"\n || (typeof index !== \"number\" && typeof index !== \"string\") || (typeof index === \"string\" && !/^-?\\d+$/.test(index)) || !Number.isSafeInteger(Number(index))\n || (row.module_origin !== null && row.module_origin !== undefined && typeof row.module_origin !== \"string\")\n || (row.error !== null && row.error !== undefined && typeof row.error !== \"string\") || result.has(row.name)) {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Malformed migration journal row\", meta: { reason: \"history-unavailable\" } });\n }\n result.set(row.name, { checksum: row.checksum, statementIndex: Number(index), ...(typeof row.error === \"string\" ? { error: row.error } : {}), ...(typeof row.module_origin === \"string\" ? { moduleEntry: row.module_origin } : {}) });\n }\n return result;\n}\n",
|
|
41
|
-
"/**\n * Migration runner: generate named migrations from IR diffs, apply them with\n * bookkeeping in `_vibe_migrations`, report status, and repair records.\n *\n * Concurrency: `applyMigrations` and `rollbackMigration` take an advisory lock\n * for the whole run — `pg_advisory_lock(1447645253)` on postgres (\"VIBE\" in\n * ASCII, blocking, released in a finally), `GET_LOCK('vibeorm_migrate', 60)`\n * on mysql (throws VIBE_MIGRATION on timeout). SQLite serializes individual\n * transactions only; callers must exclude concurrent whole-run operations.\n * Locks are session-scoped — the\n * SqlExecutor contract (types.ts) requires one session for the whole\n * operation.\n *\n * Lock ORDER matters: the lock is taken BEFORE `ensureMigrationsTable`, never\n * after. Two concurrent first-time runs against a fresh postgres database\n * would otherwise both issue `CREATE TABLE IF NOT EXISTS _vibe_migrations`,\n * which is a catalog race on postgres (a duplicate-key error on\n * `pg_type_typname_nsp_index`, not a no-op). Repair uses the same lock.\n * Status deliberately stays nonblocking and never creates the journal.\n *\n * Execution strategy per dialect (`DIALECT_CAPABILITIES[dialect]`) AND per\n * script:\n *\n * - transactionalDdl (postgres, sqlite): each migration runs inside\n * BEGIN/COMMIT with its bookkeeping INSERT — atomic.\n * - EXCEPT sqlite scripts containing a table-rebuild block, which manage their\n * own transactions (execute.ts `usesSelfManagedTransactions`) and therefore\n * cannot be wrapped. Those take the SAME per-statement bookkeeping as mysql\n * (below). They are NOT simply \"re-runnable\": a pure rebuild block is\n * effectively idempotent, but any plain statement in the same script\n * auto-commits on its own, so without a recorded statement_index a crash\n * wedged the migration forever (every later run replayed statements that had\n * already run). Resuming into a rebuild block rewinds to that block's\n * `PRAGMA foreign_keys=OFF` (execute.ts `selfManagedResumeStart`): the block\n * is transactional, so nothing of it survived, and the pragma is\n * session-scoped and gone after a crash.\n * - mysql (transactionalDdl: false — DDL auto-commits): the runner records\n * PER-STATEMENT progress instead. The row is inserted up front\n * (statement_index 0), advanced after every statement, and on failure the\n * error lands in the `error` column. Re-running RESUMES from the recorded\n * statement_index — and REFUSES if the migration's checksum changed since\n * the partial application. A row is \"complete\" when its statement_index\n * reaches the statement count (or its checksum is empty — resolveMigration\n * records, which store statement_index 2147483647).\n *\n * `usesStatementBookkeeping` is the ONE predicate deciding which of the two\n * regimes a (dialect, script) pair is in; apply, status and rollback all read\n * it, so they can never disagree about whether a record is complete.\n *\n * Checksums (sha256 over the joined SQL) pin a migration's content:\n * re-applying a renamed-or-edited migration is a VIBE_MIGRATION error, never\n * a silent divergence.\n */\n\nimport { migrationChecksum } from \"./migration-checksum.ts\";\nimport { assertModuleOwnership, assertLiveModuleOwnership, moduleNamespace } from \"./module-ownership.ts\";\nimport { assertModuleUpgradeHistory } from \"./module-history.ts\";\nimport { completeModuleJournal, ensureModuleJournal, insertModuleJournal, moduleRecordComplete, readModuleJournal } from \"./module-journal.ts\";\nimport { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR, SqlObjectIdentity, VibeExtension } from \"@vibeorm/schema\";\nimport { assertMaterializedModuleMigration } from \"./module-origin.ts\";\nimport { readJournalRows } from \"./journal-read.ts\";\nimport type { JournalRow } from \"./journal-read.ts\";\nimport { MIGRATIONS_TABLE_NAME } from \"./journal-table.ts\";\nimport {\n DIALECT_CAPABILITIES,\n getSqlDialect,\n renderMigrationSessionRead,\n renderMigrationSessionRestore,\n renderMigrationSessionSet,\n} from \"@vibeorm/sql\";\nimport { assertValidExecution, isDefaultExecution, operationFor } from \"./execution.ts\";\nimport type { MigrationExecution } from \"./execution.ts\";\nimport { establishOperationState } from \"./recovery.ts\";\nimport type { RenameIntent } from \"./renames.ts\";\nimport { diffSchemas } from \"./differ.ts\";\nimport { renderSteps } from \"./ddl/render.ts\";\nimport { assertSecurityAcknowledgement, securityChangesOf, withRlsSteps } from \"./ddl/rls.ts\";\nimport { introspectPostgres } from \"./introspect/postgres.ts\";\nimport {\n artifactCreateSql,\n collectExtensionArtifacts,\n planMissingArtifacts,\n stripExtensionArtifacts,\n} from \"./extensions.ts\";\nimport {\n assertSupportedSelfManagedScript,\n assertSelfManagedResumeSafe,\n isSelfManagedCommit,\n canCheckpointAtomically,\n cleanupSelfManagedFailure,\n executeStatement,\n selfManagedResumeStart,\n usesSelfManagedTransactions,\n} from \"./execute.ts\";\nimport type {\n AppliedResult,\n MigrationFile,\n MigrationHistoryMode,\n MigrationReplayOptions,\n MigrationStatus,\n RecordedMigration,\n RollbackResult,\n SqlExecutor,\n} from \"./types.ts\";\n\n/** Recompute authorization from the trusted declarations; omitted preview arrays cannot bypass it. */\nfunction migrationRlsSecurityChanges(params: { migration: MigrationFile; down: boolean }): string[] {\n const source = params.migration.rls;\n if (source === undefined) return [];\n return securityChangesOf({ steps: withRlsSteps({ from: params.down ? source.to : source.from, to: params.down ? source.from : source.to, steps: [] }) });\n}\n\n/** Classify operation tokens, never words inside identifiers, literals or comments. */\nfunction containsNativeRlsSql(params: { sql: string; dialect: Dialect }): boolean {\n const { sql, dialect } = params;\n const tokens: string[] = [];\n let i = 0;\n while (i < sql.length) {\n const ch = sql[i]!;\n if (/\\s/.test(ch)) { i++; continue; }\n if (sql.startsWith(\"--\", i) || (dialect === \"mysql\" && ch === \"#\")) {\n const end = sql.indexOf(\"\\n\", i);\n i = end === -1 ? sql.length : end + 1;\n continue;\n }\n if (sql.startsWith(\"/*\", i)) {\n let depth = 1;\n i += 2;\n while (i < sql.length && depth > 0) {\n if (sql.startsWith(\"/*\", i)) { depth++; i += 2; }\n else if (sql.startsWith(\"*/\", i)) { depth--; i += 2; }\n else i++;\n }\n continue;\n }\n if (ch === \"'\" || ch === '\"' || ch === \"`\" || (dialect === \"sqlite\" && ch === \"[\")) {\n const endQuote = ch === \"[\" ? \"]\" : ch;\n const backslash = dialect === \"mysql\" || (ch === \"'\" && /(?:^|[^\\w$])[eE]$/.test(sql.slice(0, i)));\n i++;\n while (i < sql.length) {\n if (backslash && sql[i] === \"\\\\\") { i += 2; continue; }\n if (sql[i] === endQuote) {\n if (sql[i + 1] === endQuote) { i += 2; continue; }\n i++;\n break;\n }\n i++;\n }\n tokens.push(\"@\"); // Keep a boundary: CREATE \"ignored\" POLICY is not CREATE POLICY.\n continue;\n }\n if (ch === \"$\") {\n const tag = /^(?:\\$\\$|\\$[A-Za-z_][A-Za-z_0-9]*\\$)/.exec(sql.slice(i))?.[0];\n if (tag !== undefined) {\n const end = sql.indexOf(tag, i + tag.length);\n i = end === -1 ? sql.length : end + tag.length;\n tokens.push(\"@\");\n continue;\n }\n }\n const word = /^[A-Za-z_][A-Za-z_0-9$]*/.exec(sql.slice(i))?.[0];\n tokens.push(word === undefined ? ch : word.toUpperCase());\n i += word?.length ?? 1;\n }\n // A MigrationFile may carry multiple SQL statements in one array entry.\n return tokens.join(\" \").split(/\\s*;\\s*/).some((statement) => {\n const operation = statement.trim();\n return /^(?:CREATE|ALTER|DROP) POLICY\\b/.test(operation)\n || /^COMMENT ON POLICY\\b/.test(operation)\n || (/^ALTER TABLE\\b/.test(operation) && /\\b(?:ENABLE|DISABLE|FORCE) ROW LEVEL SECURITY\\b/.test(operation));\n });\n}\n\n/** SQL-only native-policy files lack the trusted pre/post declarations required for drift checks. */\nfunction assertNativeMigrationMetadata(params: { migration: MigrationFile; sql: readonly string[]; dialect: Dialect }): void {\n const native = params.migration.rls !== undefined || params.sql.some((sql) => containsNativeRlsSql({ sql, dialect: params.dialect }));\n if (!native) return;\n if (!DIALECT_CAPABILITIES[params.dialect].nativeRowLevelSecurity) {\n throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: `Native RLS migrations are unsupported on ${params.dialect}`, meta: { feature: \"nativeRowLevelSecurity\", dialect: params.dialect } });\n }\n if (params.migration.rls === undefined) {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Native RLS migration files require trusted rls.from/rls.to schema metadata. SQL alone cannot prove policy ownership or drift; regenerate with preserved security metadata.\", meta: { reason: \"rls-migration-metadata-required\", migration: params.migration.name } });\n }\n}\n\n// ─── Bookkeeping table ────────────────────────────────────────────\n\nexport { MIGRATIONS_TABLE_NAME } from \"./journal-table.ts\";\n\n/** Advisory-lock key for postgres — \"VIBE\" as a big-endian ASCII int32. */\nconst PG_ADVISORY_LOCK_KEY = 1447645253;\nconst MYSQL_LOCK_NAME = \"vibeorm_migrate\";\nconst MYSQL_LOCK_TIMEOUT_SECONDS = 60;\n\n/** statement_index recorded by resolveMigration — \"complete, content unseen\". */\nconst RESOLVED_STATEMENT_INDEX = 2147483647;\n\nconst CREATE_TABLE_SQL: Readonly<Record<Dialect, string>> = {\n postgres: `CREATE TABLE IF NOT EXISTS \"${MIGRATIONS_TABLE_NAME}\" (\n \"id\" integer GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,\n \"name\" text NOT NULL UNIQUE,\n \"checksum\" text NOT NULL,\n \"applied_at\" timestamptz(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,\n \"statement_index\" integer NOT NULL DEFAULT 0,\n \"error\" text\n);`,\n sqlite: `CREATE TABLE IF NOT EXISTS \"${MIGRATIONS_TABLE_NAME}\" (\n \"id\" INTEGER PRIMARY KEY AUTOINCREMENT,\n \"name\" TEXT NOT NULL UNIQUE,\n \"checksum\" TEXT NOT NULL,\n \"applied_at\" TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,\n \"statement_index\" INTEGER NOT NULL DEFAULT 0,\n \"error\" TEXT\n);`,\n mysql: `CREATE TABLE IF NOT EXISTS \\`${MIGRATIONS_TABLE_NAME}\\` (\n \\`id\\` int NOT NULL AUTO_INCREMENT,\n \\`name\\` varchar(191) NOT NULL UNIQUE,\n \\`checksum\\` text NOT NULL,\n \\`applied_at\\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),\n \\`statement_index\\` int NOT NULL DEFAULT 0,\n \\`error\\` text,\n PRIMARY KEY (\\`id\\`)\n);`,\n};\n\n/** Create the bookkeeping table when missing. */\nexport async function ensureMigrationsTable(params: {\n executor: SqlExecutor;\n dialect?: Dialect;\n}): Promise<void> {\n await params.executor({ text: CREATE_TABLE_SQL[params.dialect ?? \"postgres\"] });\n}\n\n/**\n * sha256 hex over the migration's statements — its identity across runs.\n *\n * A NON-default execution block (execution.ts) folds a canonical description\n * of itself in, so changing how a migration executes after it was applied is\n * caught by the same checksum refusal that catches changing its SQL. A default\n * or absent block contributes NOTHING, which is what keeps every migration\n * written before this feature — and every journal row recording one — valid.\n */\nexport { migrationChecksum } from \"./migration-checksum.ts\";\n\n/** The migration's own checksum, execution block included. */\nfunction checksumOf(params: { migration: MigrationFile }): string {\n const { migration } = params;\n return migrationChecksum(migration);\n}\n\nimport { createDesiredState, assertDesiredState } from \"./desired-state.ts\";\nimport { migrationNamespace, verifyMigrationState, verifyMigrationTransition, verifySqliteTransitionBeforeRestore, assertMigrationState, assertProbeMode } from \"./inspect-objects.ts\";\nimport { assertNamedRemovals, assertRemovalAuthorization, preserveMigrationObjects, sqlitePreservedSchema, orderedMigrationObjects, assertRetainedMigrationObjects } from \"./object-ownership.ts\";\nimport type { MigrationDesiredState } from \"./desired-state.ts\";\n\n/** Re-apply may start at the checksum-bound actual down target after an irreversible rollback. */\nasync function assertForwardStart(params: { executor: SqlExecutor; dialect: Dialect; migration: MigrationFile; probe?: \"none\" | \"rollback\" | \"temporary\" }): Promise<void> {\n const state = params.migration.desiredState;\n if (state === undefined) return;\n const report = await verifyMigrationState({ executor: params.executor, dialect: params.dialect, expected: state.from, ...(params.probe === undefined ? {} : { probe: params.probe }) });\n if (report.inSync) return;\n if (state.down !== undefined) {\n const restored = await verifyMigrationState({ executor: params.executor, dialect: params.dialect, expected: state.down, ...(params.probe === undefined ? {} : { probe: params.probe }) });\n if (restored.inSync) return;\n }\n assertMigrationState({ report });\n}\n\n// ─── Generate ─────────────────────────────────────────────────────\n\n/**\n * Diff two IRs and render a named migration for a dialect (postgres if\n * omitted). `destructive` aggregates the steps' flags so callers can gate\n * confirmation before applying.\n */\nexport function generateMigration(params: {\n from: SchemaIR;\n to: SchemaIR;\n name: string;\n /** Rendering dialect; postgres if omitted. */\n dialect?: Dialect;\n /** Configured extension instances — their artifacts land in the migration. */\n extensions?: readonly VibeExtension[];\n /** Explicit physical renames (renames.ts); never inferred from the diff. */\n renames?: readonly RenameIntent[];\n /** Explicit execution semantics for the generated file. */\n execution?: MigrationExecution;\n /** Independent authored baseline; required by live generation on an existing database. */\n desiredState?: MigrationDesiredState;\n}): MigrationFile {\n const { from, to, name } = params;\n const dialect = params.dialect ?? \"postgres\";\n\n const artifacts = collectExtensionArtifacts({\n schema: to,\n dialect,\n extensions: params.extensions ?? [],\n });\n const allArtifacts = [...artifacts.setup, ...artifacts.objects];\n assertRetainedMigrationObjects({ from: from.migrationObjects ?? [], to: to.migrationObjects ?? [] });\n const strippedFrom = preserveMigrationObjects({ from: stripExtensionArtifacts({ schema: from, artifacts: allArtifacts }), to, objects: [...(from.migrationObjects ?? []), ...(to.migrationObjects ?? [])] });\n\n const steps = diffSchemas({ from: strippedFrom, to, dialect, ...(params.renames === undefined ? {} : { renames: params.renames }) });\n const coreSql = renderSteps({ steps, dialect, from: dialect === \"sqlite\" ? from : strippedFrom, to: dialect === \"sqlite\" ? sqlitePreservedSchema({ from, to, objects: [...(from.migrationObjects ?? []), ...(to.migrationObjects ?? [])] }) : to });\n const missing = planMissingArtifacts({ introspected: from, artifacts: allArtifacts });\n const sql = [\n ...artifactCreateSql({\n artifacts: missing.filter((artifact) => artifact.owns.kind === \"postgresExtension\"),\n }),\n ...coreSql,\n ...artifactCreateSql({\n artifacts: missing.filter((artifact) => artifact.owns.kind !== \"postgresExtension\"),\n }),\n ...orderedMigrationObjects({ objects: to.migrationObjects ?? [] }).flatMap((object) => {\n if (object.dialect !== dialect) throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: `Migration object ${object.id} requires ${object.dialect}` });\n const previous = (params.desiredState?.from.schema.migrationObjects ?? from.migrationObjects)?.find((entry) => entry.id === object.id);\n if (previous === undefined) return [...object.create];\n if (JSON.stringify(previous) !== JSON.stringify(object)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Migration-owned object ${object.id} changed; supply a reviewed forward SQL migration`, meta: { reason: \"migration-object-replacement-required\", id: object.id } });\n return [];\n }),\n ];\n return {\n name,\n sql,\n destructive: steps.some((step) => step.destructive),\n ...(securityChangesOf({ steps }).length === 0 ? {} : { securityChanges: securityChangesOf({ steps }) }),\n ...(from.rls === undefined && to.rls === undefined ? {} : { rls: { from, to } }),\n ...(params.execution === undefined ? {} : { execution: params.execution }),\n desiredState: params.desiredState ?? { version: 1, dialect, from: createDesiredState({ schema: from, dialect }), to: createDesiredState({ schema: to, dialect }) },\n };\n}\n\n// ─── Apply ────────────────────────────────────────────────────────\n\n/** Validate replay declarations and approvals without reading or writing a database. */\nexport function validateMigrationReplay(params: MigrationReplayOptions): void {\n const dialect = params.dialect ?? \"postgres\";\n assertProbeMode({ dialect, probe: params.probe });\n assertDistinctMigrationNames({ migrations: params.migrations });\n for (const migration of params.migrations) {\n assertMigrationMetadata({ migration, dialect });\n if (dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: migration.sql })) assertSupportedSelfManagedScript({ sql: migration.sql, migration: migration.name, direction: \"up\" });\n assertNamedRemovals({ removals: migration.desiredState?.unmanagedRemovals ?? [], approved: params.removeUnmanaged, acceptIntegrityLoss: params.acceptIntegrityLoss });\n if (migration.desiredState !== undefined) {\n const state = migration.desiredState;\n assertRemovalAuthorization({ steps: diffSchemas({ from: state.from.schema, to: state.to.schema, dialect }), previous: state.from, dialect, namespace: dialect === \"sqlite\" ? \"main\" : \"public\", ...(params.acceptIntegrityLoss === undefined ? {} : { acceptIntegrityLoss: params.acceptIntegrityLoss }) });\n }\n assertSecurityAcknowledgement({ securityChanges: [...(migration.securityChanges ?? []), ...migrationRlsSecurityChanges({ migration, down: false })], ...(params.acceptSecurityChanges === undefined ? {} : { acceptSecurityChanges: params.acceptSecurityChanges }) });\n }\n}\n\nfunction assertMigrationMetadata(params: { migration: MigrationFile; dialect: Dialect }): void {\n const { migration, dialect } = params;\n if (migration.moduleOrigin !== undefined) {\n assertMaterializedModuleMigration({ migration });\n assertModuleOwnership({ origin: migration.moduleOrigin, desiredState: migration.desiredState });\n }\n if (migration.desiredStatePending === true) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Migration ${migration.name} has unfinalized desired state; finalize its reviewed before/after declarations before applying`, meta: { reason: \"desired-state-unfinalized\", migration: migration.name } });\n if (migration.desiredState !== undefined) {\n assertDesiredState({ value: migration.desiredState, migration: migration.name });\n if (migration.desiredState.dialect !== dialect) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Migration desired-state dialect mismatch\", meta: { reason: \"desired-state-dialect-mismatch\", migration: migration.name } });\n }\n assertNativeMigrationMetadata({ migration, sql: migration.sql, dialect });\n assertExecutable({ migration, execution: migration.execution, sql: migration.sql, dialect });\n}\n\n/**\n * Apply under the migration lock after preflight, preserving recorded progress.\n * Complete mode requires a full ordered chain; subset mode remains the default.\n * Empty-checksum resolve records deliberately skip content verification.\n */\nexport async function applyMigrations(params: {\n executor: SqlExecutor;\n migrations: readonly MigrationFile[];\n /** Complete requires the recorded journal to be a prefix of this ordered chain. */\n history?: MigrationHistoryMode;\n acceptSecurityChanges?: boolean;\n acceptIntegrityLoss?: boolean;\n removeUnmanaged?: readonly SqlObjectIdentity[];\n /** Explicit permission for rollback-only PostgreSQL CHECK normalization probes. */\n probe?: \"none\" | \"rollback\" | \"temporary\";\n /** Execution dialect; postgres if omitted. */\n dialect?: Dialect;\n}): Promise<AppliedResult> {\n const { executor, migrations } = params;\n const dialect = params.dialect ?? \"postgres\";\n if (params.history !== undefined && params.history !== \"complete\" && params.history !== \"subset\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Unknown migration history validation mode\", meta: { reason: \"history-mode-invalid\" } });\n if (params.history === \"complete\") assertDistinctMigrationNames({ migrations });\n for (const migration of migrations) assertMigrationMetadata({ migration, dialect });\n if (executor.withSession !== undefined) {\n return executor.withSession({ run: (session) => applyMigrations({ ...params, executor: session }) });\n }\n\n // Lock FIRST, bookkeeping table second (module doc): concurrent first-time\n // runs racing on CREATE TABLE IF NOT EXISTS is a postgres catalog error, not\n // a no-op. The creation sits inside the try so a failure still unlocks.\n await acquireLock({ executor, dialect });\n\n try {\n const moduleRecords = migrations.some((migration) => migration.moduleOrigin !== undefined) ? await readModuleJournal({ executor, dialect }) : undefined;\n const recorded = moduleRecords === undefined ? await recordedRows({ executor, dialect }) : new Map([...moduleRecords].map(([name, record]) => [name, record.row]));\n if (moduleRecords !== undefined) {\n assertModuleUpgradeHistory({ migrations, records: moduleRecords });\n const namespace = await migrationNamespace({ executor, dialect });\n if (migrations.some((migration) => migration.moduleOrigin !== undefined && moduleNamespace({ origin: migration.moduleOrigin }) !== namespace)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Module placement differs from the active database namespace\", meta: { reason: \"module-placement-mismatch\" } });\n }\n if (params.history === \"complete\") assertCompleteHistory({ migrations, recorded, dialect });\n await assertApplyHistory({ executor, dialect, migrations, recorded });\n const pending = migrations.filter((migration) => {\n const stored = recorded.get(migration.name);\n return stored === undefined || !isCompleteRecord({ dialect, migration, stored });\n });\n validateMigrationReplay({ ...params, migrations: pending, dialect });\n await ensureMigrationsTable({ executor, dialect });\n if (moduleRecords !== undefined) await ensureModuleJournal({ executor, dialect });\n\n const applied: string[] = [];\n const skipped: string[] = [];\n\n for (const migration of migrations) {\n const stored = recorded.get(migration.name);\n if (migration.moduleOrigin !== undefined && (stored === undefined || !isCompleteRecord({ dialect, migration, stored }))) await assertLiveModuleOwnership({ executor, origin: migration.moduleOrigin, resume: stored !== undefined });\n if (stored !== undefined) {\n // Negative statement_index = a mysql rollback started but did not\n // finish (see rollbackMigration). Applying over it would corrupt both\n // directions — finish or repair first.\n if (stored.statementIndex < 0) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `migration \"${migration.name}\" is mid-rollback (${-stored.statementIndex - 1} down statement(s) done) — finish it with \\`migrate down\\` or repair with resolveMigration before applying`,\n meta: { migration: migration.name, statementIndex: stored.statementIndex },\n });\n }\n if (isCompleteRecord({ dialect, migration, stored })) {\n assertChecksumMatches({ migration, stored: stored.checksum });\n skipped.push(migration.name);\n continue;\n }\n // Partial row (mysql, a self-managed sqlite script, or a declared\n // nontransactional migration) → resume, but only for unchanged content.\n assertResumable({ migration, stored });\n await withSessionLimits({\n executor,\n dialect,\n ...(migration.execution === undefined ? {} : { execution: migration.execution }),\n run: () => runNonTransactional({\n executor,\n dialect,\n migration,\n start: stored.statementIndex,\n ...(params.probe === undefined ? {} : { probe: params.probe }),\n insertRecord: false,\n ...(stored.error === undefined ? {} : { storedError: stored.error }),\n }),\n });\n applied.push(migration.name);\n continue;\n }\n\n if (usesStatementBookkeeping({ dialect, sql: migration.sql, ...(migration.execution === undefined ? {} : { execution: migration.execution }) })) {\n await withSessionLimits({\n executor,\n dialect,\n ...(migration.execution === undefined ? {} : { execution: migration.execution }),\n run: () => runNonTransactional({ executor, dialect, migration, start: 0, insertRecord: true, ...(params.probe === undefined ? {} : { probe: params.probe }) }),\n });\n } else {\n await runTransactional({ executor, dialect, migration, ...(params.probe === undefined ? {} : { probe: params.probe }) });\n }\n applied.push(migration.name);\n }\n\n // Verify only the final deployed declaration, never intermediate historical targets.\n const final = migrations.at(-1);\n if (final?.desiredState !== undefined) {\n if (params.probe === \"rollback\") await executor({ text: \"BEGIN\" });\n try {\n assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: final.desiredState.from, to: final.desiredState.to, removals: final.desiredState.unmanagedRemovals, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n } finally {\n if (params.probe === \"rollback\") await executor({ text: \"ROLLBACK\" });\n }\n }\n return { applied, skipped };\n } finally {\n await releaseLock({ executor, dialect });\n }\n}\n\n// ─── Status ───────────────────────────────────────────────────────\n\n/** Compare known migrations against the bookkeeping table. */\nexport async function migrationStatus(params: {\n executor: SqlExecutor;\n migrations: readonly MigrationFile[];\n /** Bookkeeping dialect; postgres if omitted. */\n dialect?: Dialect;\n /** Trusted current deployment; policy state is verified independently of migration records. */\n schema?: SchemaIR;\n}): Promise<MigrationStatus> {\n const { executor, migrations } = params;\n const dialect = params.dialect ?? \"postgres\";\n // No lock or journal creation: status stays nonblocking and read-only.\n const recorded = await recordedRows({ executor, dialect, modules: migrations.some((migration) => migration.moduleOrigin !== undefined) });\n\n const applied: string[] = [];\n const pending: string[] = [];\n const mismatched: string[] = [];\n const rollingBack: string[] = [];\n const known = new Set(migrations.map((migration) => migration.name));\n const unknownFiles: string[] = [];\n for (const [name, stored] of recorded) {\n if (!known.has(name)) {\n unknownFiles.push(name);\n if (stored.statementIndex < 0) rollingBack.push(name);\n }\n }\n\n for (const migration of migrations) {\n const stored = recorded.get(migration.name);\n if (stored === undefined) {\n pending.push(migration.name);\n continue;\n }\n if (stored.statementIndex < 0) {\n rollingBack.push(migration.name);\n continue;\n }\n if (stored.checksum === \"\" && stored.error === undefined) {\n applied.push(migration.name);\n continue;\n }\n if (stored.checksum !== \"\" && stored.checksum !== checksumOf({ migration })) {\n mismatched.push(migration.name);\n continue;\n }\n // A partial row re-applies (resumes) — report it as pending. The SAME\n // predicate apply uses: reporting a partial self-managed sqlite record as\n // \"applied\" while apply would resume it is a lie about the database.\n if (isCompleteRecord({ dialect, migration, stored }) && stored.error === undefined) applied.push(migration.name);\n else pending.push(migration.name);\n }\n\n if (dialect === \"postgres\") {\n const expected = params.schema ?? [...migrations].reverse().find((migration) => applied.includes(migration.name) && migration.rls !== undefined)?.rls?.to;\n await introspectPostgres({ executor, ...(expected === undefined ? {} : { rlsSchema: expected }), requireInstalledRls: true });\n }\n return { applied, pending, mismatched, rollingBack, ...(unknownFiles.length === 0 ? {} : { unknownFiles }) };\n}\n\n/**\n * The bookkeeping journal itself, in the order rows were written — i.e. the\n * order migrations were actually applied, which is what a rollback must walk\n * backwards. Every row is returned with its checksum, cursor and classification;\n * mismatched, partial and fileless rows still occupy their position in history.\n *\n * Takes no lock, exactly like `migrationStatus`.\n */\nexport async function recordedMigrations(params: {\n executor: SqlExecutor;\n /** Known migration files — classification needs their SQL. */\n migrations: readonly MigrationFile[];\n /** Bookkeeping dialect; postgres if omitted. */\n dialect?: Dialect;\n}): Promise<RecordedMigration[]> {\n const { executor, migrations } = params;\n const dialect = params.dialect ?? \"postgres\";\n const recorded = await recordedRows({ executor, dialect, modules: migrations.some((migration) => migration.moduleOrigin !== undefined) });\n return classifyJournal({ dialect, migrations, recorded });\n}\n\n/** Shared journal classification; history imports this, never the reverse. */\nexport function classifyJournal(params: { dialect: Dialect; migrations: readonly MigrationFile[]; recorded: ReadonlyMap<string, JournalRow> }): RecordedMigration[] {\n const { dialect, migrations, recorded } = params;\n const byName = new Map(migrations.map((migration) => [migration.name, migration]));\n\n const journal: RecordedMigration[] = [];\n for (const [name, stored] of recorded) {\n const migration = byName.get(name);\n journal.push({\n name,\n checksum: stored.checksum,\n statementIndex: stored.statementIndex,\n state:\n migration === undefined\n ? \"unknown-file\"\n : stored.checksum !== \"\" && stored.checksum !== checksumOf({ migration })\n ? \"mismatched\"\n : stored.statementIndex < 0\n ? \"rolling-back\"\n : isCompleteRecord({ dialect, migration, stored }) && stored.error === undefined\n ? \"applied\"\n : \"partial\",\n });\n }\n return journal;\n}\n\n// ─── Resolve (repair) ─────────────────────────────────────────────\n\n/**\n * Repair the bookkeeping table without running SQL: mark a migration as\n * `\"applied\"` (upsert its record; pass `checksum` to also pin its content —\n * omitted, the record stores an empty checksum and later runs skip\n * verification for it) or `\"rolled-back\"` (delete its record).\n */\nexport async function resolveMigration(params: {\n executor: SqlExecutor;\n name: string;\n as: \"applied\" | \"rolled-back\";\n checksum?: string;\n /** Bookkeeping dialect; postgres if omitted. */\n dialect?: Dialect;\n}): Promise<void> {\n if (params.executor.withSession !== undefined) {\n return params.executor.withSession({ run: (executor) => resolveMigration({ ...params, executor }) });\n }\n const { executor } = params;\n const dialect = params.dialect ?? \"postgres\";\n await acquireLock({ executor, dialect });\n await repairMigration({ ...params, executor, dialect }).finally(() => releaseLock({ executor, dialect }));\n}\n\nasync function repairMigration(params: {\n executor: SqlExecutor;\n name: string;\n as: \"applied\" | \"rolled-back\";\n checksum?: string;\n dialect: Dialect;\n}): Promise<void> {\n const { executor, name, dialect } = params;\n const moduleRecord = (await readModuleJournal({ executor, dialect })).get(name);\n if (moduleRecord?.entry !== undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Module history cannot be marked applied or deleted without verified module recovery\", meta: { reason: \"module-resolution-required\", moduleId: moduleRecord.entry.migration.moduleOrigin!.moduleId } });\n await ensureMigrationsTable({ executor, dialect });\n\n if (params.as === \"applied\") {\n const insert = `INSERT INTO ${q(dialect, MIGRATIONS_TABLE_NAME)} (${q(dialect, \"name\")}, ${q(dialect, \"checksum\")}, ${q(dialect, \"statement_index\")}) VALUES (${ph(dialect, 1)}, ${ph(dialect, 2)}, ${RESOLVED_STATEMENT_INDEX})`;\n // `error` is cleared on every dialect. That column also carries the\n // in-flight marker, and a repaired record still reading \"VIBE_INFLIGHT:2\"\n // would show a migration recorded as applied as though it were stuck\n // mid-statement.\n const upsert =\n dialect === \"mysql\"\n ? `${insert} ON DUPLICATE KEY UPDATE \\`checksum\\` = VALUES(\\`checksum\\`), \\`statement_index\\` = VALUES(\\`statement_index\\`), \\`error\\` = NULL`\n : `${insert} ON CONFLICT (\"name\") DO UPDATE SET \"checksum\" = EXCLUDED.\"checksum\", \"statement_index\" = EXCLUDED.\"statement_index\", \"error\" = NULL`;\n await executor({ text: upsert, values: [name, params.checksum ?? \"\"] });\n return;\n }\n await executor({\n text: `DELETE FROM ${q(dialect, MIGRATIONS_TABLE_NAME)} WHERE ${q(dialect, \"name\")} = ${ph(dialect, 1)}`,\n values: [name],\n });\n}\n\n// ─── Rollback ─────────────────────────────────────────────────────\n\n/**\n * Roll back ONE applied migration by executing its `downSql` and deleting its\n * bookkeeping row, under the same advisory lock as `applyMigrations`.\n *\n * Guards, in order: the migration must carry `downSql` (older migrations\n * predate down-migration support), must be recorded as applied, and — when\n * the record pins a checksum — its up SQL must still match (rolling back with\n * drifted files would run a down that no longer mirrors what was applied).\n *\n * Dialect behavior mirrors apply exactly (same `usesStatementBookkeeping`\n * predicate, read over the DOWN script): postgres/sqlite run the down inside\n * BEGIN/COMMIT with the bookkeeping DELETE (atomic). mysql DDL auto-commits,\n * and a sqlite down containing a table-rebuild block cannot be wrapped, so\n * both record progress per-statement in the existing `statement_index`\n * column, NEGATIVE to mark the rollback direction: after k down statements,\n * the row stores -(k+1). A failed rollback resumes from the recorded\n * statement on the next call; `applyMigrations` refuses a mid-rollback record\n * (that check reads the sign only, so it holds for every dialect). A\n * partially APPLIED migration cannot be rolled back — its down mirrors the\n * full up; finish applying (apply resumes) or repair with `resolveMigration`.\n */\ntype RollbackOptions = {\n executor: SqlExecutor;\n acceptSecurityChanges?: boolean;\n acceptIntegrityLoss?: boolean;\n probe?: \"none\" | \"rollback\" | \"temporary\";\n dialect?: Dialect;\n};\n\n/** Reverse one file only if it is still newest when the lock is acquired. */\nexport async function rollbackMigration(params: RollbackOptions & { migration: MigrationFile }): Promise<void> {\n const { executor, migration } = params;\n const dialect = params.dialect ?? \"postgres\";\n const downSql = validateRollbackFile({ ...params, dialect });\n if (executor.withSession !== undefined) {\n return executor.withSession({ run: (session) => rollbackMigration({ ...params, executor: session }) });\n }\n await acquireLock({ executor, dialect });\n await Promise.resolve().then(async () => {\n const recorded = await recordedRows({ executor, dialect, modules: migration.moduleOrigin !== undefined });\n const stored = assertRollbackRecord({ migration, stored: recorded.get(migration.name), dialect });\n const newest = [...recorded.keys()].at(-1);\n if (newest !== migration.name) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Migration \"${migration.name}\" is not the newest recorded migration; select rollback again`, meta: { reason: \"rollback-not-latest\", migration: migration.name, newest } });\n await validateRollbackRecovery({ executor, migration, downSql, stored, dialect });\n await executeRollback({ ...params, dialect, downSql, stored });\n }).finally(() => releaseLock({ executor, dialect }));\n}\n\n/**\n * Select from the current journal under one lock. With to, retain that applied\n * migration and reverse every newer row; without it, reverse only the newest.\n * All selected declarations/approvals/progress are checked before any reversal.\n * A later SQL failure can still leave a successfully reversed prefix on disk.\n * SQLite cross-connection ownership remains the caller's responsibility.\n */\nexport async function rollbackMigrations(params: RollbackOptions & {\n migrations: readonly MigrationFile[];\n to?: string;\n}): Promise<RollbackResult> {\n const { executor, migrations } = params;\n const dialect = params.dialect ?? \"postgres\";\n assertDistinctMigrationNames({ migrations });\n if (executor.withSession !== undefined) {\n return executor.withSession({ run: (session) => rollbackMigrations({ ...params, executor: session }) });\n }\n await acquireLock({ executor, dialect });\n return Promise.resolve().then(async (): Promise<RollbackResult> => {\n const recorded = await recordedRows({ executor, dialect, modules: migrations.some((migration) => migration.moduleOrigin !== undefined) });\n const journal = classifyJournal({ migrations, recorded, dialect });\n const byName = new Map(migrations.map((migration) => [migration.name, migration]));\n let start = Math.max(0, journal.length - 1);\n if (params.to !== undefined) {\n const target = journal.findIndex((row) => row.name === params.to);\n const row = journal[target];\n if (row?.state !== \"applied\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Rollback target \"${params.to}\" is not a known applied migration`, meta: { reason: \"rollback-target-invalid\", to: params.to, state: row?.state } });\n assertMigrationMetadata({ migration: byName.get(row.name)!, dialect });\n start = target + 1;\n }\n const plan: { migration: MigrationFile; downSql: readonly string[]; stored: RecordedRow }[] = [];\n for (const row of journal.slice(start).reverse()) {\n const migration = byName.get(row.name);\n if (migration === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Cannot roll back \"${row.name}\" without its migration file`, meta: { reason: \"rollback-file-missing\", migration: row.name } });\n const stored = assertRollbackRecord({ migration, stored: recorded.get(row.name), dialect });\n const downSql = validateRollbackFile({ ...params, migration, dialect });\n plan.push({ migration, downSql, stored });\n }\n for (const entry of plan) await validateRollbackRecovery({ executor, dialect, ...entry });\n const rolledBack: string[] = [];\n for (const entry of plan) {\n await executeRollback({ ...params, dialect, ...entry });\n rolledBack.push(entry.migration.name);\n }\n return { rolledBack };\n }).finally(() => releaseLock({ executor, dialect }));\n}\n\nfunction validateRollbackFile(params: RollbackOptions & { migration: MigrationFile; dialect: Dialect }): readonly string[] {\n const { migration, dialect } = params;\n if (migration.desiredStatePending === true) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Unfinalized desired state cannot be rolled back\", meta: { reason: \"desired-state-unfinalized\", migration: migration.name } });\n if (migration.moduleOrigin !== undefined) {\n assertMaterializedModuleMigration({ migration });\n assertModuleOwnership({ origin: migration.moduleOrigin, desiredState: migration.desiredState });\n }\n const downSql = migration.downSql;\n if (downSql === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `migration \"${migration.name}\" has no down.sql; roll it back manually, then repair with resolveMigration (as: \"rolled-back\")`, meta: { reason: \"rollback-down-missing\", migration: migration.name } });\n assertProbeMode({ dialect, probe: params.probe });\n if (migration.desiredState !== undefined) {\n assertDesiredState({ value: migration.desiredState, migration: migration.name });\n if (migration.desiredState.dialect !== dialect) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Migration desired-state dialect mismatch\", meta: { reason: \"desired-state-dialect-mismatch\" } });\n assertRemovalAuthorization({ steps: diffSchemas({ from: migration.desiredState.to.schema, to: (migration.desiredState.down ?? migration.desiredState.from).schema, dialect }), previous: migration.desiredState.to, dialect, namespace: dialect === \"sqlite\" ? \"main\" : \"public\", ...(params.acceptIntegrityLoss === undefined ? {} : { acceptIntegrityLoss: params.acceptIntegrityLoss }) });\n }\n assertNativeMigrationMetadata({ migration, sql: downSql, dialect });\n assertExecutable({ migration, execution: migration.downExecution, sql: downSql, dialect });\n assertSecurityAcknowledgement({ securityChanges: [...(migration.downSecurityChanges ?? []), ...migrationRlsSecurityChanges({ migration, down: true })], ...(params.acceptSecurityChanges === undefined ? {} : { acceptSecurityChanges: params.acceptSecurityChanges }) });\n if (dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: downSql })) assertSupportedSelfManagedScript({ sql: downSql, migration: migration.name, direction: \"down\" });\n return downSql;\n}\n\nfunction assertRollbackRecord(params: { migration: MigrationFile; stored?: RecordedRow; dialect: Dialect }): RecordedRow {\n const { migration, stored, dialect } = params;\n if (stored === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `migration \"${migration.name}\" is not recorded as applied; nothing to roll back`, meta: { migration: migration.name } });\n assertChecksumMatches({ migration, stored: stored.checksum });\n if (stored.statementIndex >= 0 && (!isCompleteRecord({ dialect, migration, stored }) || stored.error !== undefined)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `migration \"${migration.name}\" is only partially applied or has an unresolved error; its down mirrors the FULL up. Finish or repair with resolveMigration`, meta: { reason: \"rollback-partial-up\", migration: migration.name, statementIndex: stored.statementIndex } });\n return stored;\n}\n\nasync function validateRollbackRecovery(params: { executor: SqlExecutor; dialect: Dialect; migration: MigrationFile; downSql: readonly string[]; stored: RecordedRow }): Promise<void> {\n const { executor, dialect, migration, downSql, stored } = params;\n if (stored.statementIndex >= 0) return;\n const start = -stored.statementIndex - 1;\n if (start > downSql.length) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Rollback progress exceeds its statement count\", meta: { reason: \"rollback-progress-invalid\", migration: migration.name } });\n if (dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: downSql })) assertSelfManagedResumeSafe({ sql: downSql, start, migration: migration.name, direction: \"down\" });\n if (!marksInflight({ dialect, execution: migration.downExecution }) || start >= downSql.length) return;\n const operation = migration.downExecution?.transaction === \"none\" ? operationFor({ execution: migration.downExecution, statement: start }) : undefined;\n if (operation !== undefined) await establishOperationState({ executor, dialect, operation });\n else if (inflightStatement({ error: stored.error }) === start) throw uncertainStatement({ migration: migration.name, statements: downSql, index: start, dialect, direction: \"down\" });\n}\n\nasync function executeRollback(params: RollbackOptions & { migration: MigrationFile; dialect: Dialect; downSql: readonly string[]; stored: RecordedRow }): Promise<void> {\n const { executor, dialect, migration, downSql, stored } = params;\n if (usesStatementBookkeeping({ dialect, sql: downSql, ...(migration.downExecution === undefined ? {} : { execution: migration.downExecution }) })) {\n const start = stored.statementIndex < 0 ? -stored.statementIndex - 1 : 0;\n await withSessionLimits({\n executor, dialect, execution: migration.downExecution,\n run: () => runNonTransactionalDown({ executor, dialect, migration, downSql, start, probe: params.probe, storedError: stored.error }),\n });\n } else await runTransactionalDown({ executor, dialect, migration, downSql, probe: params.probe });\n}\n\n/** Atomic down path (postgres, sqlite): statements + record DELETE in one tx. */\nasync function runTransactionalDown(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n migration: MigrationFile;\n downSql: readonly string[];\n probe?: \"none\" | \"rollback\" | \"temporary\";\n}): Promise<void> {\n const { executor, dialect, migration, downSql } = params;\n const selfManaged = dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: downSql });\n const wrap = !selfManaged;\n\n if (wrap) await executor({ text: \"BEGIN\" });\n try {\n const limits = migration.downExecution;\n if (wrap && dialect === \"postgres\" && limits !== undefined) {\n if ((limits.lockTimeoutMs ?? 0) > 0) await executor({ text: renderMigrationSessionSet({ dialect: getSqlDialect({ dialect }), setting: \"lock_timeout\", milliseconds: limits.lockTimeoutMs as number, local: true }).text });\n if ((limits.statementTimeoutMs ?? 0) > 0) await executor({ text: renderMigrationSessionSet({ dialect: getSqlDialect({ dialect }), setting: \"statement_timeout\", milliseconds: limits.statementTimeoutMs as number, local: true }).text });\n }\n if (migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: migration.desiredState.from, to: migration.desiredState.to, removals: migration.desiredState.unmanagedRemovals, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n if (migration.rls !== undefined) await introspectPostgres({ executor, rlsSchema: migration.rls.to, inTransaction: true, requireInstalledRls: true });\n for (const statement of downSql) {\n await executeStatement({ executor, statement, dialect });\n }\n if (migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: migration.desiredState.to, to: migration.desiredState.down ?? migration.desiredState.from, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n if (migration.rls !== undefined) await introspectPostgres({ executor, rlsSchema: migration.rls.from, inTransaction: true, requireInstalledRls: true });\n await executor({\n text: `DELETE FROM ${q(dialect, MIGRATIONS_TABLE_NAME)} WHERE ${q(dialect, \"name\")} = ${ph(dialect, 1)}`,\n values: [migration.name],\n });\n if (wrap) await executor({ text: \"COMMIT\" });\n } catch (error) {\n if (wrap) {\n try {\n await executor({ text: \"ROLLBACK\" });\n } catch {\n // Rollback is best-effort; the original failure matters more.\n }\n } else {\n await cleanupSelfManagedFailure({ executor });\n }\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `rollback of \"${migration.name}\" failed: ${error instanceof Error ? error.message : String(error)}`,\n meta: { migration: migration.name, ...timeoutDiagnostic({ error }) },\n cause: error,\n });\n }\n}\n\n/**\n * Per-statement down path (mysql, and self-managed sqlite down scripts):\n * progress in `statement_index`, stored NEGATIVE (-(completed + 1)) so\n * apply/status can tell the direction apart.\n */\nasync function runNonTransactionalDown(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n migration: MigrationFile;\n downSql: readonly string[];\n start: number;\n /** The journal row's `error` text when resuming — may hold an in-flight marker. */\n storedError?: string;\n probe?: \"none\" | \"rollback\" | \"temporary\";\n}): Promise<void> {\n const { executor, dialect, migration, downSql } = params;\n const table = q(dialect, MIGRATIONS_TABLE_NAME);\n const selfManagedDown = dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: downSql });\n // Same rule, same moment, in the down direction (see the up path above).\n if (selfManagedDown) {\n assertSupportedSelfManagedScript({ sql: downSql, migration: migration.name, direction: \"down\" });\n assertSelfManagedResumeSafe({ sql: downSql, start: params.start, migration: migration.name, direction: \"down\" });\n }\n const execution = migration.downExecution;\n const declared = execution?.transaction === \"none\";\n // Identical regime to the up direction: mysql always has the window, postgres\n // only when declared, sqlite closes it with a per-statement transaction.\n const marks = marksInflight({ dialect, ...(execution === undefined ? {} : { execution }) });\n const selfManaged = selfManagedDown;\n // A recorded index can point INSIDE a rebuild block, one past its\n // session-scoped pragma — rewind to the block's start (see execute.ts).\n const start = selfManaged\n ? selfManagedResumeStart({ sql: downSql, start: params.start })\n : params.start;\n\n const recordProgress = async (completed: number): Promise<void> => {\n await executor({\n text: `UPDATE ${table} SET ${q(dialect, \"statement_index\")} = ${ph(dialect, 1)}, ${q(dialect, \"error\")} = NULL WHERE ${q(dialect, \"name\")} = ${ph(dialect, 2)}`,\n values: [-(completed + 1), migration.name],\n });\n };\n\n // Same resume contract as the up direction: a down statement whose effect\n // cannot be established is never replayed automatically.\n const resumeOperation = marks && declared && start < downSql.length\n ? operationFor({ ...(execution === undefined ? {} : { execution }), statement: start })\n : undefined;\n\n // This refusal is checked BEFORE the \"rollback started\" write below, and the\n // order is the whole point: that write sets `error` to NULL and would take\n // the in-flight marker with it. A refusal thrown after it is SPENT — the\n // operator's next `migrate down` reads a clean row, finds nothing in flight\n // and replays the statement silently, which is the defect itself.\n if (\n marks\n && start < downSql.length\n && resumeOperation === undefined\n && inflightStatement({ ...(params.storedError === undefined ? {} : { error: params.storedError }) }) === start\n ) {\n throw uncertainStatement({ migration: migration.name, statements: downSql, index: start, dialect, direction: \"down\" });\n }\n\n // Probe before any write that could clear the interrupted statement's marker.\n const resumeState = resumeOperation === undefined ? undefined : await establishOperationState({ executor, dialect, operation: resumeOperation });\n\n // Mark the rollback as started before the first statement runs, so a crash\n // between statements can never be mistaken for a completed apply.\n if (start === 0) {\n if (migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: migration.desiredState.from, to: migration.desiredState.to, removals: migration.desiredState.unmanagedRemovals, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n await recordProgress(0);\n }\n\n let cursor = start;\n if (\n resumeOperation !== undefined\n && resumeState === \"satisfied\"\n ) {\n if (start + 1 === downSql.length && migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: migration.desiredState.to, to: migration.desiredState.down ?? migration.desiredState.from, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n await recordProgress(start + 1);\n cursor = start + 1;\n }\n\n for (let index = cursor; index < downSql.length; index += 1) {\n const atomic = selfManaged && canCheckpointAtomically({ sql: downSql, index });\n const commitsBlock = selfManaged && isSelfManagedCommit({ statement: downSql[index] as string });\n if (marks) {\n await executor({\n text: `UPDATE ${table} SET ${q(dialect, \"error\")} = ${ph(dialect, 1)} WHERE ${q(dialect, \"name\")} = ${ph(dialect, 2)}`,\n values: [`${INFLIGHT_PREFIX}${index}`, migration.name],\n });\n }\n if (atomic) await executor({ text: \"BEGIN\" });\n try {\n // Persist the index AFTER COMMIT in the transaction it describes. A kill\n // before COMMIT rolls back both; a kill after it cannot replay the block.\n if (commitsBlock) {\n if (migration.desiredState !== undefined && downSql.slice(index + 1).every((statement) => /^\\s*PRAGMA\\s+foreign_keys\\s*=\\s*ON\\s*;?\\s*$/i.test(statement))) assertMigrationState({ report: await verifySqliteTransitionBeforeRestore({ executor, dialect, from: migration.desiredState.to, to: migration.desiredState.down ?? migration.desiredState.from, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n await recordProgress(index + 1);\n }\n await executeStatement({ executor, statement: downSql[index] as string, dialect });\n if (index === downSql.length - 1 && migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: migration.desiredState.to, to: migration.desiredState.down ?? migration.desiredState.from, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n if (atomic) {\n await recordProgress(index + 1);\n await executor({ text: \"COMMIT\" });\n }\n } catch (error) {\n // Self-managed scripts fail INSIDE their own transaction: close it first\n // or the error UPDATE below is rolled back with it (see the apply path).\n if (selfManaged) await cleanupSelfManagedFailure({ executor });\n try {\n await executor({\n text: `UPDATE ${table} SET ${q(dialect, \"error\")} = ${ph(dialect, 1)} WHERE ${q(dialect, \"name\")} = ${ph(dialect, 2)}`,\n values: [marks ? `${INFLIGHT_PREFIX}${index}` : error instanceof Error ? error.message : String(error), migration.name],\n });\n } catch {\n // Progress row update is best-effort; the original failure matters more.\n }\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `rollback of \"${migration.name}\" failed at down statement ${index + 1} of ${downSql.length}: ${error instanceof Error ? error.message : String(error)}. ${marks ? \"The statement outcome is unknown; inspect its effects before resolving or retrying.\" : \"Progress is recorded; re-running the rollback resumes from this statement.\"}`,\n meta: { migration: migration.name, statementIndex: index, ...(marks ? { outcome: \"unknown\" } : {}), ...timeoutDiagnostic({ error }) },\n cause: error,\n });\n }\n if (!atomic && !commitsBlock) await recordProgress(index + 1);\n }\n\n if (migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: migration.desiredState.to, to: migration.desiredState.down ?? migration.desiredState.from, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n await executor({\n text: `DELETE FROM ${table} WHERE ${q(dialect, \"name\")} = ${ph(dialect, 1)}`,\n values: [migration.name],\n });\n}\n\n// ─── Execution paths ──────────────────────────────────────────────\n\n/** Transactional path (postgres, sqlite) — see module doc. */\nasync function runTransactional(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n migration: MigrationFile;\n probe?: \"none\" | \"rollback\" | \"temporary\";\n}): Promise<void> {\n const { executor, dialect, migration } = params;\n // sqlite rebuild scripts manage their own transactions — never wrap them.\n const selfManaged = dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: migration.sql });\n const wrap = !selfManaged;\n\n if (wrap) await executor({ text: \"BEGIN\" });\n try {\n // Declared limits ride the transaction itself here (SET LOCAL), so COMMIT\n // or ROLLBACK restores them with no separate bookkeeping.\n const limits = migration.execution;\n if (wrap && dialect === \"postgres\" && limits !== undefined) {\n if ((limits.lockTimeoutMs ?? 0) > 0) await executor({ text: renderMigrationSessionSet({ dialect: getSqlDialect({ dialect }), setting: \"lock_timeout\", milliseconds: limits.lockTimeoutMs as number, local: true }).text });\n if ((limits.statementTimeoutMs ?? 0) > 0) await executor({ text: renderMigrationSessionSet({ dialect: getSqlDialect({ dialect }), setting: \"statement_timeout\", milliseconds: limits.statementTimeoutMs as number, local: true }).text });\n }\n await assertForwardStart({ executor, dialect, migration, ...(params.probe === undefined ? {} : { probe: params.probe }) });\n if (migration.rls !== undefined) await introspectPostgres({ executor, rlsSchema: migration.rls.from, inTransaction: true, requireInstalledRls: true });\n let statementIndex = 0;\n for (const statement of migration.sql) {\n await executeStatement({ executor, statement, dialect });\n statementIndex += 1;\n }\n if (migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, from: migration.desiredState.from, to: migration.desiredState.to, removals: migration.desiredState.unmanagedRemovals, dialect, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n if (migration.rls !== undefined) await introspectPostgres({ executor, rlsSchema: migration.rls.to, inTransaction: true, requireInstalledRls: true });\n if (migration.moduleOrigin !== undefined) await insertModuleJournal({ executor, dialect, migration, index: statementIndex, complete: true });\n else await executor({\n text: `INSERT INTO ${q(dialect, MIGRATIONS_TABLE_NAME)} (${q(dialect, \"name\")}, ${q(dialect, \"checksum\")}, ${q(dialect, \"statement_index\")}) VALUES (${ph(dialect, 1)}, ${ph(dialect, 2)}, ${ph(dialect, 3)})`,\n values: [migration.name, checksumOf({ migration }), statementIndex],\n });\n if (wrap) await executor({ text: \"COMMIT\" });\n } catch (error) {\n if (wrap) {\n try {\n await executor({ text: \"ROLLBACK\" });\n } catch {\n // Rollback is best-effort; the original failure matters more.\n }\n } else {\n await cleanupSelfManagedFailure({ executor });\n }\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `migration \"${migration.name}\" failed: ${error instanceof Error ? error.message : String(error)}`,\n meta: { migration: migration.name },\n cause: error,\n });\n }\n}\n\n/**\n * Per-statement path (mysql — DDL auto-commits — and self-managed sqlite\n * scripts, which cannot be wrapped): per-statement progress in the\n * bookkeeping row; failures record the error and later runs resume.\n */\nasync function runNonTransactional(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n migration: MigrationFile;\n start: number;\n insertRecord: boolean;\n /** The journal row's `error` text when resuming — may hold an in-flight marker. */\n storedError?: string;\n probe?: \"none\" | \"rollback\" | \"temporary\";\n}): Promise<void> {\n const { executor, dialect, migration, insertRecord } = params;\n const table = q(dialect, MIGRATIONS_TABLE_NAME);\n const selfManaged = dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: migration.sql });\n // Before the journal row, before the first statement: a self-managed script\n // is only recoverable in the shape the generator emits (execute.ts). This\n // sits HERE rather than up front with the other validations so that a\n // deviant migration already recorded as applied cannot wedge `migrate apply`\n // for the whole history — a record repaired with `resolveMigration` skips\n // before reaching this point, which is the operator's way out.\n if (selfManaged) {\n assertSupportedSelfManagedScript({ sql: migration.sql, migration: migration.name, direction: \"up\" });\n assertSelfManagedResumeSafe({ sql: migration.sql, start: params.start, migration: migration.name, direction: \"up\" });\n }\n const execution = migration.execution;\n const declared = execution?.transaction === \"none\";\n // mysql has this window whether or not anyone declared anything; postgres\n // only when the migration opted out of transactions. sqlite closes it instead\n // of recording it (see the atomic checkpoint below).\n const marks = marksInflight({ dialect, ...(execution === undefined ? {} : { execution }) });\n // A recorded index can point INSIDE a rebuild block, one past its\n // session-scoped `PRAGMA foreign_keys=OFF` — resuming there would replay the\n // rebuild (DROP TABLE included) with foreign keys ON. Rewind to the block.\n const start = selfManaged\n ? selfManagedResumeStart({ sql: migration.sql, start: params.start })\n : params.start;\n\n if (insertRecord) {\n if (migration.desiredState !== undefined) {\n await assertForwardStart({ executor, dialect, migration, ...(params.probe === undefined ? {} : { probe: params.probe }) });\n if (migration.sql.length === 0) assertMigrationState({ report: await verifyMigrationTransition({ executor, from: migration.desiredState.from, to: migration.desiredState.to, removals: migration.desiredState.unmanagedRemovals, dialect, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n }\n if (migration.moduleOrigin !== undefined) await insertModuleJournal({ executor, dialect, migration, index: 0, complete: false });\n else await executor({\n text: `INSERT INTO ${table} (${q(dialect, \"name\")}, ${q(dialect, \"checksum\")}, ${q(dialect, \"statement_index\")}) VALUES (${ph(dialect, 1)}, ${ph(dialect, 2)}, 0)`,\n values: [migration.name, checksumOf({ migration })],\n });\n }\n\n const checkpoint = async (completed: number): Promise<void> => {\n await executor({\n text: `UPDATE ${table} SET ${q(dialect, \"statement_index\")} = ${ph(dialect, 1)}, ${q(dialect, \"error\")} = NULL WHERE ${q(dialect, \"name\")} = ${ph(dialect, 2)}`,\n values: [completed, migration.name],\n });\n };\n\n // RESUME: establish what happened to the statement we stopped on, before\n // touching the database again. This is the whole point of the declared\n // regime — a statement whose effect cannot be established is never replayed.\n let cursor = start;\n if (marks && !insertRecord && start < migration.sql.length) {\n // Declared operations exist on postgres only — they are the one way a\n // statement's outcome can be READ back instead of guessed.\n const operation = declared ? operationFor({ ...(execution === undefined ? {} : { execution }), statement: start }) : undefined;\n if (operation !== undefined) {\n const state = await establishOperationState({ executor, dialect, operation });\n if (state === \"satisfied\") {\n if (start + 1 === migration.sql.length && migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: migration.desiredState.from, to: migration.desiredState.to, removals: migration.desiredState.unmanagedRemovals, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n await checkpoint(start + 1);\n cursor = start + 1;\n }\n } else if (inflightStatement({ ...(params.storedError === undefined ? {} : { error: params.storedError }) }) === start) {\n throw uncertainStatement({ migration: migration.name, statements: migration.sql, index: start, dialect, direction: \"up\" });\n }\n }\n\n for (let index = cursor; index < migration.sql.length; index += 1) {\n // sqlite: hold the statement and its checkpoint in ONE transaction, so the\n // gap never opens. Either both landed or neither did.\n const atomic = selfManaged && canCheckpointAtomically({ sql: migration.sql, index });\n const commitsBlock = selfManaged && isSelfManagedCommit({ statement: migration.sql[index] as string });\n // Record the intent to run BEFORE running it, so a crash in the gap\n // between the statement committing and its checkpoint is distinguishable\n // from a statement that never started.\n if (marks) {\n await executor({\n text: `UPDATE ${table} SET ${q(dialect, \"error\")} = ${ph(dialect, 1)} WHERE ${q(dialect, \"name\")} = ${ph(dialect, 2)}`,\n values: [`${INFLIGHT_PREFIX}${index}`, migration.name],\n });\n }\n if (atomic) await executor({ text: \"BEGIN\" });\n try {\n // Same atomic commit checkpoint as the down direction above.\n if (commitsBlock) {\n if (migration.desiredState !== undefined && migration.sql.slice(index + 1).every((statement) => /^\\s*PRAGMA\\s+foreign_keys\\s*=\\s*ON\\s*;?\\s*$/i.test(statement))) assertMigrationState({ report: await verifySqliteTransitionBeforeRestore({ executor, dialect, from: migration.desiredState.from, to: migration.desiredState.to, removals: migration.desiredState.unmanagedRemovals, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n await checkpoint(index + 1);\n }\n await executeStatement({ executor, statement: migration.sql[index] as string, dialect });\n if (index === migration.sql.length - 1 && migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, from: migration.desiredState.from, to: migration.desiredState.to, removals: migration.desiredState.unmanagedRemovals, dialect, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n if (atomic) {\n await checkpoint(index + 1);\n await executor({ text: \"COMMIT\" });\n }\n } catch (error) {\n // A self-managed script fails INSIDE its own BEGIN, with foreign_keys\n // OFF. Close that transaction FIRST: otherwise the error UPDATE below\n // joins it and is rolled back with it, and the session keeps running\n // inside a stale transaction (every later statement on this connection).\n if (selfManaged) await cleanupSelfManagedFailure({ executor });\n // Record the failure (best-effort) — statement_index already points at\n // the failed statement, so a re-run resumes exactly here.\n try {\n await executor({\n text: `UPDATE ${table} SET ${q(dialect, \"error\")} = ${ph(dialect, 1)} WHERE ${q(dialect, \"name\")} = ${ph(dialect, 2)}`,\n values: [marks ? `${INFLIGHT_PREFIX}${index}` : error instanceof Error ? error.message : String(error), migration.name],\n });\n } catch {\n // Progress row update is best-effort; the original failure matters more.\n }\n const sqlState = sqlStateOf(error);\n const timeout = sqlState === \"55P03\" ? \"lock-timeout\" : sqlState === \"57014\" ? \"statement-timeout\" : undefined;\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: timeout === \"lock-timeout\"\n ? `migration \"${migration.name}\" gave up waiting for a lock at statement ${index + 1} of ${migration.sql.length} (lock_timeout ${String(execution?.lockTimeoutMs ?? 0)}ms, SQLSTATE 55P03). Another session holds a conflicting lock; inspect the declared operation before retrying.`\n : timeout === \"statement-timeout\"\n ? `migration \"${migration.name}\" exceeded its statement_timeout at statement ${index + 1} of ${migration.sql.length} (${String(execution?.statementTimeoutMs ?? 0)}ms, SQLSTATE 57014). Inspect the declared operation before retrying.`\n : `migration \"${migration.name}\" failed at statement ${index + 1} of ${migration.sql.length}: ${error instanceof Error ? error.message : String(error)}. ${marks ? \"The statement outcome is unknown; inspect its effects before resolving or retrying.\" : \"Progress is recorded; re-running applyMigrations resumes from this statement.\"}`,\n meta: { migration: migration.name, statementIndex: index, ...(marks ? { outcome: \"unknown\" } : {}), ...(timeout === undefined ? {} : { reason: timeout, sqlState }) },\n cause: error,\n });\n }\n if (!atomic && !commitsBlock) await checkpoint(index + 1);\n }\n if (migration.moduleOrigin !== undefined) {\n assertMigrationState({ report: await verifyMigrationState({ executor, dialect, expected: migration.desiredState!.to }) });\n await completeModuleJournal({ executor, dialect, migration });\n }\n}\n\n// ─── Advisory locks ───────────────────────────────────────────────\n\nasync function acquireLock(params: { executor: SqlExecutor; dialect: Dialect }): Promise<void> {\n const { executor, dialect } = params;\n if (dialect === \"postgres\") {\n await executor({ text: `SELECT pg_advisory_lock(${PG_ADVISORY_LOCK_KEY})` });\n return;\n }\n if (dialect === \"mysql\") {\n // values: [] forces the row-returning executor path (adapter contract:\n // value-less text may run as a row-less batch statement).\n const rows = await executor({\n text: `SELECT GET_LOCK('${MYSQL_LOCK_NAME}', ${MYSQL_LOCK_TIMEOUT_SECONDS}) AS \\`vibe_lock\\``,\n values: [],\n });\n const acquired = Number(rows[0]?.vibe_lock) === 1;\n if (!acquired) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `could not acquire the migration lock ('${MYSQL_LOCK_NAME}') within ${MYSQL_LOCK_TIMEOUT_SECONDS}s — another migration run is in progress`,\n meta: { lock: MYSQL_LOCK_NAME },\n });\n }\n }\n // SQLite has no advisory lock here. Individual BEGINs do not protect a\n // whole self-managed run; callers must provide cross-connection ownership.\n}\n\nasync function releaseLock(params: { executor: SqlExecutor; dialect: Dialect }): Promise<void> {\n const { executor, dialect } = params;\n try {\n if (dialect === \"postgres\") {\n await executor({ text: `SELECT pg_advisory_unlock(${PG_ADVISORY_LOCK_KEY})` });\n } else if (dialect === \"mysql\") {\n await executor({ text: `SELECT RELEASE_LOCK('${MYSQL_LOCK_NAME}')` });\n }\n } catch {\n // Releasing is best-effort — the session dropping releases it anyway.\n }\n}\n\n// ─── Internals ────────────────────────────────────────────────────\n\ntype RecordedRow = JournalRow;\n\n// ─── Declared execution semantics ────────────────────────────\n\n/**\n * Sentinel written into the EXISTING nullable `error` column before a\n * statement of a declared-nontransactional migration runs, and cleared by that\n * statement's success checkpoint.\n *\n * Reusing `error` is deliberate: the column has been in all three dialects'\n * CREATE TABLE since the journal was introduced, so no installed database\n * needs migrating and an older binary reading the row simply sees a string it\n * reports as an error. There is no on-disk format change.\n */\nconst INFLIGHT_PREFIX = \"VIBE_INFLIGHT:\";\n\n/**\n * The statement index an in-flight marker refers to, if the stored text is one.\n *\n * The whole remainder must be digits. A driver error message that merely opens\n * with the sentinel is an ERROR, and reading it as a marker would stop a\n * migration that is safe to resume.\n */\nfunction inflightStatement(params: { error?: string }): number | undefined {\n const error = params.error;\n if (error === undefined || !error.startsWith(INFLIGHT_PREFIX)) return undefined;\n const digits = error.slice(INFLIGHT_PREFIX.length);\n if (!/^\\d+$/.test(digits)) return undefined;\n const index = Number.parseInt(digits, 10);\n return Number.isSafeInteger(index) ? index : undefined;\n}\n\n/**\n * Does this (dialect, script) pair have a window between a statement\n * committing and its journal checkpoint that nothing can close?\n *\n * - **mysql: yes, always.** Every statement auto-commits on its own, DDL\n * unconditionally, and no transaction can hold a statement and its checkpoint\n * together. Nobody has to declare anything for the window to exist.\n * - **postgres: only when the migration declared `transaction: \"none\"`.**\n * Otherwise the migration and its journal row are one transaction.\n * - **sqlite: no.** A self-managed script's statements are covered either by\n * their rebuild block's own transaction or by the per-statement transaction\n * {@link canCheckpointAtomically} authorises, and any other sqlite script\n * runs wholly inside `runTransactional`.\n *\n * Where the answer is yes, an in-flight marker is written before the statement\n * runs and cleared by its checkpoint, so a resume can tell \"this statement was\n * running when we died\" from \"this statement never started\".\n */\nfunction marksInflight(params: { dialect: Dialect; execution?: MigrationExecution }): boolean {\n return params.execution?.transaction === \"none\" || params.dialect === \"mysql\";\n}\n\n/**\n * The refusal a still-present in-flight marker produces: this statement was\n * running when the process died, and nothing in the database says whether it\n * committed.\n *\n * Replaying it is the one thing that must not happen automatically. A DDL\n * replay usually fails loudly, but `CREATE TABLE IF NOT EXISTS` and its\n * siblings do not, and a data statement such as `UPDATE t SET n = n + 1`\n * applies twice in silence. So the runner stops and hands the decision to an\n * operator, who can see the rows and VibeORM cannot.\n */\nfunction uncertainStatement(params: {\n migration: string;\n statements: readonly string[];\n index: number;\n dialect: Dialect;\n direction: \"up\" | \"down\";\n}): VibeError {\n const { migration, statements, index, dialect, direction } = params;\n const subject = direction === \"down\" ? `rollback of \"${migration}\"` : `migration \"${migration}\"`;\n const position = `${direction === \"down\" ? \"down statement\" : \"statement\"} ${index + 1} of ${statements.length}`;\n const why =\n dialect === \"mysql\"\n ? \"MySQL commits every statement on its own, so nothing outside the statement records whether it finished.\"\n : \"That statement declares no operation whose effect recovery can read back from the catalog.\";\n return new VibeError({\n code: \"VIBE_MIGRATION\",\n message:\n `${subject} was interrupted while ${position} was running. ${why} ` +\n \"It may or may not have committed, and replaying it could apply it twice, so VibeORM stops here instead of guessing. \" +\n \"Inspect what that statement did to the database, then follow \\\"Recovering from a stopped migration\\\" in docs/migrations.md: \" +\n `clear the \\`error\\` column of this migration's journal row if the statement did NOT land, set \\`statement_index\\` to ${direction === \"down\" ? -(index + 2) : index + 1} if it DID, ` +\n \"or finish the whole migration by hand and record that with `vibeorm migrate resolve --applied`. \" +\n `The statement was: ${(statements[index] as string).slice(0, 200)}`,\n meta: {\n reason: \"uncertain-statement\",\n outcome: \"unknown\",\n migration,\n statementIndex: index,\n ...(direction === \"down\" ? { direction } : {}),\n },\n });\n}\n\n/**\n * Validate a migration's declared execution block and refuse the combinations\n * no dialect can honour — at apply time, which is the earliest moment the\n * dialect is known.\n *\n * `transaction: \"none\"` is a PostgreSQL concept here. sqlite and mysql have no\n * separate nontransactional regime to opt into: mysql's DDL auto-commits\n * already, and a sqlite script either wraps or manages its own transactions.\n * Silently accepting the flag there would promise a guarantee that is not\n * being made.\n */\nfunction assertExecutable(params: {\n migration: MigrationFile;\n execution?: MigrationExecution;\n sql: readonly string[];\n dialect: Dialect;\n}): void {\n const { migration, execution, dialect } = params;\n assertValidExecution({ ...(execution === undefined ? {} : { execution }), statements: params.sql.length, migration: migration.name });\n if (execution === undefined || isDefaultExecution({ execution })) return;\n if (dialect !== \"postgres\") {\n throw new VibeError({\n code: \"VIBE_UNSUPPORTED_CAPABILITY\",\n message: `migration \"${migration.name}\" declares explicit execution semantics (transaction: \"${execution.transaction}\"), which only the postgres runner implements — ${dialect} has no separate nontransactional regime to opt into`,\n meta: { reason: \"nontransactional-unsupported\", dialect, migration: migration.name, feature: \"nontransactionalMigrations\" },\n });\n }\n}\n\n/** SQLSTATE of a driver error, however deeply the adapter wrapped it. */\nfunction sqlStateOf(error: unknown): string | undefined {\n let current: unknown = error;\n for (let depth = 0; depth < 5 && current !== null && typeof current === \"object\"; depth += 1) {\n const code = (current as { code?: unknown }).code;\n if (typeof code === \"string\" && /^[0-9A-Z]{5}$/.test(code)) return code;\n current = (current as { cause?: unknown }).cause;\n }\n return undefined;\n}\n\n/** Migration-owned limits, applied to the pinned session and restored after. */\nasync function withSessionLimits<T>(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n execution?: MigrationExecution;\n run: () => Promise<T>;\n}): Promise<T> {\n const { executor, dialect, execution } = params;\n const lock = execution?.lockTimeoutMs ?? 0;\n const statement = execution?.statementTimeoutMs ?? 0;\n if (dialect !== \"postgres\" || (lock === 0 && statement === 0)) return params.run();\n\n const sqlDialect = getSqlDialect({ dialect });\n const previous = (await executor({ text: renderMigrationSessionRead({ dialect: sqlDialect }).text, values: [] }))[0];\n if (lock > 0) await executor({ text: renderMigrationSessionSet({ dialect: sqlDialect, setting: \"lock_timeout\", milliseconds: lock }).text });\n if (statement > 0) await executor({ text: renderMigrationSessionSet({ dialect: sqlDialect, setting: \"statement_timeout\", milliseconds: statement }).text });\n try {\n return await params.run();\n } finally {\n // Restore what the session had, not a guessed default: this connection is\n // pinned for the whole migrate operation and outlives one migration.\n for (const [setting, value] of [[\"lock_timeout\", previous?.lockTimeout], [\"statement_timeout\", previous?.statementTimeout]] as const) {\n if (setting === \"lock_timeout\" ? lock === 0 : statement === 0) continue;\n try {\n await executor({ text: renderMigrationSessionRestore({ dialect: sqlDialect, setting, value: typeof value === \"string\" ? value : \"\" }).text });\n } catch {\n // Restoring is best-effort; the original outcome matters more.\n }\n }\n }\n}\n\n/**\n * Which bookkeeping regime a (dialect, script) pair runs in: `true` when\n * progress is recorded PER STATEMENT — mysql (DDL auto-commits) and sqlite\n * scripts that manage their own transactions — `false` when the migration and\n * its record are one atomic unit.\n *\n * ONE predicate on purpose. Spelled per call site it was wrong in three places\n * at once: status called a partial self-managed record \"applied\", rollback's\n * partial-up guard went blind on sqlite, and apply wedged the migration.\n */\nfunction usesStatementBookkeeping(params: {\n dialect: Dialect;\n sql: readonly string[];\n execution?: MigrationExecution;\n}): boolean {\n const { dialect, sql } = params;\n // A migration that declares it runs outside a transaction cannot have an\n // atomic bookkeeping INSERT: there is no transaction for the record to join.\n // This clause fires ONLY on an explicit declaration, so mysql and\n // self-managed sqlite scripts keep exactly the two rules they always had.\n if (params.execution?.transaction === \"none\") return true;\n if (!DIALECT_CAPABILITIES[dialect].transactionalDdl) return true;\n return dialect === \"sqlite\" && usesSelfManagedTransactions({ sql });\n}\n\n/**\n * Is a bookkeeping row a COMPLETE application of its migration?\n *\n * Atomic regime: the row exists at all ⇒ the whole migration ran. Per-statement\n * regime: only once `statement_index` reached the statement count. An empty\n * checksum is a `resolveMigration` repair — complete by definition, content\n * unseen.\n *\n * Backward compatible with rows written before per-statement bookkeeping\n * covered self-managed sqlite scripts: `runTransactional` records\n * `statement_index = sql.length`, so those rows satisfy the last clause and\n * are never falsely resumed.\n */\nfunction isCompleteRecord(params: {\n dialect: Dialect;\n migration: MigrationFile;\n stored: RecordedRow;\n}): boolean {\n const { dialect, migration, stored } = params;\n if (migration.moduleOrigin !== undefined) return moduleRecordComplete({ migration, stored });\n if (stored.checksum === \"\") return true;\n if (!usesStatementBookkeeping({ dialect, sql: migration.sql, ...(migration.execution === undefined ? {} : { execution: migration.execution }) })) return true;\n return stored.statementIndex >= migration.sql.length;\n}\n\nasync function recordedRows(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n modules?: boolean;\n}): Promise<Map<string, RecordedRow>> {\n const { executor, dialect } = params;\n if (params.modules === true) return new Map([...(await readModuleJournal({ executor, dialect }))].map(([name, record]) => [name, record.row]));\n // values: [] forces the row-returning executor path (adapter contract:\n // value-less text may run as a row-less multi-statement batch on sqlite).\n const rows = await readJournalRows({ executor, dialect, query: {\n text: `SELECT ${q(dialect, \"name\")}, ${q(dialect, \"checksum\")}, ${q(dialect, \"statement_index\")}, ${q(dialect, \"error\")} FROM ${q(dialect, MIGRATIONS_TABLE_NAME)} ORDER BY ${q(dialect, \"id\")}`,\n values: [],\n } });\n return rows ?? new Map<string, RecordedRow>();\n}\n\nfunction assertChecksumMatches(params: { migration: MigrationFile; stored: string }): void {\n const { migration, stored } = params;\n if (stored === \"\") return; // resolveMigration record — content unknown by design.\n const actual = checksumOf({ migration });\n if (stored === actual) return;\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `checksum mismatch for migration \"${migration.name}\" — its SQL changed after it was applied (recorded ${stored.slice(0, 12)}…, current ${actual.slice(0, 12)}…)`,\n meta: { migration: migration.name, recorded: stored, current: actual },\n });\n}\n\nfunction assertResumable(params: { migration: MigrationFile; stored: RecordedRow }): void {\n const { migration, stored } = params;\n const actual = checksumOf({ migration });\n if (stored.checksum === actual) return;\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `migration \"${migration.name}\" is partially applied (${stored.statementIndex} statement(s) done) and its SQL has CHANGED since — refusing to resume; restore the original SQL or repair with resolveMigration`,\n meta: {\n migration: migration.name,\n statementIndex: stored.statementIndex,\n recorded: stored.checksum,\n current: actual,\n },\n });\n}\n\n/** Classify timeout diagnostics without treating cancellation as proof of no effects. */\nfunction timeoutDiagnostic(params: { error: unknown }): Record<string, unknown> {\n const sqlState = sqlStateOf(params.error);\n const reason = sqlState === \"55P03\" ? \"lock-timeout\" : sqlState === \"57014\" ? \"statement-timeout\" : undefined;\n return reason === undefined ? {} : { reason, sqlState };\n}\n\n/** Duplicate file identities cannot describe a replayable chain. */\nfunction assertDistinctMigrationNames(params: { migrations: readonly MigrationFile[] }): void {\n const names = new Set<string>();\n for (const migration of params.migrations) {\n if (names.has(migration.name)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Duplicate migration file identity \"${migration.name}\"`, meta: { reason: \"history-duplicate-file\", migration: migration.name } });\n names.add(migration.name);\n }\n}\n\n/** A complete chain must preserve journal order and append new work only. */\nfunction assertCompleteHistory(params: { migrations: readonly MigrationFile[]; recorded: ReadonlyMap<string, RecordedRow>; dialect: Dialect }): void {\n const byName = new Map(params.migrations.map((migration) => [migration.name, migration]));\n for (const name of params.recorded.keys()) {\n if (!byName.has(name)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Recorded migration \"${name}\" has no file in the complete chain`, meta: { reason: \"history-unknown-file\", migration: name } });\n }\n let index = 0;\n for (const [name, stored] of params.recorded) {\n const migration = params.migrations[index]!;\n if (migration?.name !== name) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Recorded migration order is not a prefix of the supplied complete chain\", meta: { reason: \"history-order-conflict\", migration: name, expected: migration?.name, position: index } });\n if (stored.statementIndex >= 0 && !isCompleteRecord({ dialect: params.dialect, migration, stored }) && index !== params.recorded.size - 1) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Partial migration \"${name}\" precedes later recorded work`, meta: { reason: \"history-partial-not-last\", migration: name } });\n index++;\n }\n}\n\n/** Validate all known identities and dirty journal rows before any migration runs. */\nasync function assertApplyHistory(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n migrations: readonly MigrationFile[];\n recorded: ReadonlyMap<string, RecordedRow>;\n}): Promise<void> {\n const { executor, dialect, migrations, recorded } = params;\n const byName = new Map(migrations.map((migration) => [migration.name, migration]));\n for (const [name, stored] of recorded) {\n if (stored.statementIndex < 0) {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Migration \"${name}\" is mid-rollback; finish or resolve it before applying`, meta: { reason: \"history-rolling-back\", migration: name, statementIndex: stored.statementIndex } });\n }\n const migration = byName.get(name);\n if (migration === undefined) {\n if (stored.error !== undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Migration \"${name}\" has an unresolved journal error but no supplied file`, meta: { reason: \"history-unknown-dirty\", migration: name } });\n continue; // Intentional programmatic subsets remain supported.\n }\n if (isCompleteRecord({ dialect, migration, stored }) && stored.error !== undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Migration \"${name}\" has an unresolved journal error`, meta: { reason: \"history-dirty\", migration: name } });\n if (isCompleteRecord({ dialect, migration, stored })) assertChecksumMatches({ migration, stored: stored.checksum });\n else assertResumable({ migration, stored });\n }\n for (const migration of migrations) {\n const stored = recorded.get(migration.name);\n if (stored === undefined || isCompleteRecord({ dialect, migration, stored })) continue;\n const start = stored.statementIndex;\n if (dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: migration.sql })) {\n assertSupportedSelfManagedScript({ sql: migration.sql, migration: migration.name, direction: \"up\" });\n assertSelfManagedResumeSafe({ sql: migration.sql, start, migration: migration.name, direction: \"up\" });\n }\n if (!marksInflight({ dialect, execution: migration.execution }) || start >= migration.sql.length) continue;\n const operation = migration.execution?.transaction === \"none\" ? operationFor({ execution: migration.execution, statement: start }) : undefined;\n if (operation !== undefined) await establishOperationState({ executor, dialect, operation });\n else if (inflightStatement({ error: stored.error }) === start) throw uncertainStatement({ migration: migration.name, statements: migration.sql, index: start, dialect, direction: \"up\" });\n }\n}\n\n// ─── Quoting / placeholders ───────────────────────────────────────\n\nfunction q(dialect: Dialect, name: string): string {\n return getSqlDialect({ dialect }).quoteIdent({ name });\n}\n\nfunction ph(dialect: Dialect, index: number): string {\n return getSqlDialect({ dialect }).placeholder({ index });\n}\n",
|
|
37
|
+
"/**\n * Migration runner: generate named migrations from IR diffs, apply them with\n * bookkeeping in `_vibe_migrations`, report status, and repair records.\n *\n * Concurrency: `applyMigrations` and `rollbackMigration` take an advisory lock\n * for the whole run — `pg_advisory_lock(1447645253)` on postgres (\"VIBE\" in\n * ASCII, blocking, released in a finally), `GET_LOCK('vibeorm_migrate', 60)`\n * on mysql (throws VIBE_MIGRATION on timeout). SQLite serializes individual\n * transactions only; callers must exclude concurrent whole-run operations.\n * Locks are session-scoped — the\n * SqlExecutor contract (types.ts) requires one session for the whole\n * operation.\n *\n * Lock ORDER matters: the lock is taken BEFORE `ensureMigrationsTable`, never\n * after. Two concurrent first-time runs against a fresh postgres database\n * would otherwise both issue `CREATE TABLE IF NOT EXISTS _vibe_migrations`,\n * which is a catalog race on postgres (a duplicate-key error on\n * `pg_type_typname_nsp_index`, not a no-op). Repair uses the same lock.\n * Status deliberately stays nonblocking and never creates the journal.\n *\n * Execution strategy per dialect (`DIALECT_CAPABILITIES[dialect]`) AND per\n * script:\n *\n * - transactionalDdl (postgres, sqlite): each migration runs inside\n * BEGIN/COMMIT with its bookkeeping INSERT — atomic.\n * - EXCEPT sqlite scripts containing a table-rebuild block, which manage their\n * own transactions (execute.ts `usesSelfManagedTransactions`) and therefore\n * cannot be wrapped. Those take the SAME per-statement bookkeeping as mysql\n * (below). They are NOT simply \"re-runnable\": a pure rebuild block is\n * effectively idempotent, but any plain statement in the same script\n * auto-commits on its own, so without a recorded statement_index a crash\n * wedged the migration forever (every later run replayed statements that had\n * already run). Resuming into a rebuild block rewinds to that block's\n * `PRAGMA foreign_keys=OFF` (execute.ts `selfManagedResumeStart`): the block\n * is transactional, so nothing of it survived, and the pragma is\n * session-scoped and gone after a crash.\n * - mysql (transactionalDdl: false — DDL auto-commits): the runner records\n * PER-STATEMENT progress instead. The row is inserted up front\n * (statement_index 0), advanced after every statement, and on failure the\n * error lands in the `error` column. Re-running RESUMES from the recorded\n * statement_index — and REFUSES if the migration's checksum changed since\n * the partial application. A row is \"complete\" when its statement_index\n * reaches the statement count (or its checksum is empty — resolveMigration\n * records, which store statement_index 2147483647).\n *\n * `usesStatementBookkeeping` is the ONE predicate deciding which of the two\n * regimes a (dialect, script) pair is in; apply, status and rollback all read\n * it, so they can never disagree about whether a record is complete.\n *\n * Checksums (sha256 over the joined SQL) pin a migration's content:\n * re-applying a renamed-or-edited migration is a VIBE_MIGRATION error, never\n * a silent divergence.\n */\n\nimport { migrationChecksum } from \"./migration-checksum.ts\";\nimport { assertDatabaseNotShadow } from \"./shadow-guard.ts\";\nimport { assertModuleOwnership, assertLiveModuleOwnership, assertApplicationModuleState, moduleNamespace } from \"./module-ownership.ts\";\nimport { assertModuleUpgradeHistory, applicationModuleOrigins } from \"./module-history.ts\";\nimport type { ModuleMigrationOrigin } from \"./module-origin.ts\";\nimport { completeModuleJournal, ensureModuleJournal, insertModuleJournal, moduleRecordComplete, readModuleJournal } from \"./module-journal.ts\";\nimport { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR, SqlObjectIdentity, VibeExtension } from \"@vibeorm/schema\";\nimport { assertMaterializedModuleMigration } from \"./module-origin.ts\";\nimport { readJournalRows } from \"./journal-read.ts\";\nimport type { JournalRow } from \"./journal-read.ts\";\nimport { MIGRATIONS_TABLE_NAME } from \"./journal-table.ts\";\nimport {\n DIALECT_CAPABILITIES,\n getSqlDialect,\n renderMigrationSessionRead,\n renderMigrationSessionRestore,\n renderMigrationSessionSet,\n} from \"@vibeorm/sql\";\nimport { assertValidExecution, isDefaultExecution, operationFor } from \"./execution.ts\";\nimport type { MigrationExecution } from \"./execution.ts\";\nimport { establishOperationState } from \"./recovery.ts\";\nimport type { RenameIntent } from \"./renames.ts\";\nimport { diffSchemas } from \"./differ.ts\";\nimport { renderSteps } from \"./ddl/render.ts\";\nimport { assertSecurityAcknowledgement, securityChangesOf, withRlsSteps } from \"./ddl/rls.ts\";\nimport { introspectPostgres } from \"./introspect/postgres.ts\";\nimport {\n artifactCreateSql,\n collectExtensionArtifacts,\n planMissingArtifacts,\n stripExtensionArtifacts,\n} from \"./extensions.ts\";\nimport {\n assertSupportedSelfManagedScript,\n assertSelfManagedResumeSafe,\n isSelfManagedCommit,\n canCheckpointAtomically,\n cleanupSelfManagedFailure,\n executeStatement,\n selfManagedResumeStart,\n usesSelfManagedTransactions,\n} from \"./execute.ts\";\nimport type {\n AppliedResult,\n MigrationFile,\n MigrationHistoryMode,\n MigrationReplayOptions,\n MigrationStatus,\n RecordedMigration,\n RollbackResult,\n SqlExecutor,\n} from \"./types.ts\";\n\n/** Recompute authorization from the trusted declarations; omitted preview arrays cannot bypass it. */\nfunction migrationRlsSecurityChanges(params: { migration: MigrationFile; down: boolean }): string[] {\n const source = params.migration.rls;\n if (source === undefined) return [];\n return securityChangesOf({ steps: withRlsSteps({ from: params.down ? source.to : source.from, to: params.down ? source.from : source.to, steps: [] }) });\n}\n\n/** Classify operation tokens, never words inside identifiers, literals or comments. */\nfunction containsNativeRlsSql(params: { sql: string; dialect: Dialect }): boolean {\n const { sql, dialect } = params;\n const tokens: string[] = [];\n let i = 0;\n while (i < sql.length) {\n const ch = sql[i]!;\n if (/\\s/.test(ch)) { i++; continue; }\n if (sql.startsWith(\"--\", i) || (dialect === \"mysql\" && ch === \"#\")) {\n const end = sql.indexOf(\"\\n\", i);\n i = end === -1 ? sql.length : end + 1;\n continue;\n }\n if (sql.startsWith(\"/*\", i)) {\n let depth = 1;\n i += 2;\n while (i < sql.length && depth > 0) {\n if (sql.startsWith(\"/*\", i)) { depth++; i += 2; }\n else if (sql.startsWith(\"*/\", i)) { depth--; i += 2; }\n else i++;\n }\n continue;\n }\n if (ch === \"'\" || ch === '\"' || ch === \"`\" || (dialect === \"sqlite\" && ch === \"[\")) {\n const endQuote = ch === \"[\" ? \"]\" : ch;\n const backslash = dialect === \"mysql\" || (ch === \"'\" && /(?:^|[^\\w$])[eE]$/.test(sql.slice(0, i)));\n i++;\n while (i < sql.length) {\n if (backslash && sql[i] === \"\\\\\") { i += 2; continue; }\n if (sql[i] === endQuote) {\n if (sql[i + 1] === endQuote) { i += 2; continue; }\n i++;\n break;\n }\n i++;\n }\n tokens.push(\"@\"); // Keep a boundary: CREATE \"ignored\" POLICY is not CREATE POLICY.\n continue;\n }\n if (ch === \"$\") {\n const tag = /^(?:\\$\\$|\\$[A-Za-z_][A-Za-z_0-9]*\\$)/.exec(sql.slice(i))?.[0];\n if (tag !== undefined) {\n const end = sql.indexOf(tag, i + tag.length);\n i = end === -1 ? sql.length : end + tag.length;\n tokens.push(\"@\");\n continue;\n }\n }\n const word = /^[A-Za-z_][A-Za-z_0-9$]*/.exec(sql.slice(i))?.[0];\n tokens.push(word === undefined ? ch : word.toUpperCase());\n i += word?.length ?? 1;\n }\n // A MigrationFile may carry multiple SQL statements in one array entry.\n return tokens.join(\" \").split(/\\s*;\\s*/).some((statement) => {\n const operation = statement.trim();\n return /^(?:CREATE|ALTER|DROP) POLICY\\b/.test(operation)\n || /^COMMENT ON POLICY\\b/.test(operation)\n || (/^ALTER TABLE\\b/.test(operation) && /\\b(?:ENABLE|DISABLE|FORCE) ROW LEVEL SECURITY\\b/.test(operation));\n });\n}\n\n/** SQL-only native-policy files lack the trusted pre/post declarations required for drift checks. */\nfunction assertNativeMigrationMetadata(params: { migration: MigrationFile; sql: readonly string[]; dialect: Dialect }): void {\n const native = params.migration.rls !== undefined || params.sql.some((sql) => containsNativeRlsSql({ sql, dialect: params.dialect }));\n if (!native) return;\n if (!DIALECT_CAPABILITIES[params.dialect].nativeRowLevelSecurity) {\n throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: `Native RLS migrations are unsupported on ${params.dialect}`, meta: { feature: \"nativeRowLevelSecurity\", dialect: params.dialect } });\n }\n if (params.migration.rls === undefined) {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Native RLS migration files require trusted rls.from/rls.to schema metadata. SQL alone cannot prove policy ownership or drift; regenerate with preserved security metadata.\", meta: { reason: \"rls-migration-metadata-required\", migration: params.migration.name } });\n }\n}\n\n// ─── Bookkeeping table ────────────────────────────────────────────\n\nexport { MIGRATIONS_TABLE_NAME } from \"./journal-table.ts\";\n\n/** Advisory-lock key for postgres — \"VIBE\" as a big-endian ASCII int32. */\nconst PG_ADVISORY_LOCK_KEY = 1447645253;\nconst MYSQL_LOCK_NAME = \"vibeorm_migrate\";\nconst MYSQL_LOCK_TIMEOUT_SECONDS = 60;\n\n/** statement_index recorded by resolveMigration — \"complete, content unseen\". */\nconst RESOLVED_STATEMENT_INDEX = 2147483647;\n\nconst CREATE_TABLE_SQL: Readonly<Record<Dialect, string>> = {\n postgres: `CREATE TABLE IF NOT EXISTS \"${MIGRATIONS_TABLE_NAME}\" (\n \"id\" integer GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,\n \"name\" text NOT NULL UNIQUE,\n \"checksum\" text NOT NULL,\n \"applied_at\" timestamptz(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,\n \"statement_index\" integer NOT NULL DEFAULT 0,\n \"error\" text\n);`,\n sqlite: `CREATE TABLE IF NOT EXISTS \"${MIGRATIONS_TABLE_NAME}\" (\n \"id\" INTEGER PRIMARY KEY AUTOINCREMENT,\n \"name\" TEXT NOT NULL UNIQUE,\n \"checksum\" TEXT NOT NULL,\n \"applied_at\" TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,\n \"statement_index\" INTEGER NOT NULL DEFAULT 0,\n \"error\" TEXT\n);`,\n mysql: `CREATE TABLE IF NOT EXISTS \\`${MIGRATIONS_TABLE_NAME}\\` (\n \\`id\\` int NOT NULL AUTO_INCREMENT,\n \\`name\\` varchar(191) NOT NULL UNIQUE,\n \\`checksum\\` text NOT NULL,\n \\`applied_at\\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),\n \\`statement_index\\` int NOT NULL DEFAULT 0,\n \\`error\\` text,\n PRIMARY KEY (\\`id\\`)\n);`,\n};\n\n/** Create the bookkeeping table when missing. */\nexport async function ensureMigrationsTable(params: {\n executor: SqlExecutor;\n dialect?: Dialect;\n}): Promise<void> {\n await params.executor({ text: CREATE_TABLE_SQL[params.dialect ?? \"postgres\"] });\n}\n\n/**\n * sha256 hex over the migration's statements — its identity across runs.\n *\n * A NON-default execution block (execution.ts) folds a canonical description\n * of itself in, so changing how a migration executes after it was applied is\n * caught by the same checksum refusal that catches changing its SQL. A default\n * or absent block contributes NOTHING, which is what keeps every migration\n * written before this feature — and every journal row recording one — valid.\n */\nexport { migrationChecksum } from \"./migration-checksum.ts\";\n\n/** The migration's own checksum, execution block included. */\nfunction checksumOf(params: { migration: MigrationFile }): string {\n const { migration } = params;\n return migrationChecksum(migration);\n}\n\nimport { createDesiredState, assertDesiredState } from \"./desired-state.ts\";\nimport { migrationNamespace, verifyMigrationState, verifyMigrationTransition, verifySqliteTransitionBeforeRestore, assertMigrationState, assertProbeMode } from \"./inspect-objects.ts\";\nimport { assertNamedRemovals, assertRemovalAuthorization, preserveMigrationObjects, sqlitePreservedSchema, orderedMigrationObjects, assertRetainedMigrationObjects } from \"./object-ownership.ts\";\nimport type { MigrationDesiredState } from \"./desired-state.ts\";\n\n/** Re-apply may start at the checksum-bound actual down target after an irreversible rollback. */\nasync function assertForwardStart(params: { executor: SqlExecutor; dialect: Dialect; migration: MigrationFile; probe?: \"none\" | \"rollback\" | \"temporary\" }): Promise<void> {\n const state = params.migration.desiredState;\n if (state === undefined) return;\n const report = await verifyMigrationState({ executor: params.executor, dialect: params.dialect, expected: state.from, ...(params.probe === undefined ? {} : { probe: params.probe }) });\n if (report.inSync) return;\n if (state.down !== undefined) {\n const restored = await verifyMigrationState({ executor: params.executor, dialect: params.dialect, expected: state.down, ...(params.probe === undefined ? {} : { probe: params.probe }) });\n if (restored.inSync) return;\n }\n assertMigrationState({ report });\n}\n\n// ─── Generate ─────────────────────────────────────────────────────\n\n/**\n * Diff two IRs and render a named migration for a dialect (postgres if\n * omitted). `destructive` aggregates the steps' flags so callers can gate\n * confirmation before applying.\n */\nexport function generateMigration(params: {\n from: SchemaIR;\n to: SchemaIR;\n name: string;\n /** Rendering dialect; postgres if omitted. */\n dialect?: Dialect;\n /** Configured extension instances — their artifacts land in the migration. */\n extensions?: readonly VibeExtension[];\n /** Explicit physical renames (renames.ts); never inferred from the diff. */\n renames?: readonly RenameIntent[];\n /** Explicit execution semantics for the generated file. */\n execution?: MigrationExecution;\n /** Independent authored baseline; required by live generation on an existing database. */\n desiredState?: MigrationDesiredState;\n}): MigrationFile {\n const { from, to, name } = params;\n const dialect = params.dialect ?? \"postgres\";\n\n const artifacts = collectExtensionArtifacts({\n schema: to,\n dialect,\n extensions: params.extensions ?? [],\n });\n const allArtifacts = [...artifacts.setup, ...artifacts.objects];\n assertRetainedMigrationObjects({ from: from.migrationObjects ?? [], to: to.migrationObjects ?? [] });\n const strippedFrom = preserveMigrationObjects({ from: stripExtensionArtifacts({ schema: from, artifacts: allArtifacts }), to, objects: [...(from.migrationObjects ?? []), ...(to.migrationObjects ?? [])] });\n\n const steps = diffSchemas({ from: strippedFrom, to, dialect, ...(params.renames === undefined ? {} : { renames: params.renames }) });\n const coreSql = renderSteps({ steps, dialect, from: dialect === \"sqlite\" ? from : strippedFrom, to: dialect === \"sqlite\" ? sqlitePreservedSchema({ from, to, objects: [...(from.migrationObjects ?? []), ...(to.migrationObjects ?? [])] }) : to });\n const missing = planMissingArtifacts({ introspected: from, artifacts: allArtifacts });\n const sql = [\n ...artifactCreateSql({\n artifacts: missing.filter((artifact) => artifact.owns.kind === \"postgresExtension\"),\n }),\n ...coreSql,\n ...artifactCreateSql({\n artifacts: missing.filter((artifact) => artifact.owns.kind !== \"postgresExtension\"),\n }),\n ...orderedMigrationObjects({ objects: to.migrationObjects ?? [] }).flatMap((object) => {\n if (object.dialect !== dialect) throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: `Migration object ${object.id} requires ${object.dialect}` });\n const previous = (params.desiredState?.from.schema.migrationObjects ?? from.migrationObjects)?.find((entry) => entry.id === object.id);\n if (previous === undefined) return [...object.create];\n if (JSON.stringify(previous) !== JSON.stringify(object)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Migration-owned object ${object.id} changed; supply a reviewed forward SQL migration`, meta: { reason: \"migration-object-replacement-required\", shadowReusable: true, id: object.id } });\n return [];\n }),\n ];\n return {\n name,\n sql,\n destructive: steps.some((step) => step.destructive),\n ...(securityChangesOf({ steps }).length === 0 ? {} : { securityChanges: securityChangesOf({ steps }) }),\n ...(from.rls === undefined && to.rls === undefined ? {} : { rls: { from, to } }),\n ...(params.execution === undefined ? {} : { execution: params.execution }),\n desiredState: params.desiredState ?? { version: 1, dialect, from: createDesiredState({ schema: from, dialect }), to: createDesiredState({ schema: to, dialect }) },\n };\n}\n\n// ─── Apply ────────────────────────────────────────────────────────\n\n/** Run one operation on a dedicated session under the existing migration lock. */\nexport async function withMigrationLock<T>(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n run: (executor: SqlExecutor) => Promise<T>;\n}): Promise<T> {\n const runLocked = async (executor: SqlExecutor): Promise<T> => {\n await acquireLock({ executor, dialect: params.dialect });\n return Promise.resolve().then(async () => {\n await assertDatabaseNotShadow({ executor, dialect: params.dialect });\n return params.run(executor);\n }).then(\n async (value) => { await releaseLock({ executor, dialect: params.dialect }); return value; },\n (cause: unknown) => releaseLock({ executor, dialect: params.dialect }).then(\n () => { throw cause; },\n (cleanupCause: unknown) => {\n // The operation failure stays the primary outcome: a backend that dies\n // mid-migration fails BOTH the body and the unlock, and the operator\n // must act on the body's uncertainty verdict, not on lock cleanup.\n // The unlock failure is retained as evidence, never as the headline.\n if (cause instanceof VibeError) throw new VibeError({ code: cause.code, message: cause.message, meta: { ...cause.meta, cleanupCause }, cause });\n throw cause;\n },\n ),\n );\n };\n // Reserve once: the callback already receives the pinned executor, even if it\n // exposes withSession itself. Never recursively reserve through that handle.\n return params.executor.withSession === undefined ? runLocked(params.executor) : params.executor.withSession({ run: runLocked });\n}\n\n/** Validate replay declarations and approvals without reading or writing a database. */\nexport function validateMigrationReplay(params: MigrationReplayOptions): void {\n const dialect = params.dialect ?? \"postgres\";\n assertProbeMode({ dialect, probe: params.probe });\n assertDistinctMigrationNames({ migrations: params.migrations });\n for (const migration of params.migrations) {\n assertMigrationMetadata({ migration, dialect });\n if (dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: migration.sql })) assertSupportedSelfManagedScript({ sql: migration.sql, migration: migration.name, direction: \"up\" });\n assertNamedRemovals({ removals: migration.desiredState?.unmanagedRemovals ?? [], approved: params.removeUnmanaged, acceptIntegrityLoss: params.acceptIntegrityLoss });\n if (migration.desiredState !== undefined) {\n const state = migration.desiredState;\n assertRemovalAuthorization({ steps: diffSchemas({ from: state.from.schema, to: state.to.schema, dialect }), previous: state.from, dialect, namespace: dialect === \"sqlite\" ? \"main\" : \"public\", ...(params.acceptIntegrityLoss === undefined ? {} : { acceptIntegrityLoss: params.acceptIntegrityLoss }) });\n }\n assertSecurityAcknowledgement({ securityChanges: [...(migration.securityChanges ?? []), ...migrationRlsSecurityChanges({ migration, down: false })], ...(params.acceptSecurityChanges === undefined ? {} : { acceptSecurityChanges: params.acceptSecurityChanges }) });\n }\n}\n\nfunction assertMigrationMetadata(params: { migration: MigrationFile; dialect: Dialect }): void {\n const { migration, dialect } = params;\n if (migration.moduleOrigin !== undefined) {\n assertMaterializedModuleMigration({ migration });\n assertModuleOwnership({ origin: migration.moduleOrigin, desiredState: migration.desiredState });\n }\n if (migration.desiredStatePending === true) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Migration ${migration.name} has unfinalized desired state; finalize its reviewed before/after declarations before applying`, meta: { reason: \"desired-state-unfinalized\", migration: migration.name } });\n if (migration.desiredState !== undefined) {\n assertDesiredState({ value: migration.desiredState, migration: migration.name });\n if (migration.desiredState.dialect !== dialect) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Migration desired-state dialect mismatch\", meta: { reason: \"desired-state-dialect-mismatch\", migration: migration.name } });\n }\n assertNativeMigrationMetadata({ migration, sql: migration.sql, dialect });\n assertExecutable({ migration, execution: migration.execution, sql: migration.sql, dialect });\n}\n\n/**\n * Apply under the migration lock after preflight, preserving recorded progress.\n * Complete mode requires a full ordered chain; subset mode remains the default.\n * Empty-checksum resolve records deliberately skip content verification.\n */\nexport async function applyMigrations(params: {\n executor: SqlExecutor;\n migrations: readonly MigrationFile[];\n /** Complete requires the recorded journal to be a prefix of this ordered chain. */\n history?: MigrationHistoryMode;\n acceptSecurityChanges?: boolean;\n acceptIntegrityLoss?: boolean;\n removeUnmanaged?: readonly SqlObjectIdentity[];\n /** Explicit permission for rollback-only PostgreSQL CHECK normalization probes. */\n probe?: \"none\" | \"rollback\" | \"temporary\";\n /** Execution dialect; postgres if omitted. */\n dialect?: Dialect;\n}): Promise<AppliedResult> {\n const { executor, migrations } = params;\n const dialect = params.dialect ?? \"postgres\";\n if (params.history !== undefined && params.history !== \"complete\" && params.history !== \"subset\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Unknown migration history validation mode\", meta: { reason: \"history-mode-invalid\" } });\n if (params.history === \"complete\") assertDistinctMigrationNames({ migrations });\n for (const migration of migrations) assertMigrationMetadata({ migration, dialect });\n // Pin the session and acquire the lock before inspecting or creating journals.\n return withMigrationLock({ executor, dialect, run: async (executor) => {\n let moduleRecords = await readModuleJournal({ executor, dialect });\n const recorded = new Map([...moduleRecords].map(([name, record]) => [name, record.row]));\n if (migrations.some((migration) => migration.moduleOrigin !== undefined) || [...moduleRecords.values()].some((record) => record.entry !== undefined)) {\n assertModuleUpgradeHistory({ migrations, records: moduleRecords });\n const namespace = await migrationNamespace({ executor, dialect });\n if (migrations.some((migration) => migration.moduleOrigin !== undefined && moduleNamespace({ origin: migration.moduleOrigin }) !== namespace)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Module placement differs from the active database namespace\", meta: { reason: \"module-placement-mismatch\" } });\n }\n if (params.history === \"complete\") assertCompleteHistory({ migrations, recorded, dialect });\n await assertApplyHistory({ executor, dialect, migrations, recorded });\n const pending = migrations.filter((migration) => {\n const stored = recorded.get(migration.name);\n return stored === undefined || !isCompleteRecord({ dialect, migration, stored });\n });\n validateMigrationReplay({ ...params, migrations: pending, dialect });\n await ensureMigrationsTable({ executor, dialect });\n if (migrations.some((migration) => migration.moduleOrigin !== undefined)) await ensureModuleJournal({ executor, dialect });\n\n const applied: string[] = [];\n const skipped: string[] = [];\n\n for (const migration of migrations) {\n const stored = recorded.get(migration.name);\n if (migration.moduleOrigin !== undefined && (stored === undefined || !isCompleteRecord({ dialect, migration, stored }))) await assertLiveModuleOwnership({ executor, origin: migration.moduleOrigin, resume: stored !== undefined });\n if (stored !== undefined) {\n // Negative statement_index = a mysql rollback started but did not\n // finish (see rollbackMigration). Applying over it would corrupt both\n // directions — finish or repair first.\n if (stored.statementIndex < 0) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `migration \"${migration.name}\" is mid-rollback (${-stored.statementIndex - 1} down statement(s) done) — finish it with \\`migrate down\\` or repair with resolveMigration before applying`,\n meta: { migration: migration.name, statementIndex: stored.statementIndex },\n });\n }\n if (isCompleteRecord({ dialect, migration, stored })) {\n assertChecksumMatches({ migration, stored: stored.checksum });\n skipped.push(migration.name);\n continue;\n }\n // Partial row (mysql, a self-managed sqlite script, or a declared\n // nontransactional migration) → resume, but only for unchanged content.\n assertResumable({ migration, stored });\n await withSessionLimits({\n executor,\n dialect,\n ...(migration.execution === undefined ? {} : { execution: migration.execution }),\n run: () => runNonTransactional({\n executor,\n dialect,\n migration,\n start: stored.statementIndex,\n moduleOrigins: applicationModuleOrigins({ migration, records: moduleRecords }),\n ...(params.probe === undefined ? {} : { probe: params.probe }),\n insertRecord: false,\n ...(stored.error === undefined ? {} : { storedError: stored.error }),\n }),\n });\n if (migration.moduleOrigin !== undefined) moduleRecords = await readModuleJournal({ executor, dialect });\n applied.push(migration.name);\n continue;\n }\n\n if (usesStatementBookkeeping({ dialect, sql: migration.sql, ...(migration.execution === undefined ? {} : { execution: migration.execution }) })) {\n await withSessionLimits({\n executor,\n dialect,\n ...(migration.execution === undefined ? {} : { execution: migration.execution }),\n run: () => runNonTransactional({ executor, dialect, migration, moduleOrigins: applicationModuleOrigins({ migration, records: moduleRecords }), start: 0, insertRecord: true, ...(params.probe === undefined ? {} : { probe: params.probe }) }),\n });\n } else {\n await runTransactional({ executor, dialect, migration, moduleOrigins: applicationModuleOrigins({ migration, records: moduleRecords }), ...(params.probe === undefined ? {} : { probe: params.probe }) });\n }\n if (migration.moduleOrigin !== undefined) moduleRecords = await readModuleJournal({ executor, dialect });\n applied.push(migration.name);\n }\n\n // Verify only the final deployed declaration, never intermediate historical targets.\n const final = migrations.at(-1);\n if (final?.desiredState !== undefined) {\n if (params.probe === \"rollback\") await executor({ text: \"BEGIN\" });\n try {\n assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: final.desiredState.from, to: final.desiredState.to, removals: final.desiredState.unmanagedRemovals, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n } finally {\n if (params.probe === \"rollback\") await executor({ text: \"ROLLBACK\" });\n }\n }\n return { applied, skipped };\n } });\n}\n\n// ─── Status ───────────────────────────────────────────────────────\n\n/** Compare known migrations against the bookkeeping table. */\nexport async function migrationStatus(params: {\n executor: SqlExecutor;\n migrations: readonly MigrationFile[];\n /** Bookkeeping dialect; postgres if omitted. */\n dialect?: Dialect;\n /** Trusted current deployment; policy state is verified independently of migration records. */\n schema?: SchemaIR;\n}): Promise<MigrationStatus> {\n const { executor, migrations } = params;\n const dialect = params.dialect ?? \"postgres\";\n // No lock or journal creation: status stays nonblocking and read-only.\n const recorded = await recordedRows({ executor, dialect, modules: migrations.some((migration) => migration.moduleOrigin !== undefined) });\n\n const applied: string[] = [];\n const pending: string[] = [];\n const mismatched: string[] = [];\n const rollingBack: string[] = [];\n const known = new Set(migrations.map((migration) => migration.name));\n const unknownFiles: string[] = [];\n for (const [name, stored] of recorded) {\n if (!known.has(name)) {\n unknownFiles.push(name);\n if (stored.statementIndex < 0) rollingBack.push(name);\n }\n }\n\n for (const migration of migrations) {\n const stored = recorded.get(migration.name);\n if (stored === undefined) {\n pending.push(migration.name);\n continue;\n }\n if (stored.statementIndex < 0) {\n rollingBack.push(migration.name);\n continue;\n }\n if (stored.checksum === \"\" && stored.error === undefined) {\n applied.push(migration.name);\n continue;\n }\n if (stored.checksum !== \"\" && stored.checksum !== checksumOf({ migration })) {\n mismatched.push(migration.name);\n continue;\n }\n // A partial row re-applies (resumes) — report it as pending. The SAME\n // predicate apply uses: reporting a partial self-managed sqlite record as\n // \"applied\" while apply would resume it is a lie about the database.\n if (isCompleteRecord({ dialect, migration, stored }) && stored.error === undefined) applied.push(migration.name);\n else pending.push(migration.name);\n }\n\n if (dialect === \"postgres\") {\n const expected = params.schema ?? [...migrations].reverse().find((migration) => applied.includes(migration.name) && migration.rls !== undefined)?.rls?.to;\n await introspectPostgres({ executor, ...(expected === undefined ? {} : { rlsSchema: expected }), requireInstalledRls: true });\n }\n return { applied, pending, mismatched, rollingBack, ...(unknownFiles.length === 0 ? {} : { unknownFiles }) };\n}\n\n/**\n * The bookkeeping journal itself, in the order rows were written — i.e. the\n * order migrations were actually applied, which is what a rollback must walk\n * backwards. Every row is returned with its checksum, cursor and classification;\n * mismatched, partial and fileless rows still occupy their position in history.\n *\n * Takes no lock, exactly like `migrationStatus`.\n */\nexport async function recordedMigrations(params: {\n executor: SqlExecutor;\n /** Known migration files — classification needs their SQL. */\n migrations: readonly MigrationFile[];\n /** Bookkeeping dialect; postgres if omitted. */\n dialect?: Dialect;\n}): Promise<RecordedMigration[]> {\n const { executor, migrations } = params;\n const dialect = params.dialect ?? \"postgres\";\n const recorded = await recordedRows({ executor, dialect, modules: migrations.some((migration) => migration.moduleOrigin !== undefined) });\n return classifyJournal({ dialect, migrations, recorded });\n}\n\n/** Shared journal classification; history imports this, never the reverse. */\nexport function classifyJournal(params: { dialect: Dialect; migrations: readonly MigrationFile[]; recorded: ReadonlyMap<string, JournalRow> }): RecordedMigration[] {\n const { dialect, migrations, recorded } = params;\n const byName = new Map(migrations.map((migration) => [migration.name, migration]));\n\n const journal: RecordedMigration[] = [];\n for (const [name, stored] of recorded) {\n const migration = byName.get(name);\n journal.push({\n name,\n checksum: stored.checksum,\n statementIndex: stored.statementIndex,\n state:\n migration === undefined\n ? \"unknown-file\"\n : stored.checksum !== \"\" && stored.checksum !== checksumOf({ migration })\n ? \"mismatched\"\n : stored.statementIndex < 0\n ? \"rolling-back\"\n : isCompleteRecord({ dialect, migration, stored }) && stored.error === undefined\n ? \"applied\"\n : \"partial\",\n });\n }\n return journal;\n}\n\n// ─── Resolve (repair) ─────────────────────────────────────────────\n\n/**\n * Repair the bookkeeping table without running SQL: mark a migration as\n * `\"applied\"` (upsert its record; pass `checksum` to also pin its content —\n * omitted, the record stores an empty checksum and later runs skip\n * verification for it) or `\"rolled-back\"` (delete its record).\n */\nexport async function resolveMigration(params: {\n executor: SqlExecutor;\n name: string;\n as: \"applied\" | \"rolled-back\";\n checksum?: string;\n /** Bookkeeping dialect; postgres if omitted. */\n dialect?: Dialect;\n}): Promise<void> {\n const dialect = params.dialect ?? \"postgres\";\n await withMigrationLock({ executor: params.executor, dialect, run: (executor) => repairMigration({ ...params, executor, dialect }) });\n}\n\nasync function repairMigration(params: {\n executor: SqlExecutor;\n name: string;\n as: \"applied\" | \"rolled-back\";\n checksum?: string;\n dialect: Dialect;\n}): Promise<void> {\n const { executor, name, dialect } = params;\n const moduleRecord = (await readModuleJournal({ executor, dialect })).get(name);\n if (moduleRecord?.entry !== undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Module history cannot be marked applied or deleted without verified module recovery\", meta: { reason: \"module-resolution-required\", moduleId: moduleRecord.entry.migration.moduleOrigin!.moduleId } });\n await ensureMigrationsTable({ executor, dialect });\n\n if (params.as === \"applied\") {\n const insert = `INSERT INTO ${q(dialect, MIGRATIONS_TABLE_NAME)} (${q(dialect, \"name\")}, ${q(dialect, \"checksum\")}, ${q(dialect, \"statement_index\")}) VALUES (${ph(dialect, 1)}, ${ph(dialect, 2)}, ${RESOLVED_STATEMENT_INDEX})`;\n // `error` is cleared on every dialect. That column also carries the\n // in-flight marker, and a repaired record still reading \"VIBE_INFLIGHT:2\"\n // would show a migration recorded as applied as though it were stuck\n // mid-statement.\n const upsert =\n dialect === \"mysql\"\n ? `${insert} ON DUPLICATE KEY UPDATE \\`checksum\\` = VALUES(\\`checksum\\`), \\`statement_index\\` = VALUES(\\`statement_index\\`), \\`error\\` = NULL`\n : `${insert} ON CONFLICT (\"name\") DO UPDATE SET \"checksum\" = EXCLUDED.\"checksum\", \"statement_index\" = EXCLUDED.\"statement_index\", \"error\" = NULL`;\n await executor({ text: upsert, values: [name, params.checksum ?? \"\"] });\n return;\n }\n await executor({\n text: `DELETE FROM ${q(dialect, MIGRATIONS_TABLE_NAME)} WHERE ${q(dialect, \"name\")} = ${ph(dialect, 1)}`,\n values: [name],\n });\n}\n\n// ─── Rollback ─────────────────────────────────────────────────────\n\n/**\n * Roll back ONE applied migration by executing its `downSql` and deleting its\n * bookkeeping row, under the same advisory lock as `applyMigrations`.\n *\n * Guards, in order: the migration must carry `downSql` (older migrations\n * predate down-migration support), must be recorded as applied, and — when\n * the record pins a checksum — its up SQL must still match (rolling back with\n * drifted files would run a down that no longer mirrors what was applied).\n *\n * Dialect behavior mirrors apply exactly (same `usesStatementBookkeeping`\n * predicate, read over the DOWN script): postgres/sqlite run the down inside\n * BEGIN/COMMIT with the bookkeeping DELETE (atomic). mysql DDL auto-commits,\n * and a sqlite down containing a table-rebuild block cannot be wrapped, so\n * both record progress per-statement in the existing `statement_index`\n * column, NEGATIVE to mark the rollback direction: after k down statements,\n * the row stores -(k+1). A failed rollback resumes from the recorded\n * statement on the next call; `applyMigrations` refuses a mid-rollback record\n * (that check reads the sign only, so it holds for every dialect). A\n * partially APPLIED migration cannot be rolled back — its down mirrors the\n * full up; finish applying (apply resumes) or repair with `resolveMigration`.\n */\ntype RollbackOptions = {\n executor: SqlExecutor;\n acceptSecurityChanges?: boolean;\n acceptIntegrityLoss?: boolean;\n probe?: \"none\" | \"rollback\" | \"temporary\";\n dialect?: Dialect;\n};\n\n/** Reverse one file only if it is still newest when the lock is acquired. */\nexport async function rollbackMigration(params: RollbackOptions & { migration: MigrationFile }): Promise<void> {\n const { executor, migration } = params;\n const dialect = params.dialect ?? \"postgres\";\n const downSql = validateRollbackFile({ ...params, dialect });\n await withMigrationLock({ executor, dialect, run: async (executor) => {\n const recorded = await recordedRows({ executor, dialect, modules: true });\n const stored = assertRollbackRecord({ migration, stored: recorded.get(migration.name), dialect });\n const newest = [...recorded.keys()].at(-1);\n if (newest !== migration.name) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Migration \"${migration.name}\" is not the newest recorded migration; select rollback again`, meta: { reason: \"rollback-not-latest\", migration: migration.name, newest } });\n await validateRollbackRecovery({ executor, migration, downSql, stored, dialect });\n await executeRollback({ ...params, executor, dialect, downSql, stored });\n } });\n}\n\n/**\n * Select from the current journal under one lock. With to, retain that applied\n * migration and reverse every newer row; without it, reverse only the newest.\n * All selected declarations/approvals/progress are checked before any reversal.\n * A later SQL failure can still leave a successfully reversed prefix on disk.\n * SQLite cross-connection ownership remains the caller's responsibility.\n */\nexport async function rollbackMigrations(params: RollbackOptions & {\n migrations: readonly MigrationFile[];\n to?: string;\n}): Promise<RollbackResult> {\n const { executor, migrations } = params;\n const dialect = params.dialect ?? \"postgres\";\n assertDistinctMigrationNames({ migrations });\n return withMigrationLock({ executor, dialect, run: async (executor): Promise<RollbackResult> => {\n const recorded = await recordedRows({ executor, dialect, modules: true });\n const journal = classifyJournal({ migrations, recorded, dialect });\n const byName = new Map(migrations.map((migration) => [migration.name, migration]));\n let start = Math.max(0, journal.length - 1);\n if (params.to !== undefined) {\n const target = journal.findIndex((row) => row.name === params.to);\n const row = journal[target];\n if (row?.state !== \"applied\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Rollback target \"${params.to}\" is not a known applied migration`, meta: { reason: \"rollback-target-invalid\", to: params.to, state: row?.state } });\n assertMigrationMetadata({ migration: byName.get(row.name)!, dialect });\n start = target + 1;\n }\n const plan: { migration: MigrationFile; downSql: readonly string[]; stored: RecordedRow }[] = [];\n for (const row of journal.slice(start).reverse()) {\n const migration = byName.get(row.name);\n if (migration === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Cannot roll back \"${row.name}\" without its migration file`, meta: { reason: \"rollback-file-missing\", migration: row.name } });\n const stored = assertRollbackRecord({ migration, stored: recorded.get(row.name), dialect });\n const downSql = validateRollbackFile({ ...params, migration, dialect });\n plan.push({ migration, downSql, stored });\n }\n for (const entry of plan) await validateRollbackRecovery({ executor, dialect, ...entry });\n const rolledBack: string[] = [];\n for (const entry of plan) {\n await executeRollback({ ...params, executor, dialect, ...entry });\n rolledBack.push(entry.migration.name);\n }\n return { rolledBack };\n } });\n}\n\nfunction validateRollbackFile(params: RollbackOptions & { migration: MigrationFile; dialect: Dialect }): readonly string[] {\n const { migration, dialect } = params;\n if (migration.desiredStatePending === true) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Unfinalized desired state cannot be rolled back\", meta: { reason: \"desired-state-unfinalized\", migration: migration.name } });\n if (migration.moduleOrigin !== undefined) {\n assertMaterializedModuleMigration({ migration });\n assertModuleOwnership({ origin: migration.moduleOrigin, desiredState: migration.desiredState });\n }\n const downSql = migration.downSql;\n if (downSql === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `migration \"${migration.name}\" has no down.sql; roll it back manually, then repair with resolveMigration (as: \"rolled-back\")`, meta: { reason: \"rollback-down-missing\", migration: migration.name } });\n assertProbeMode({ dialect, probe: params.probe });\n if (migration.desiredState !== undefined) {\n assertDesiredState({ value: migration.desiredState, migration: migration.name });\n if (migration.desiredState.dialect !== dialect) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Migration desired-state dialect mismatch\", meta: { reason: \"desired-state-dialect-mismatch\" } });\n assertRemovalAuthorization({ steps: diffSchemas({ from: migration.desiredState.to.schema, to: (migration.desiredState.down ?? migration.desiredState.from).schema, dialect }), previous: migration.desiredState.to, dialect, namespace: dialect === \"sqlite\" ? \"main\" : \"public\", ...(params.acceptIntegrityLoss === undefined ? {} : { acceptIntegrityLoss: params.acceptIntegrityLoss }) });\n }\n assertNativeMigrationMetadata({ migration, sql: downSql, dialect });\n assertExecutable({ migration, execution: migration.downExecution, sql: downSql, dialect });\n assertSecurityAcknowledgement({ securityChanges: [...(migration.downSecurityChanges ?? []), ...migrationRlsSecurityChanges({ migration, down: true })], ...(params.acceptSecurityChanges === undefined ? {} : { acceptSecurityChanges: params.acceptSecurityChanges }) });\n if (dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: downSql })) assertSupportedSelfManagedScript({ sql: downSql, migration: migration.name, direction: \"down\" });\n return downSql;\n}\n\nfunction assertRollbackRecord(params: { migration: MigrationFile; stored?: RecordedRow; dialect: Dialect }): RecordedRow {\n const { migration, stored, dialect } = params;\n if (stored === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `migration \"${migration.name}\" is not recorded as applied; nothing to roll back`, meta: { migration: migration.name } });\n assertChecksumMatches({ migration, stored: stored.checksum });\n if (stored.statementIndex >= 0 && (!isCompleteRecord({ dialect, migration, stored }) || stored.error !== undefined)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `migration \"${migration.name}\" is only partially applied or has an unresolved error; its down mirrors the FULL up. Finish or repair with resolveMigration`, meta: { reason: \"rollback-partial-up\", migration: migration.name, statementIndex: stored.statementIndex } });\n return stored;\n}\n\nasync function validateRollbackRecovery(params: { executor: SqlExecutor; dialect: Dialect; migration: MigrationFile; downSql: readonly string[]; stored: RecordedRow }): Promise<void> {\n const { executor, dialect, migration, downSql, stored } = params;\n if (stored.statementIndex >= 0) return;\n const start = -stored.statementIndex - 1;\n if (start > downSql.length) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Rollback progress exceeds its statement count\", meta: { reason: \"rollback-progress-invalid\", migration: migration.name } });\n if (dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: downSql })) assertSelfManagedResumeSafe({ sql: downSql, start, migration: migration.name, direction: \"down\" });\n if (!marksInflight({ dialect, execution: migration.downExecution }) || start >= downSql.length) return;\n const operation = migration.downExecution?.transaction === \"none\" ? operationFor({ execution: migration.downExecution, statement: start }) : undefined;\n if (operation !== undefined) await establishOperationState({ executor, dialect, operation });\n else if (inflightStatement({ error: stored.error }) === start) throw uncertainStatement({ migration: migration.name, statements: downSql, index: start, dialect, direction: \"down\" });\n}\n\nasync function executeRollback(params: RollbackOptions & { migration: MigrationFile; dialect: Dialect; downSql: readonly string[]; stored: RecordedRow }): Promise<void> {\n const { executor, dialect, migration, downSql, stored } = params;\n const moduleOrigins = applicationModuleOrigins({ migration, records: await readModuleJournal({ executor, dialect }) });\n if (usesStatementBookkeeping({ dialect, sql: downSql, ...(migration.downExecution === undefined ? {} : { execution: migration.downExecution }) })) {\n const start = stored.statementIndex < 0 ? -stored.statementIndex - 1 : 0;\n await withSessionLimits({\n executor, dialect, execution: migration.downExecution,\n run: () => runNonTransactionalDown({ executor, dialect, migration, moduleOrigins, downSql, start, probe: params.probe, storedError: stored.error }),\n });\n } else await runTransactionalDown({ executor, dialect, migration, moduleOrigins, downSql, probe: params.probe });\n}\n\n/** Atomic down path (postgres, sqlite): statements + record DELETE in one tx. */\nasync function runTransactionalDown(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n migration: MigrationFile;\n moduleOrigins: readonly ModuleMigrationOrigin[];\n downSql: readonly string[];\n probe?: \"none\" | \"rollback\" | \"temporary\";\n}): Promise<void> {\n const { executor, dialect, migration, downSql } = params;\n const selfManaged = dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: downSql });\n const wrap = !selfManaged;\n\n if (wrap) await executor({ text: \"BEGIN\" });\n try {\n const limits = migration.downExecution;\n if (wrap && dialect === \"postgres\" && limits !== undefined) {\n if ((limits.lockTimeoutMs ?? 0) > 0) await executor({ text: renderMigrationSessionSet({ dialect: getSqlDialect({ dialect }), setting: \"lock_timeout\", milliseconds: limits.lockTimeoutMs as number, local: true }).text });\n if ((limits.statementTimeoutMs ?? 0) > 0) await executor({ text: renderMigrationSessionSet({ dialect: getSqlDialect({ dialect }), setting: \"statement_timeout\", milliseconds: limits.statementTimeoutMs as number, local: true }).text });\n }\n if (migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: migration.desiredState.from, to: migration.desiredState.to, removals: migration.desiredState.unmanagedRemovals, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n if (migration.rls !== undefined) await introspectPostgres({ executor, rlsSchema: migration.rls.to, inTransaction: true, requireInstalledRls: true });\n await assertApplicationModuleState({ executor, origins: params.moduleOrigins, probe: params.probe });\n for (const statement of downSql) {\n await executeStatement({ executor, statement, dialect });\n }\n if (migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: migration.desiredState.to, to: migration.desiredState.down ?? migration.desiredState.from, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n if (migration.rls !== undefined) await introspectPostgres({ executor, rlsSchema: migration.rls.from, inTransaction: true, requireInstalledRls: true });\n await assertApplicationModuleState({ executor, origins: params.moduleOrigins, probe: params.probe });\n await executor({\n text: `DELETE FROM ${q(dialect, MIGRATIONS_TABLE_NAME)} WHERE ${q(dialect, \"name\")} = ${ph(dialect, 1)}`,\n values: [migration.name],\n });\n if (wrap) await executor({ text: \"COMMIT\" });\n } catch (error) {\n if (wrap) {\n try {\n await executor({ text: \"ROLLBACK\" });\n } catch {\n // Rollback is best-effort; the original failure matters more.\n }\n } else {\n await cleanupSelfManagedFailure({ executor });\n }\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `rollback of \"${migration.name}\" failed: ${error instanceof Error ? error.message : String(error)}`,\n meta: { migration: migration.name, ...timeoutDiagnostic({ error }) },\n cause: error,\n });\n }\n}\n\n/**\n * Per-statement down path (mysql, and self-managed sqlite down scripts):\n * progress in `statement_index`, stored NEGATIVE (-(completed + 1)) so\n * apply/status can tell the direction apart.\n */\nasync function runNonTransactionalDown(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n migration: MigrationFile;\n moduleOrigins: readonly ModuleMigrationOrigin[];\n downSql: readonly string[];\n start: number;\n /** The journal row's `error` text when resuming — may hold an in-flight marker. */\n storedError?: string;\n probe?: \"none\" | \"rollback\" | \"temporary\";\n}): Promise<void> {\n const { executor, dialect, migration, downSql } = params;\n const table = q(dialect, MIGRATIONS_TABLE_NAME);\n const selfManagedDown = dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: downSql });\n // Same rule, same moment, in the down direction (see the up path above).\n if (selfManagedDown) {\n assertSupportedSelfManagedScript({ sql: downSql, migration: migration.name, direction: \"down\" });\n assertSelfManagedResumeSafe({ sql: downSql, start: params.start, migration: migration.name, direction: \"down\" });\n }\n const execution = migration.downExecution;\n const declared = execution?.transaction === \"none\";\n // Identical regime to the up direction: mysql always has the window, postgres\n // only when declared, sqlite closes it with a per-statement transaction.\n const marks = marksInflight({ dialect, ...(execution === undefined ? {} : { execution }) });\n const selfManaged = selfManagedDown;\n // A recorded index can point INSIDE a rebuild block, one past its\n // session-scoped pragma — rewind to the block's start (see execute.ts).\n const start = selfManaged\n ? selfManagedResumeStart({ sql: downSql, start: params.start })\n : params.start;\n\n const recordProgress = async (completed: number): Promise<void> => {\n await executor({\n text: `UPDATE ${table} SET ${q(dialect, \"statement_index\")} = ${ph(dialect, 1)}, ${q(dialect, \"error\")} = NULL WHERE ${q(dialect, \"name\")} = ${ph(dialect, 2)}`,\n values: [-(completed + 1), migration.name],\n });\n };\n\n // Same resume contract as the up direction: a down statement whose effect\n // cannot be established is never replayed automatically.\n const resumeOperation = marks && declared && start < downSql.length\n ? operationFor({ ...(execution === undefined ? {} : { execution }), statement: start })\n : undefined;\n\n // This refusal is checked BEFORE the \"rollback started\" write below, and the\n // order is the whole point: that write sets `error` to NULL and would take\n // the in-flight marker with it. A refusal thrown after it is SPENT — the\n // operator's next `migrate down` reads a clean row, finds nothing in flight\n // and replays the statement silently, which is the defect itself.\n if (\n marks\n && start < downSql.length\n && resumeOperation === undefined\n && inflightStatement({ ...(params.storedError === undefined ? {} : { error: params.storedError }) }) === start\n ) {\n throw uncertainStatement({ migration: migration.name, statements: downSql, index: start, dialect, direction: \"down\" });\n }\n\n // Probe before any write that could clear the interrupted statement's marker.\n const resumeState = resumeOperation === undefined ? undefined : await establishOperationState({ executor, dialect, operation: resumeOperation });\n\n await assertApplicationModuleState({ executor, origins: params.moduleOrigins, probe: params.probe });\n // Mark the rollback as started before the first statement runs, so a crash\n // between statements can never be mistaken for a completed apply.\n if (start === 0) {\n if (migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: migration.desiredState.from, to: migration.desiredState.to, removals: migration.desiredState.unmanagedRemovals, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n await recordProgress(0);\n }\n\n let cursor = start;\n if (\n resumeOperation !== undefined\n && resumeState === \"satisfied\"\n ) {\n if (start + 1 === downSql.length && migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: migration.desiredState.to, to: migration.desiredState.down ?? migration.desiredState.from, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n if (start + 1 === downSql.length) await assertApplicationModuleState({ executor, origins: params.moduleOrigins, probe: params.probe });\n await recordProgress(start + 1);\n cursor = start + 1;\n }\n\n for (let index = cursor; index < downSql.length; index += 1) {\n const atomic = selfManaged && canCheckpointAtomically({ sql: downSql, index });\n const commitsBlock = selfManaged && isSelfManagedCommit({ statement: downSql[index] as string });\n if (marks) {\n await executor({\n text: `UPDATE ${table} SET ${q(dialect, \"error\")} = ${ph(dialect, 1)} WHERE ${q(dialect, \"name\")} = ${ph(dialect, 2)}`,\n values: [`${INFLIGHT_PREFIX}${index}`, migration.name],\n });\n }\n if (atomic) await executor({ text: \"BEGIN\" });\n try {\n // Persist the index AFTER COMMIT in the transaction it describes. A kill\n // before COMMIT rolls back both; a kill after it cannot replay the block.\n if (commitsBlock) {\n if (migration.desiredState !== undefined && downSql.slice(index + 1).every((statement) => /^\\s*PRAGMA\\s+foreign_keys\\s*=\\s*ON\\s*;?\\s*$/i.test(statement))) assertMigrationState({ report: await verifySqliteTransitionBeforeRestore({ executor, dialect, from: migration.desiredState.to, to: migration.desiredState.down ?? migration.desiredState.from, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n await assertApplicationModuleState({ executor, origins: params.moduleOrigins, probe: params.probe, sqliteRestorePending: true });\n await recordProgress(index + 1);\n }\n await executeStatement({ executor, statement: downSql[index] as string, dialect });\n if (index === downSql.length - 1 && migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: migration.desiredState.to, to: migration.desiredState.down ?? migration.desiredState.from, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n if (index === downSql.length - 1) await assertApplicationModuleState({ executor, origins: params.moduleOrigins, probe: params.probe });\n if (atomic) {\n await recordProgress(index + 1);\n await executor({ text: \"COMMIT\" });\n }\n } catch (error) {\n // Self-managed scripts fail INSIDE their own transaction: close it first\n // or the error UPDATE below is rolled back with it (see the apply path).\n if (selfManaged) await cleanupSelfManagedFailure({ executor });\n try {\n await executor({\n text: `UPDATE ${table} SET ${q(dialect, \"error\")} = ${ph(dialect, 1)} WHERE ${q(dialect, \"name\")} = ${ph(dialect, 2)}`,\n values: [marks ? `${INFLIGHT_PREFIX}${index}` : error instanceof Error ? error.message : String(error), migration.name],\n });\n } catch {\n // Progress row update is best-effort; the original failure matters more.\n }\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `rollback of \"${migration.name}\" failed at down statement ${index + 1} of ${downSql.length}: ${error instanceof Error ? error.message : String(error)}. ${marks ? \"The statement outcome is unknown; inspect its effects before resolving or retrying.\" : \"Progress is recorded; re-running the rollback resumes from this statement.\"}`,\n meta: { migration: migration.name, statementIndex: index, ...(marks ? { outcome: \"unknown\" } : {}), ...timeoutDiagnostic({ error }) },\n cause: error,\n });\n }\n if (!atomic && !commitsBlock) await recordProgress(index + 1);\n }\n\n if (migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: migration.desiredState.to, to: migration.desiredState.down ?? migration.desiredState.from, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n await executor({\n text: `DELETE FROM ${table} WHERE ${q(dialect, \"name\")} = ${ph(dialect, 1)}`,\n values: [migration.name],\n });\n}\n\n// ─── Execution paths ──────────────────────────────────────────────\n\n/** Transactional path (postgres, sqlite) — see module doc. */\nasync function runTransactional(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n migration: MigrationFile;\n moduleOrigins: readonly ModuleMigrationOrigin[];\n probe?: \"none\" | \"rollback\" | \"temporary\";\n}): Promise<void> {\n const { executor, dialect, migration } = params;\n // sqlite rebuild scripts manage their own transactions — never wrap them.\n const selfManaged = dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: migration.sql });\n const wrap = !selfManaged;\n\n if (wrap) await executor({ text: \"BEGIN\" });\n try {\n // Declared limits ride the transaction itself here (SET LOCAL), so COMMIT\n // or ROLLBACK restores them with no separate bookkeeping.\n const limits = migration.execution;\n if (wrap && dialect === \"postgres\" && limits !== undefined) {\n if ((limits.lockTimeoutMs ?? 0) > 0) await executor({ text: renderMigrationSessionSet({ dialect: getSqlDialect({ dialect }), setting: \"lock_timeout\", milliseconds: limits.lockTimeoutMs as number, local: true }).text });\n if ((limits.statementTimeoutMs ?? 0) > 0) await executor({ text: renderMigrationSessionSet({ dialect: getSqlDialect({ dialect }), setting: \"statement_timeout\", milliseconds: limits.statementTimeoutMs as number, local: true }).text });\n }\n await assertForwardStart({ executor, dialect, migration, ...(params.probe === undefined ? {} : { probe: params.probe }) });\n await assertApplicationModuleState({ executor, origins: params.moduleOrigins, probe: params.probe });\n if (migration.rls !== undefined) await introspectPostgres({ executor, rlsSchema: migration.rls.from, inTransaction: true, requireInstalledRls: true });\n let statementIndex = 0;\n for (const statement of migration.sql) {\n await executeStatement({ executor, statement, dialect });\n statementIndex += 1;\n }\n if (migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, from: migration.desiredState.from, to: migration.desiredState.to, removals: migration.desiredState.unmanagedRemovals, dialect, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n if (migration.rls !== undefined) await introspectPostgres({ executor, rlsSchema: migration.rls.to, inTransaction: true, requireInstalledRls: true });\n await assertApplicationModuleState({ executor, origins: params.moduleOrigins, probe: params.probe });\n if (migration.moduleOrigin !== undefined) await insertModuleJournal({ executor, dialect, migration, index: statementIndex, complete: true });\n else await executor({\n text: `INSERT INTO ${q(dialect, MIGRATIONS_TABLE_NAME)} (${q(dialect, \"name\")}, ${q(dialect, \"checksum\")}, ${q(dialect, \"statement_index\")}) VALUES (${ph(dialect, 1)}, ${ph(dialect, 2)}, ${ph(dialect, 3)})`,\n values: [migration.name, checksumOf({ migration }), statementIndex],\n });\n if (wrap) await executor({ text: \"COMMIT\" });\n } catch (error) {\n if (wrap) {\n try {\n await executor({ text: \"ROLLBACK\" });\n } catch {\n // Rollback is best-effort; the original failure matters more.\n }\n } else {\n await cleanupSelfManagedFailure({ executor });\n }\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `migration \"${migration.name}\" failed: ${error instanceof Error ? error.message : String(error)}`,\n meta: { migration: migration.name },\n cause: error,\n });\n }\n}\n\n/**\n * Per-statement path (mysql — DDL auto-commits — and self-managed sqlite\n * scripts, which cannot be wrapped): per-statement progress in the\n * bookkeeping row; failures record the error and later runs resume.\n */\nasync function runNonTransactional(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n migration: MigrationFile;\n moduleOrigins: readonly ModuleMigrationOrigin[];\n start: number;\n insertRecord: boolean;\n /** The journal row's `error` text when resuming — may hold an in-flight marker. */\n storedError?: string;\n probe?: \"none\" | \"rollback\" | \"temporary\";\n}): Promise<void> {\n const { executor, dialect, migration, insertRecord } = params;\n const table = q(dialect, MIGRATIONS_TABLE_NAME);\n const selfManaged = dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: migration.sql });\n // Before the journal row, before the first statement: a self-managed script\n // is only recoverable in the shape the generator emits (execute.ts). This\n // sits HERE rather than up front with the other validations so that a\n // deviant migration already recorded as applied cannot wedge `migrate apply`\n // for the whole history — a record repaired with `resolveMigration` skips\n // before reaching this point, which is the operator's way out.\n if (selfManaged) {\n assertSupportedSelfManagedScript({ sql: migration.sql, migration: migration.name, direction: \"up\" });\n assertSelfManagedResumeSafe({ sql: migration.sql, start: params.start, migration: migration.name, direction: \"up\" });\n }\n const execution = migration.execution;\n const declared = execution?.transaction === \"none\";\n // mysql has this window whether or not anyone declared anything; postgres\n // only when the migration opted out of transactions. sqlite closes it instead\n // of recording it (see the atomic checkpoint below).\n const marks = marksInflight({ dialect, ...(execution === undefined ? {} : { execution }) });\n // A recorded index can point INSIDE a rebuild block, one past its\n // session-scoped `PRAGMA foreign_keys=OFF` — resuming there would replay the\n // rebuild (DROP TABLE included) with foreign keys ON. Rewind to the block.\n const start = selfManaged\n ? selfManagedResumeStart({ sql: migration.sql, start: params.start })\n : params.start;\n\n await assertApplicationModuleState({ executor, origins: params.moduleOrigins, probe: params.probe });\n if (insertRecord) {\n if (migration.desiredState !== undefined) {\n await assertForwardStart({ executor, dialect, migration, ...(params.probe === undefined ? {} : { probe: params.probe }) });\n if (migration.sql.length === 0) assertMigrationState({ report: await verifyMigrationTransition({ executor, from: migration.desiredState.from, to: migration.desiredState.to, removals: migration.desiredState.unmanagedRemovals, dialect, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n }\n if (migration.moduleOrigin !== undefined) await insertModuleJournal({ executor, dialect, migration, index: 0, complete: false });\n else await executor({\n text: `INSERT INTO ${table} (${q(dialect, \"name\")}, ${q(dialect, \"checksum\")}, ${q(dialect, \"statement_index\")}) VALUES (${ph(dialect, 1)}, ${ph(dialect, 2)}, 0)`,\n values: [migration.name, checksumOf({ migration })],\n });\n }\n\n const checkpoint = async (completed: number): Promise<void> => {\n await executor({\n text: `UPDATE ${table} SET ${q(dialect, \"statement_index\")} = ${ph(dialect, 1)}, ${q(dialect, \"error\")} = NULL WHERE ${q(dialect, \"name\")} = ${ph(dialect, 2)}`,\n values: [completed, migration.name],\n });\n };\n\n // RESUME: establish what happened to the statement we stopped on, before\n // touching the database again. This is the whole point of the declared\n // regime — a statement whose effect cannot be established is never replayed.\n let cursor = start;\n if (marks && !insertRecord && start < migration.sql.length) {\n // Declared operations exist on postgres only — they are the one way a\n // statement's outcome can be READ back instead of guessed.\n const operation = declared ? operationFor({ ...(execution === undefined ? {} : { execution }), statement: start }) : undefined;\n if (operation !== undefined) {\n const state = await establishOperationState({ executor, dialect, operation });\n if (state === \"satisfied\") {\n if (start + 1 === migration.sql.length && migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, dialect, from: migration.desiredState.from, to: migration.desiredState.to, removals: migration.desiredState.unmanagedRemovals, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n if (start + 1 === migration.sql.length) await assertApplicationModuleState({ executor, origins: params.moduleOrigins, probe: params.probe });\n await checkpoint(start + 1);\n cursor = start + 1;\n }\n } else if (inflightStatement({ ...(params.storedError === undefined ? {} : { error: params.storedError }) }) === start) {\n throw uncertainStatement({ migration: migration.name, statements: migration.sql, index: start, dialect, direction: \"up\" });\n }\n }\n\n for (let index = cursor; index < migration.sql.length; index += 1) {\n // sqlite: hold the statement and its checkpoint in ONE transaction, so the\n // gap never opens. Either both landed or neither did.\n const atomic = selfManaged && canCheckpointAtomically({ sql: migration.sql, index });\n const commitsBlock = selfManaged && isSelfManagedCommit({ statement: migration.sql[index] as string });\n // Record the intent to run BEFORE running it, so a crash in the gap\n // between the statement committing and its checkpoint is distinguishable\n // from a statement that never started.\n if (marks) {\n await executor({\n text: `UPDATE ${table} SET ${q(dialect, \"error\")} = ${ph(dialect, 1)} WHERE ${q(dialect, \"name\")} = ${ph(dialect, 2)}`,\n values: [`${INFLIGHT_PREFIX}${index}`, migration.name],\n });\n }\n if (atomic) await executor({ text: \"BEGIN\" });\n try {\n // Same atomic commit checkpoint as the down direction above.\n if (commitsBlock) {\n if (migration.desiredState !== undefined && migration.sql.slice(index + 1).every((statement) => /^\\s*PRAGMA\\s+foreign_keys\\s*=\\s*ON\\s*;?\\s*$/i.test(statement))) assertMigrationState({ report: await verifySqliteTransitionBeforeRestore({ executor, dialect, from: migration.desiredState.from, to: migration.desiredState.to, removals: migration.desiredState.unmanagedRemovals, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n await assertApplicationModuleState({ executor, origins: params.moduleOrigins, probe: params.probe, sqliteRestorePending: true });\n await checkpoint(index + 1);\n }\n await executeStatement({ executor, statement: migration.sql[index] as string, dialect });\n if (index === migration.sql.length - 1 && migration.desiredState !== undefined) assertMigrationState({ report: await verifyMigrationTransition({ executor, from: migration.desiredState.from, to: migration.desiredState.to, removals: migration.desiredState.unmanagedRemovals, dialect, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n if (index === migration.sql.length - 1) await assertApplicationModuleState({ executor, origins: params.moduleOrigins, probe: params.probe });\n if (atomic) {\n await checkpoint(index + 1);\n await executor({ text: \"COMMIT\" });\n }\n } catch (error) {\n // A self-managed script fails INSIDE its own BEGIN, with foreign_keys\n // OFF. Close that transaction FIRST: otherwise the error UPDATE below\n // joins it and is rolled back with it, and the session keeps running\n // inside a stale transaction (every later statement on this connection).\n if (selfManaged) await cleanupSelfManagedFailure({ executor });\n // Record the failure (best-effort) — statement_index already points at\n // the failed statement, so a re-run resumes exactly here.\n try {\n await executor({\n text: `UPDATE ${table} SET ${q(dialect, \"error\")} = ${ph(dialect, 1)} WHERE ${q(dialect, \"name\")} = ${ph(dialect, 2)}`,\n values: [marks ? `${INFLIGHT_PREFIX}${index}` : error instanceof Error ? error.message : String(error), migration.name],\n });\n } catch {\n // Progress row update is best-effort; the original failure matters more.\n }\n const sqlState = sqlStateOf(error);\n const timeout = sqlState === \"55P03\" ? \"lock-timeout\" : sqlState === \"57014\" ? \"statement-timeout\" : undefined;\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: timeout === \"lock-timeout\"\n ? `migration \"${migration.name}\" gave up waiting for a lock at statement ${index + 1} of ${migration.sql.length} (lock_timeout ${String(execution?.lockTimeoutMs ?? 0)}ms, SQLSTATE 55P03). Another session holds a conflicting lock; inspect the declared operation before retrying.`\n : timeout === \"statement-timeout\"\n ? `migration \"${migration.name}\" exceeded its statement_timeout at statement ${index + 1} of ${migration.sql.length} (${String(execution?.statementTimeoutMs ?? 0)}ms, SQLSTATE 57014). Inspect the declared operation before retrying.`\n : `migration \"${migration.name}\" failed at statement ${index + 1} of ${migration.sql.length}: ${error instanceof Error ? error.message : String(error)}. ${marks ? \"The statement outcome is unknown; inspect its effects before resolving or retrying.\" : \"Progress is recorded; re-running applyMigrations resumes from this statement.\"}`,\n meta: { migration: migration.name, statementIndex: index, ...(marks ? { outcome: \"unknown\" } : {}), ...(timeout === undefined ? {} : { reason: timeout, sqlState }) },\n cause: error,\n });\n }\n if (!atomic && !commitsBlock) await checkpoint(index + 1);\n }\n if (migration.moduleOrigin !== undefined) {\n assertMigrationState({ report: await verifyMigrationState({ executor, dialect, expected: migration.desiredState!.to }) });\n await completeModuleJournal({ executor, dialect, migration });\n }\n}\n\n// ─── Advisory locks ───────────────────────────────────────────────\n\nasync function acquireLock(params: { executor: SqlExecutor; dialect: Dialect }): Promise<void> {\n const { executor, dialect } = params;\n if (dialect === \"postgres\") {\n await executor({ text: `SELECT pg_advisory_lock(${PG_ADVISORY_LOCK_KEY})` });\n return;\n }\n if (dialect === \"mysql\") {\n // values: [] forces the row-returning executor path (adapter contract:\n // value-less text may run as a row-less batch statement).\n const rows = await executor({\n text: `SELECT GET_LOCK('${MYSQL_LOCK_NAME}', ${MYSQL_LOCK_TIMEOUT_SECONDS}) AS \\`vibe_lock\\``,\n values: [],\n });\n const acquired = Number(rows[0]?.vibe_lock) === 1;\n if (!acquired) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `could not acquire the migration lock ('${MYSQL_LOCK_NAME}') within ${MYSQL_LOCK_TIMEOUT_SECONDS}s — another migration run is in progress`,\n meta: { lock: MYSQL_LOCK_NAME },\n });\n }\n }\n // SQLite has no advisory lock here. Individual BEGINs do not protect a\n // whole self-managed run; callers must provide cross-connection ownership.\n}\n\nasync function releaseLock(params: { executor: SqlExecutor; dialect: Dialect }): Promise<void> {\n const { executor, dialect } = params;\n if (dialect === \"postgres\") {\n await executor({ text: `SELECT pg_advisory_unlock(${PG_ADVISORY_LOCK_KEY})` });\n } else if (dialect === \"mysql\") {\n await executor({ text: `SELECT RELEASE_LOCK('${MYSQL_LOCK_NAME}')` });\n }\n}\n\n// ─── Internals ────────────────────────────────────────────────────\n\ntype RecordedRow = JournalRow;\n\n// ─── Declared execution semantics ────────────────────────────\n\n/**\n * Sentinel written into the EXISTING nullable `error` column before a\n * statement of a declared-nontransactional migration runs, and cleared by that\n * statement's success checkpoint.\n *\n * Reusing `error` is deliberate: the column has been in all three dialects'\n * CREATE TABLE since the journal was introduced, so no installed database\n * needs migrating and an older binary reading the row simply sees a string it\n * reports as an error. There is no on-disk format change.\n */\nconst INFLIGHT_PREFIX = \"VIBE_INFLIGHT:\";\n\n/**\n * The statement index an in-flight marker refers to, if the stored text is one.\n *\n * The whole remainder must be digits. A driver error message that merely opens\n * with the sentinel is an ERROR, and reading it as a marker would stop a\n * migration that is safe to resume.\n */\nfunction inflightStatement(params: { error?: string }): number | undefined {\n const error = params.error;\n if (error === undefined || !error.startsWith(INFLIGHT_PREFIX)) return undefined;\n const digits = error.slice(INFLIGHT_PREFIX.length);\n if (!/^\\d+$/.test(digits)) return undefined;\n const index = Number.parseInt(digits, 10);\n return Number.isSafeInteger(index) ? index : undefined;\n}\n\n/**\n * Does this (dialect, script) pair have a window between a statement\n * committing and its journal checkpoint that nothing can close?\n *\n * - **mysql: yes, always.** Every statement auto-commits on its own, DDL\n * unconditionally, and no transaction can hold a statement and its checkpoint\n * together. Nobody has to declare anything for the window to exist.\n * - **postgres: only when the migration declared `transaction: \"none\"`.**\n * Otherwise the migration and its journal row are one transaction.\n * - **sqlite: no.** A self-managed script's statements are covered either by\n * their rebuild block's own transaction or by the per-statement transaction\n * {@link canCheckpointAtomically} authorises, and any other sqlite script\n * runs wholly inside `runTransactional`.\n *\n * Where the answer is yes, an in-flight marker is written before the statement\n * runs and cleared by its checkpoint, so a resume can tell \"this statement was\n * running when we died\" from \"this statement never started\".\n */\nfunction marksInflight(params: { dialect: Dialect; execution?: MigrationExecution }): boolean {\n return params.execution?.transaction === \"none\" || params.dialect === \"mysql\";\n}\n\n/**\n * The refusal a still-present in-flight marker produces: this statement was\n * running when the process died, and nothing in the database says whether it\n * committed.\n *\n * Replaying it is the one thing that must not happen automatically. A DDL\n * replay usually fails loudly, but `CREATE TABLE IF NOT EXISTS` and its\n * siblings do not, and a data statement such as `UPDATE t SET n = n + 1`\n * applies twice in silence. So the runner stops and hands the decision to an\n * operator, who can see the rows and VibeORM cannot.\n */\nfunction uncertainStatement(params: {\n migration: string;\n statements: readonly string[];\n index: number;\n dialect: Dialect;\n direction: \"up\" | \"down\";\n}): VibeError {\n const { migration, statements, index, dialect, direction } = params;\n const subject = direction === \"down\" ? `rollback of \"${migration}\"` : `migration \"${migration}\"`;\n const position = `${direction === \"down\" ? \"down statement\" : \"statement\"} ${index + 1} of ${statements.length}`;\n const why =\n dialect === \"mysql\"\n ? \"MySQL commits every statement on its own, so nothing outside the statement records whether it finished.\"\n : \"That statement declares no operation whose effect recovery can read back from the catalog.\";\n return new VibeError({\n code: \"VIBE_MIGRATION\",\n message:\n `${subject} was interrupted while ${position} was running. ${why} ` +\n \"It may or may not have committed, and replaying it could apply it twice, so VibeORM stops here instead of guessing. \" +\n \"Inspect what that statement did to the database, then follow \\\"Recovering from a stopped migration\\\" in docs/migrations.md: \" +\n `clear the \\`error\\` column of this migration's journal row if the statement did NOT land, set \\`statement_index\\` to ${direction === \"down\" ? -(index + 2) : index + 1} if it DID, ` +\n \"or finish the whole migration by hand and record that with `vibeorm migrate resolve --applied`. \" +\n `The statement was: ${(statements[index] as string).slice(0, 200)}`,\n meta: {\n reason: \"uncertain-statement\",\n outcome: \"unknown\",\n migration,\n statementIndex: index,\n ...(direction === \"down\" ? { direction } : {}),\n },\n });\n}\n\n/**\n * Validate a migration's declared execution block and refuse the combinations\n * no dialect can honour — at apply time, which is the earliest moment the\n * dialect is known.\n *\n * `transaction: \"none\"` is a PostgreSQL concept here. sqlite and mysql have no\n * separate nontransactional regime to opt into: mysql's DDL auto-commits\n * already, and a sqlite script either wraps or manages its own transactions.\n * Silently accepting the flag there would promise a guarantee that is not\n * being made.\n */\nfunction assertExecutable(params: {\n migration: MigrationFile;\n execution?: MigrationExecution;\n sql: readonly string[];\n dialect: Dialect;\n}): void {\n const { migration, execution, dialect } = params;\n assertValidExecution({ ...(execution === undefined ? {} : { execution }), statements: params.sql.length, migration: migration.name });\n if (execution === undefined || isDefaultExecution({ execution })) return;\n if (dialect !== \"postgres\") {\n throw new VibeError({\n code: \"VIBE_UNSUPPORTED_CAPABILITY\",\n message: `migration \"${migration.name}\" declares explicit execution semantics (transaction: \"${execution.transaction}\"), which only the postgres runner implements — ${dialect} has no separate nontransactional regime to opt into`,\n meta: { reason: \"nontransactional-unsupported\", dialect, migration: migration.name, feature: \"nontransactionalMigrations\" },\n });\n }\n}\n\n/** SQLSTATE of a driver error, however deeply the adapter wrapped it. */\nfunction sqlStateOf(error: unknown): string | undefined {\n let current: unknown = error;\n for (let depth = 0; depth < 5 && current !== null && typeof current === \"object\"; depth += 1) {\n const code = (current as { code?: unknown }).code;\n if (typeof code === \"string\" && /^[0-9A-Z]{5}$/.test(code)) return code;\n current = (current as { cause?: unknown }).cause;\n }\n return undefined;\n}\n\n/** Migration-owned limits, applied to the pinned session and restored after. */\nasync function withSessionLimits<T>(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n execution?: MigrationExecution;\n run: () => Promise<T>;\n}): Promise<T> {\n const { executor, dialect, execution } = params;\n const lock = execution?.lockTimeoutMs ?? 0;\n const statement = execution?.statementTimeoutMs ?? 0;\n if (dialect !== \"postgres\" || (lock === 0 && statement === 0)) return params.run();\n\n const sqlDialect = getSqlDialect({ dialect });\n const previous = (await executor({ text: renderMigrationSessionRead({ dialect: sqlDialect }).text, values: [] }))[0];\n if (lock > 0) await executor({ text: renderMigrationSessionSet({ dialect: sqlDialect, setting: \"lock_timeout\", milliseconds: lock }).text });\n if (statement > 0) await executor({ text: renderMigrationSessionSet({ dialect: sqlDialect, setting: \"statement_timeout\", milliseconds: statement }).text });\n try {\n return await params.run();\n } finally {\n // Restore what the session had, not a guessed default: this connection is\n // pinned for the whole migrate operation and outlives one migration.\n for (const [setting, value] of [[\"lock_timeout\", previous?.lockTimeout], [\"statement_timeout\", previous?.statementTimeout]] as const) {\n if (setting === \"lock_timeout\" ? lock === 0 : statement === 0) continue;\n try {\n await executor({ text: renderMigrationSessionRestore({ dialect: sqlDialect, setting, value: typeof value === \"string\" ? value : \"\" }).text });\n } catch {\n // Restoring is best-effort; the original outcome matters more.\n }\n }\n }\n}\n\n/**\n * Which bookkeeping regime a (dialect, script) pair runs in: `true` when\n * progress is recorded PER STATEMENT — mysql (DDL auto-commits) and sqlite\n * scripts that manage their own transactions — `false` when the migration and\n * its record are one atomic unit.\n *\n * ONE predicate on purpose. Spelled per call site it was wrong in three places\n * at once: status called a partial self-managed record \"applied\", rollback's\n * partial-up guard went blind on sqlite, and apply wedged the migration.\n */\nfunction usesStatementBookkeeping(params: {\n dialect: Dialect;\n sql: readonly string[];\n execution?: MigrationExecution;\n}): boolean {\n const { dialect, sql } = params;\n // A migration that declares it runs outside a transaction cannot have an\n // atomic bookkeeping INSERT: there is no transaction for the record to join.\n // This clause fires ONLY on an explicit declaration, so mysql and\n // self-managed sqlite scripts keep exactly the two rules they always had.\n if (params.execution?.transaction === \"none\") return true;\n if (!DIALECT_CAPABILITIES[dialect].transactionalDdl) return true;\n return dialect === \"sqlite\" && usesSelfManagedTransactions({ sql });\n}\n\n/**\n * Is a bookkeeping row a COMPLETE application of its migration?\n *\n * Atomic regime: the row exists at all ⇒ the whole migration ran. Per-statement\n * regime: only once `statement_index` reached the statement count. An empty\n * checksum is a `resolveMigration` repair — complete by definition, content\n * unseen.\n *\n * Backward compatible with rows written before per-statement bookkeeping\n * covered self-managed sqlite scripts: `runTransactional` records\n * `statement_index = sql.length`, so those rows satisfy the last clause and\n * are never falsely resumed.\n */\nfunction isCompleteRecord(params: {\n dialect: Dialect;\n migration: MigrationFile;\n stored: RecordedRow;\n}): boolean {\n const { dialect, migration, stored } = params;\n if (migration.moduleOrigin !== undefined) return moduleRecordComplete({ migration, stored });\n if (stored.checksum === \"\") return true;\n if (!usesStatementBookkeeping({ dialect, sql: migration.sql, ...(migration.execution === undefined ? {} : { execution: migration.execution }) })) return true;\n return stored.statementIndex >= migration.sql.length;\n}\n\nasync function recordedRows(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n modules?: boolean;\n}): Promise<Map<string, RecordedRow>> {\n const { executor, dialect } = params;\n if (params.modules === true) return new Map([...(await readModuleJournal({ executor, dialect }))].map(([name, record]) => [name, record.row]));\n // values: [] forces the row-returning executor path (adapter contract:\n // value-less text may run as a row-less multi-statement batch on sqlite).\n const rows = await readJournalRows({ executor, dialect, query: {\n text: `SELECT ${q(dialect, \"name\")}, ${q(dialect, \"checksum\")}, ${q(dialect, \"statement_index\")}, ${q(dialect, \"error\")} FROM ${q(dialect, MIGRATIONS_TABLE_NAME)} ORDER BY ${q(dialect, \"id\")}`,\n values: [],\n } });\n return rows ?? new Map<string, RecordedRow>();\n}\n\nfunction assertChecksumMatches(params: { migration: MigrationFile; stored: string }): void {\n const { migration, stored } = params;\n if (stored === \"\") return; // resolveMigration record — content unknown by design.\n const actual = checksumOf({ migration });\n if (stored === actual) return;\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `checksum mismatch for migration \"${migration.name}\" — its SQL changed after it was applied (recorded ${stored.slice(0, 12)}…, current ${actual.slice(0, 12)}…)`,\n meta: { migration: migration.name, recorded: stored, current: actual },\n });\n}\n\nfunction assertResumable(params: { migration: MigrationFile; stored: RecordedRow }): void {\n const { migration, stored } = params;\n const actual = checksumOf({ migration });\n if (stored.checksum === actual) return;\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `migration \"${migration.name}\" is partially applied (${stored.statementIndex} statement(s) done) and its SQL has CHANGED since — refusing to resume; restore the original SQL or repair with resolveMigration`,\n meta: {\n migration: migration.name,\n statementIndex: stored.statementIndex,\n recorded: stored.checksum,\n current: actual,\n },\n });\n}\n\n/** Classify timeout diagnostics without treating cancellation as proof of no effects. */\nfunction timeoutDiagnostic(params: { error: unknown }): Record<string, unknown> {\n const sqlState = sqlStateOf(params.error);\n const reason = sqlState === \"55P03\" ? \"lock-timeout\" : sqlState === \"57014\" ? \"statement-timeout\" : undefined;\n return reason === undefined ? {} : { reason, sqlState };\n}\n\n/** Duplicate file identities cannot describe a replayable chain. */\nfunction assertDistinctMigrationNames(params: { migrations: readonly MigrationFile[] }): void {\n const names = new Set<string>();\n for (const migration of params.migrations) {\n if (names.has(migration.name)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Duplicate migration file identity \"${migration.name}\"`, meta: { reason: \"history-duplicate-file\", migration: migration.name } });\n names.add(migration.name);\n }\n}\n\n/** A complete chain must preserve journal order and append new work only. */\nfunction assertCompleteHistory(params: { migrations: readonly MigrationFile[]; recorded: ReadonlyMap<string, RecordedRow>; dialect: Dialect }): void {\n const byName = new Map(params.migrations.map((migration) => [migration.name, migration]));\n for (const name of params.recorded.keys()) {\n if (!byName.has(name)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Recorded migration \"${name}\" has no file in the complete chain`, meta: { reason: \"history-unknown-file\", migration: name } });\n }\n let index = 0;\n for (const [name, stored] of params.recorded) {\n const migration = params.migrations[index]!;\n if (migration?.name !== name) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Recorded migration order is not a prefix of the supplied complete chain\", meta: { reason: \"history-order-conflict\", migration: name, expected: migration?.name, position: index } });\n if (stored.statementIndex >= 0 && !isCompleteRecord({ dialect: params.dialect, migration, stored }) && index !== params.recorded.size - 1) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Partial migration \"${name}\" precedes later recorded work`, meta: { reason: \"history-partial-not-last\", migration: name } });\n index++;\n }\n}\n\n/** Validate all known identities and dirty journal rows before any migration runs. */\nasync function assertApplyHistory(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n migrations: readonly MigrationFile[];\n recorded: ReadonlyMap<string, RecordedRow>;\n}): Promise<void> {\n const { executor, dialect, migrations, recorded } = params;\n const byName = new Map(migrations.map((migration) => [migration.name, migration]));\n for (const [name, stored] of recorded) {\n if (stored.statementIndex < 0) {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Migration \"${name}\" is mid-rollback; finish or resolve it before applying`, meta: { reason: \"history-rolling-back\", migration: name, statementIndex: stored.statementIndex } });\n }\n const migration = byName.get(name);\n if (migration === undefined) {\n if (stored.error !== undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Migration \"${name}\" has an unresolved journal error but no supplied file`, meta: { reason: \"history-unknown-dirty\", migration: name } });\n continue; // Intentional programmatic subsets remain supported.\n }\n if (isCompleteRecord({ dialect, migration, stored }) && stored.error !== undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Migration \"${name}\" has an unresolved journal error`, meta: { reason: \"history-dirty\", migration: name } });\n if (isCompleteRecord({ dialect, migration, stored })) assertChecksumMatches({ migration, stored: stored.checksum });\n else assertResumable({ migration, stored });\n }\n for (const migration of migrations) {\n const stored = recorded.get(migration.name);\n if (stored === undefined || isCompleteRecord({ dialect, migration, stored })) continue;\n const start = stored.statementIndex;\n if (dialect === \"sqlite\" && usesSelfManagedTransactions({ sql: migration.sql })) {\n assertSupportedSelfManagedScript({ sql: migration.sql, migration: migration.name, direction: \"up\" });\n assertSelfManagedResumeSafe({ sql: migration.sql, start, migration: migration.name, direction: \"up\" });\n }\n if (!marksInflight({ dialect, execution: migration.execution }) || start >= migration.sql.length) continue;\n const operation = migration.execution?.transaction === \"none\" ? operationFor({ execution: migration.execution, statement: start }) : undefined;\n if (operation !== undefined) await establishOperationState({ executor, dialect, operation });\n else if (inflightStatement({ error: stored.error }) === start) throw uncertainStatement({ migration: migration.name, statements: migration.sql, index: start, dialect, direction: \"up\" });\n }\n}\n\n// ─── Quoting / placeholders ───────────────────────────────────────\n\nfunction q(dialect: Dialect, name: string): string {\n return getSqlDialect({ dialect }).quoteIdent({ name });\n}\n\nfunction ph(dialect: Dialect, index: number): string {\n return getSqlDialect({ dialect }).placeholder({ index });\n}\n",
|
|
42
38
|
"/**\n * Establishing what actually happened, before a nontransactional migration\n * re-runs anything.\n *\n * A migration that runs outside a transaction can die between a statement\n * committing and the journal recording it. The only honest recovery is to ask\n * the database what the world looks like now and compare it against the\n * statement's DECLARED postcondition (execution.ts). Three answers exist:\n *\n * - `\"satisfied\"` — the live catalog already matches the declaration. Skip it.\n * - `\"runnable\"` — the declaration is demonstrably not in effect, and running\n * the statement is the way to get there.\n * - a thrown `VibeError` — the state is neither, and no automatic action is\n * safe. Nothing is dropped, nothing is re-run: the operator decides.\n *\n * There is deliberately NO fourth answer of the form \"probably fine, re-run\n * it\". This module never claims exactly-once execution of arbitrary SQL; it\n * only decides the cases a declared postcondition can actually settle.\n *\n * Comparison is conservative by design. Expressions must match verbatim apart\n * from surrounding whitespace. Quotes and whitespace inside literals can change\n * meaning; any difference is a CONFLICT — a false conflict costs an operator one\n * look, a false match corrupts a schema.\n */\n\nimport { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect } from \"@vibeorm/schema\";\nimport {\n getSqlDialect,\n renderColumnStateQuery,\n renderConstraintStateQuery,\n renderIndexStateQuery,\n renderRelationStateQuery,\n} from \"@vibeorm/sql\";\nimport { describeOperation } from \"./execution.ts\";\nimport type { MigrationOperation } from \"./execution.ts\";\nimport type { SqlExecutor } from \"./types.ts\";\n\n/** Name-only legacy metadata cannot establish a constraint's definition. */\nfunction constraintUnverifiable(params: {\n operation: Extract<MigrationOperation, { kind: \"addConstraintNotValid\" | \"validateConstraint\" }>;\n definition: unknown;\n}): VibeError {\n return conflict({\n reason: \"constraint-definition-unverifiable\",\n message: `Constraint \"${params.operation.constraint}\" on \"${params.operation.table}\" exists, but the migration declares no expected definition. Inspect its definition and resolve the interrupted statement before continuing.`,\n meta: { table: params.operation.table, constraint: params.operation.constraint, definition: params.definition },\n });\n}\n\n/** Whether a declared operation's postcondition already holds. */\nexport type OperationState = \"satisfied\" | \"runnable\";\n\nfunction conflict(params: { reason: string; message: string; meta?: Record<string, unknown> }): VibeError {\n return new VibeError({\n code: \"VIBE_MIGRATION\",\n message: params.message,\n meta: { reason: params.reason, ...params.meta },\n });\n}\n\n/** Driver booleans arrive as `true`, `\"t\"`, `1` or `\"true\"` depending on the adapter. */\nfunction truthy(value: unknown): boolean {\n if (typeof value === \"boolean\") return value;\n if (typeof value === \"number\") return value === 1;\n if (typeof value === \"string\") return value === \"t\" || value === \"true\" || value === \"1\";\n return false;\n}\n\n/** Preserve expression semantics; recovery must never guess equivalence. */\nfunction normalizeSql(value: string): string {\n return value.trim();\n}\n\nfunction sameShape(params: { live?: string | undefined; declared?: string | undefined }): boolean {\n const live = params.live === undefined || params.live === null ? \"\" : normalizeSql(params.live);\n const declared = params.declared === undefined ? \"\" : normalizeSql(params.declared);\n return live === declared;\n}\n\n/**\n * Ask the database whether a declared operation is already in effect.\n *\n * PostgreSQL only: it is the one dialect with a nontransactional migration\n * regime here, and every probe reads its catalogs.\n */\nexport async function establishOperationState(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n operation: MigrationOperation;\n}): Promise<OperationState> {\n const { executor, operation } = params;\n const dialect = getSqlDialect({ dialect: params.dialect });\n const run = async (query: { text: string; values: readonly unknown[] }): Promise<Record<string, unknown>[]> =>\n executor({ text: query.text, values: [...query.values] });\n\n switch (operation.kind) {\n case \"createIndexConcurrently\": {\n const rows = await run(renderIndexStateQuery({ dialect, index: operation.index }));\n const row = rows[0];\n if (row === undefined) return \"runnable\";\n // An INVALID index is the signature failure of CREATE INDEX\n // CONCURRENTLY: it exists, the planner ignores it, and writes still\n // maintain it. IF NOT EXISTS would call this success. Dropping it is a\n // deliberate operator decision, never something recovery does silently.\n if (!truthy(row.valid) || !truthy(row.ready)) {\n throw conflict({\n reason: \"index-invalid\",\n message: `index \"${operation.index}\" exists but is INVALID — a previous CREATE INDEX CONCURRENTLY did not finish. Nothing is dropped automatically: inspect it, then \\`DROP INDEX CONCURRENTLY \"${operation.index}\"\\` and re-run this migration. Definition: ${String(row.definition)}`,\n meta: { index: operation.index, definition: row.definition },\n });\n }\n const mismatch =\n String(row.table) !== operation.table\n ? `table ${String(row.table)} ≠ ${operation.table}`\n : truthy(row.unique) !== operation.unique\n ? `unique ${String(truthy(row.unique))} ≠ ${String(operation.unique)}`\n : String(row.method) !== operation.method\n ? `method ${String(row.method)} ≠ ${operation.method}`\n : !sameShape({ live: row.columns === null || row.columns === undefined ? \"\" : String(row.columns).split(\"\\n\").join(\", \"), declared: operation.columns.join(\", \") })\n ? `columns (${String(row.columns).split(\"\\n\").join(\", \")}) ≠ (${operation.columns.join(\", \")})`\n : !sameShape({ live: row.predicate === null || row.predicate === undefined ? \"\" : String(row.predicate), ...(operation.where === undefined ? {} : { declared: operation.where }) })\n ? `predicate ${String(row.predicate)} ≠ ${String(operation.where)}`\n : undefined;\n if (mismatch !== undefined) {\n throw conflict({\n reason: \"index-definition-conflict\",\n message: `index \"${operation.index}\" already exists with a DIFFERENT definition (${mismatch}) — this is a name collision, not a completed step. Nothing is dropped automatically. Live definition: ${String(row.definition)}`,\n meta: { index: operation.index, definition: row.definition, declared: describeOperation({ operation }) },\n });\n }\n return \"satisfied\";\n }\n\n case \"dropIndexConcurrently\": {\n const rows = await run(renderIndexStateQuery({ dialect, index: operation.index }));\n // Absent = done. Present (valid or invalid) = the drop is what removes\n // it; DROP INDEX CONCURRENTLY is the sanctioned cleanup for an index\n // this operation is explicitly declared to remove.\n return rows[0] === undefined ? \"satisfied\" : \"runnable\";\n }\n\n case \"addConstraintNotValid\": {\n const rows = await run(renderConstraintStateQuery({ dialect, table: operation.table, constraint: operation.constraint }));\n if (rows[0] === undefined) return \"runnable\";\n throw constraintUnverifiable({ operation, definition: rows[0].definition });\n }\n\n case \"validateConstraint\": {\n const rows = await run(renderConstraintStateQuery({ dialect, table: operation.table, constraint: operation.constraint }));\n const row = rows[0];\n if (row === undefined) {\n throw conflict({\n reason: \"constraint-missing\",\n message: `constraint \"${operation.constraint}\" on \"${operation.table}\" does not exist, so it cannot be validated — the staged NOT VALID step it belongs to is not in effect`,\n meta: { table: operation.table, constraint: operation.constraint },\n });\n }\n throw constraintUnverifiable({ operation, definition: row.definition });\n }\n\n case \"renameTable\": {\n const before = await run(renderRelationStateQuery({ dialect, table: operation.from }));\n const after = await run(renderRelationStateQuery({ dialect, table: operation.to }));\n if (before.length === 0 && after.length === 1) return \"satisfied\";\n if (before.length === 1 && after.length === 0) return \"runnable\";\n throw conflict({\n reason: \"rename-ambiguous\",\n message: before.length === 0\n ? `neither \"${operation.from}\" nor \"${operation.to}\" exists — the rename cannot be completed or verified from here`\n : `both \"${operation.from}\" and \"${operation.to}\" exist — refusing to guess which one holds the data`,\n meta: { from: operation.from, to: operation.to },\n });\n }\n\n case \"renameColumn\": {\n const before = await run(renderColumnStateQuery({ dialect, table: operation.table, column: operation.from }));\n const after = await run(renderColumnStateQuery({ dialect, table: operation.table, column: operation.to }));\n if (before.length === 0 && after.length === 1) return \"satisfied\";\n if (before.length === 1 && after.length === 0) return \"runnable\";\n throw conflict({\n reason: \"rename-ambiguous\",\n message: before.length === 0\n ? `\"${operation.table}\" has neither column \"${operation.from}\" nor \"${operation.to}\" — the rename cannot be completed or verified from here`\n : `\"${operation.table}\" has BOTH \"${operation.from}\" and \"${operation.to}\" — refusing to guess which one holds the data`,\n meta: { table: operation.table, from: operation.from, to: operation.to },\n });\n }\n }\n}\n",
|
|
39
|
+
"/**\n * IR-vs-IR schema differ → dialect-neutral migration steps.\n *\n * The contract that matters most: `diffSchemas({ from: introspect(push(X)),\n * to: X })` is EMPTY — both sides normalize through normalize.ts before\n * comparison, so representation differences (implicit list sides vs explicit\n * M2M fields, `@unique` vs `@@unique`, app-level defaults, cascade-action\n * defaults) never produce phantom steps and `db push` twice is a no-op.\n *\n * No rename detection (v1 parity): a renamed table/column diffs as drop +\n * create. Removing a value from a surviving enum throws\n * VIBE_UNSUPPORTED_CAPABILITY — postgres cannot drop enum values without a\n * manual type rebuild, and silence would be dialect dishonesty.\n */\n\nimport { isEnumType, unsupportedCapability } from \"@vibeorm/schema\";\nimport { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect, EnumIR, SchemaIR } from \"@vibeorm/schema\";\nimport { assertEnumStringTransition, isEnumStringTransition, resolveEnumValues } from \"./enum-values.ts\";\nimport { assertStringEnumLabelsFit, normalizeSchema } from \"./normalize.ts\";\nimport type { NormalizedSchema, NormalizedTable } from \"./normalize.ts\";\nimport { isScalarToArrayChange } from \"./postgres-types.ts\";\nimport { assertRlsDialect, withRlsSteps } from \"./ddl/rls.ts\";\nimport { planRenames } from \"./renames.ts\";\nimport type { RenameIntent } from \"./renames.ts\";\nimport type { AlterColumnAspect, MigrationStep } from \"./types.ts\";\n\n// ─── Ordered step buckets ─────────────────────────────────────────\n\n/**\n * Steps are emitted in dependency-safe buckets: view drops first of all (a\n * leftover view blocks dropping any column it references — postgres 2BP01,\n * board #26), enums next (columns reference the types), FK/index drops before\n * the objects they attach to disappear, table creates before the\n * FKs/indexes/join tables that need them, enum drops last (after every column\n * using the type is gone).\n */\ntype StepBuckets = {\n dropExclusion: MigrationStep[];\n addExclusion: MigrationStep[];\n dropView: MigrationStep[];\n createEnum: MigrationStep[];\n addEnumValue: MigrationStep[];\n dropForeignKey: MigrationStep[];\n dropIndex: MigrationStep[];\n dropJoinTable: MigrationStep[];\n dropTable: MigrationStep[];\n createTable: MigrationStep[];\n addColumn: MigrationStep[];\n alterColumn: MigrationStep[];\n dropColumn: MigrationStep[];\n dropPrimaryKey: MigrationStep[];\n addPrimaryKey: MigrationStep[];\n dropCheck: MigrationStep[];\n addCheck: MigrationStep[];\n createIndex: MigrationStep[];\n addForeignKey: MigrationStep[];\n createJoinTable: MigrationStep[];\n dropEnum: MigrationStep[];\n};\n\n// ─── Public API ───────────────────────────────────────────────────\n\n/**\n * Diff two Schema IRs into an ordered list of dialect-neutral migration steps\n * that transform the `from` database shape into the `to` shape.\n *\n * `dialect` (default postgres) selects the comparison rules: sqlite/mysql\n * compare columns by physical type (see normalize.ts), refuse scalar-list\n * columns up front (no array types — VIBE_UNSUPPORTED_CAPABILITY naming the\n * model.field), skip standalone enum steps (their enums are inline: TEXT +\n * CHECK on sqlite, `ENUM(…)` on mysql — value changes flow through\n * `alterColumn`), and refuse enum-value REMOVAL at the column level.\n */\nexport function diffSchemas(params: {\n from: SchemaIR;\n to: SchemaIR;\n dialect?: Dialect;\n /**\n * EXPLICIT physical renames, written down by whoever wants them (renames.ts).\n * Applied to the source schema before the diff runs, so a renamed table or\n * column produces a rename step instead of the drop/create pair the differ\n * would otherwise — correctly — derive. Nothing here is ever inferred.\n */\n renames?: readonly RenameIntent[];\n}): MigrationStep[] {\n const dialect = params.dialect ?? \"postgres\";\n for (const schema of [params.from, params.to]) if (dialect !== \"postgres\" && schema.models.some((model) => (model.exclusions?.length ?? 0) > 0)) throw unsupportedCapability({ dialect, feature: \"exclusionConstraints\" });\n assertRlsDialect({ schema: params.from, dialect });\n assertRlsDialect({ schema: params.to, dialect });\n if (dialect !== \"postgres\") refuseScalarListColumns({ schema: params.to, dialect });\n\n const renamed = planRenames({ from: params.from, to: params.to, renames: params.renames ?? [], dialect });\n params = { ...params, from: renamed.from };\n\n const from = normalizeSchema({ schema: params.from, dialect });\n const to = normalizeSchema({ schema: params.to, dialect });\n\n const buckets: StepBuckets = {\n dropExclusion: [],\n addExclusion: [],\n dropView: [],\n createEnum: [],\n addEnumValue: [],\n dropForeignKey: [],\n dropIndex: [],\n dropJoinTable: [],\n dropTable: [],\n createTable: [],\n addColumn: [],\n alterColumn: [],\n dropColumn: [],\n dropPrimaryKey: [],\n addPrimaryKey: [],\n dropCheck: [],\n addCheck: [],\n createIndex: [],\n addForeignKey: [],\n createJoinTable: [],\n dropEnum: [],\n };\n\n // Standalone enum objects only exist on postgres (CREATE TYPE); sqlite and\n // mysql inline their enums into the columns, so value changes surface as\n // alterColumn steps via the value-based type keys instead.\n if (dialect === \"postgres\") diffEnums({ from, to, buckets });\n diffViews({ from, to, buckets });\n diffJoinTables({ from, to, buckets });\n diffTables({ from, to, buckets, dialect });\n for (const model of params.to.models) {\n const table = model.dbName ?? model.name;\n const previous = params.from.models.find((entry) => (entry.dbName ?? entry.name) === table);\n for (const exclusion of model.exclusions ?? []) {\n const before = previous?.exclusions?.find((entry) => entry.name === exclusion.name);\n if (before?.definition === exclusion.definition) continue;\n if (before?.catalogDefinition) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Exclusion comparison requires normalized evidence\", meta: { reason: \"exclusion-inspection-unavailable\", table, name: exclusion.name } });\n if (before !== undefined) buckets.dropExclusion.push({ kind: \"dropExclusion\", table, exclusion: before, destructive: false });\n buckets.addExclusion.push({ kind: \"addExclusion\", table, exclusion, destructive: false });\n }\n for (const exclusion of previous?.exclusions ?? []) if (!model.exclusions?.some((entry) => entry.name === exclusion.name)) buckets.dropExclusion.push({ kind: \"dropExclusion\", table, exclusion, destructive: false });\n }\n refuseDependentEnumStorageChanges({ from, to, buckets, dialect });\n\n return withRlsSteps({ from: params.from, to: params.to, steps: [\n // Renames run FIRST: every later step (and the normalized comparison\n // above) already refers to the objects by their new physical names.\n ...renamed.steps,\n ...buckets.dropView,\n ...buckets.createEnum,\n ...buckets.addEnumValue,\n ...buckets.dropForeignKey,\n ...buckets.dropExclusion,\n ...buckets.dropIndex,\n ...buckets.dropCheck,\n ...buckets.dropPrimaryKey,\n ...buckets.dropJoinTable,\n ...buckets.dropTable,\n ...buckets.createTable,\n ...buckets.addColumn,\n ...buckets.alterColumn,\n ...buckets.dropColumn,\n ...buckets.addPrimaryKey,\n ...buckets.addCheck,\n ...buckets.addExclusion,\n ...buckets.createIndex,\n ...buckets.addForeignKey,\n ...buckets.createJoinTable,\n ...buckets.dropEnum,\n ] });\n}\n\n// ─── Enums ────────────────────────────────────────────────────────\n\ntype NormalizedPair = {\n from: NormalizedSchema;\n to: NormalizedSchema;\n buckets: StepBuckets;\n};\n\n// ─── Capability guards ────────────────────────────────────────────\n\n/** sqlite/mysql have no array columns — refuse every scalar-list field loudly. */\nfunction refuseScalarListColumns(params: { schema: SchemaIR; dialect: Dialect }): void {\n const { schema, dialect } = params;\n for (const model of schema.models) {\n if (model.isView) continue;\n for (const field of model.fields) {\n if (!field.isList || field.isUnsupported === true) continue;\n throw unsupportedCapability({\n dialect,\n feature: `scalar list column \"${model.name}.${field.name}\"`,\n hint: `${dialect} has no array column type — model the list as a separate table or a ${\n dialect === \"mysql\" ? \"JSON\" : \"Json\"\n } column`,\n });\n }\n }\n}\n\nfunction diffEnums(params: NormalizedPair): void {\n const { from, to, buckets } = params;\n\n for (const [name, enumDef] of to.enums) {\n const previous = from.enums.get(name);\n if (previous === undefined) {\n buckets.createEnum.push({ kind: \"createEnum\", enumDef, destructive: false });\n continue;\n }\n\n const previousValues = new Set(previous.values);\n const currentValues = new Set(enumDef.values);\n for (const value of enumDef.values) {\n if (!previousValues.has(value)) {\n buckets.addEnumValue.push({ kind: \"addEnumValue\", enumName: name, value, destructive: false });\n }\n }\n for (const value of previous.values) {\n if (!currentValues.has(value)) {\n throw unsupportedCapability({\n dialect: \"postgres\",\n feature: `removing value \"${value}\" from enum \"${name}\"`,\n hint: \"postgres cannot drop enum values — recreate the type manually (create new type, ALTER COLUMN ... USING, drop old type)\",\n });\n }\n }\n }\n\n for (const [name] of from.enums) {\n if (!to.enums.has(name)) {\n buckets.dropEnum.push({ kind: \"dropEnum\", enumName: name, destructive: true });\n }\n }\n}\n\n/** Existing FK/join dependencies need a coordinated migration, not isolated ALTERs. */\nfunction refuseDependentEnumStorageChanges(params: NormalizedPair & { dialect: Dialect }): void {\n const { from, to, buckets, dialect } = params;\n for (const step of buckets.alterColumn) {\n if (step.kind !== \"alterColumn\" || !isEnumStringTransition({ from: step.from, to: step.to })) continue;\n for (const normalized of [from, to]) {\n const hasFk = [...normalized.tables.values()].some((table) => [...table.fks.values()].some((fk) =>\n (table.table === step.table && fk.columns.includes(step.column)) ||\n (fk.refTable === step.table && fk.refColumns.includes(step.column)),\n ));\n const hasJoin = [...normalized.joinTables.values()].some((join) => [join.a, join.b].some((end) =>\n end.table === step.table && end.column === step.column,\n ));\n if (hasFk || hasJoin) {\n throw unsupportedCapability({\n dialect,\n feature: `enum storage conversion on \"${step.table}\".\"${step.column}\" with foreign-key dependencies`,\n hint: \"migrate the referencing columns and constraints together in a reviewed manual migration\",\n });\n }\n }\n }\n}\n\n// ─── Views (#26) ──────────────────────────────────────────\n\n/**\n * A view in `from` the target no longer declares gets a `dropView` step — a\n * leftover view otherwise blocks the column drops beneath it (postgres 2BP01)\n * and `push` fails on a schema the user considers valid. Views only in `to`\n * emit nothing: view CREATION stays out-of-band in this wave (see #11), and\n * whatever design lands there must keep this drop rule.\n */\nfunction diffViews(params: NormalizedPair): void {\n const { from, to, buckets } = params;\n for (const [name] of from.views) {\n if (!to.views.has(name)) {\n buckets.dropView.push({ kind: \"dropView\", table: name, destructive: true });\n }\n }\n}\n\n// ─── Join tables ──────────────────────────────────────────────────\n\nfunction diffJoinTables(params: NormalizedPair): void {\n const { from, to, buckets } = params;\n\n for (const [table, joinTable] of to.joinTables) {\n if (!from.joinTables.has(table)) {\n buckets.createJoinTable.push({\n kind: \"createJoinTable\",\n table,\n a: joinTable.a,\n b: joinTable.b,\n destructive: false,\n });\n }\n }\n for (const [table] of from.joinTables) {\n if (!to.joinTables.has(table)) {\n buckets.dropJoinTable.push({ kind: \"dropJoinTable\", table, destructive: true });\n }\n }\n}\n\n// ─── Tables ───────────────────────────────────────────────────────\n\nfunction diffTables(params: NormalizedPair & { dialect: Dialect }): void {\n const { from, to, buckets, dialect } = params;\n\n for (const [name, table] of to.tables) {\n const previous = from.tables.get(name);\n if (previous === undefined) createWholeTable({ table, buckets });\n else\n diffOneTable({\n previous,\n current: table,\n buckets,\n dialect,\n fromEnums: from.enums,\n toEnums: to.enums,\n });\n }\n\n // PostgreSQL/MySQL drops are RESTRICT, not CASCADE. Remove outgoing edges\n // explicitly, including cycles inside a removed group. SQLite instead orders\n // child drops and must not rebuild a table that is itself being removed.\n for (const [name, table] of from.tables) {\n if (to.tables.has(name)) continue;\n if (dialect !== \"sqlite\") for (const fk of table.fks.values()) {\n buckets.dropForeignKey.push({ kind: \"dropForeignKey\", table: name, constraintName: fk.constraintName, destructive: false });\n }\n buckets.dropTable.push({ kind: \"dropTable\", table: name, destructive: true });\n }\n}\n\nfunction createWholeTable(params: { table: NormalizedTable; buckets: StepBuckets }): void {\n const { table, buckets } = params;\n\n buckets.createTable.push({\n kind: \"createTable\",\n table: table.table,\n columns: [...table.columns.values()].map((column) => column.field),\n primaryKey: table.pk,\n ...(table.model.primaryKeyConstraintName === undefined ? {} : { primaryKeyConstraintName: table.model.primaryKeyConstraintName }),\n checks: [...table.checks].map(([name, expression]) => ({ name, expression })),\n destructive: false,\n });\n\n for (const index of table.indexes.values()) {\n buckets.createIndex.push({\n kind: \"createIndex\",\n table: table.table,\n name: index.name,\n indexKind: index.kind,\n unique: index.unique,\n columns: index.columns,\n ...(index.where === undefined ? {} : { where: index.where }),\n ...(index.nullsNotDistinct === true ? { nullsNotDistinct: true } : {}),\n destructive: false,\n });\n }\n\n for (const fk of table.fks.values()) {\n buckets.addForeignKey.push({\n kind: \"addForeignKey\",\n table: table.table,\n constraintName: fk.constraintName,\n columns: fk.columns,\n refTable: fk.refTable,\n refColumns: fk.refColumns,\n onDelete: fk.onDelete,\n onUpdate: fk.onUpdate,\n destructive: false,\n });\n }\n}\n\nfunction diffOneTable(params: {\n previous: NormalizedTable;\n current: NormalizedTable;\n buckets: StepBuckets;\n dialect: Dialect;\n fromEnums: ReadonlyMap<string, EnumIR>;\n toEnums: ReadonlyMap<string, EnumIR>;\n}): void {\n const { previous, current, buckets, dialect, fromEnums, toEnums } = params;\n const table = current.table;\n\n // Columns.\n for (const [name, column] of current.columns) {\n const before = previous.columns.get(name);\n if (before === undefined) {\n buckets.addColumn.push({ kind: \"addColumn\", table, column: column.field, destructive: false });\n continue;\n }\n\n const changes: AlterColumnAspect[] = [];\n if (before.typeKey !== column.typeKey) changes.push(\"type\");\n if (before.nullable !== column.nullable) changes.push(\"nullability\");\n if (before.defaultKey !== column.defaultKey) changes.push(\"default\");\n // An omitted declaration leaves the physical collation unchanged. Explicit\n // declarations are compared with catalog truth, not with a guessed default.\n const collationChanged = dialect === \"mysql\" && column.field.collation !== undefined &&\n before.field.collation?.toLowerCase() !== column.field.collation.toLowerCase();\n if (collationChanged) changes.push(\"collation\");\n if (changes.length === 0) continue;\n if (changes.includes(\"type\") && [...previous.checks].some(([name, expression]) => current.checks.get(name) === expression)) {\n throw unsupportedCapability({ dialect, feature: \"alterColumnWithRetainedCheck\", hint: \"CHECK dependencies and type compatibility are not proven; use a reviewed migration that replaces and revalidates the affected constraints\" });\n }\n\n const storageChange = isEnumStringTransition({ from: before.field, to: column.field });\n if (storageChange) {\n assertEnumStringTransition({ from: before.field, to: column.field, dialect, table, column: name });\n if (isEnumType(before.field.type) && column.field.type === \"String\") {\n const values = resolveEnumValues({ name: before.field.type.enum, enums: fromEnums });\n if (values !== undefined) assertStringEnumLabelsFit({ field: column.field, values, dialect, table });\n }\n }\n let narrowingType =\n changes.includes(\"type\") &&\n !isScalarToArrayChange({ from: before.field, to: column.field }) &&\n !(storageChange && column.field.type === \"String\");\n\n // Inline-enum dialects: an enum→enum type change is a value-list change.\n // Pure widening (values only added) is safe and non-destructive; REMOVING\n // a value is refused outright — existing rows may hold it, and silence\n // would be dialect dishonesty.\n if (\n dialect !== \"postgres\" &&\n changes.includes(\"type\") &&\n isEnumType(before.field.type) &&\n isEnumType(column.field.type)\n ) {\n const fromValues = resolveEnumValues({ name: before.field.type.enum, enums: fromEnums });\n const toValues = resolveEnumValues({ name: column.field.type.enum, enums: toEnums });\n if (fromValues !== undefined && toValues !== undefined) {\n const removed = fromValues.filter((value) => !toValues.includes(value));\n if (removed.length > 0) {\n throw unsupportedCapability({\n dialect,\n feature: `removing value(s) ${removed.map((value) => `\"${value}\"`).join(\", \")} from enum column \"${table}\".\"${name}\"`,\n hint: \"migrate the stored values away first, then recreate the column with the narrower enum\",\n });\n }\n narrowingType = false; // Pure widening — no data can be lost.\n }\n }\n\n buckets.alterColumn.push({\n kind: \"alterColumn\",\n table,\n column: name,\n from: before.field,\n to: column.field,\n changes,\n destructive: narrowingType || collationChanged,\n });\n }\n\n for (const [name] of previous.columns) {\n if (!current.columns.has(name)) {\n buckets.dropColumn.push({ kind: \"dropColumn\", table, column: name, destructive: true });\n }\n }\n\n // Primary key.\n const pkBefore = previous.pk.join(\",\");\n const pkAfter = current.pk.join(\",\");\n if (pkBefore !== pkAfter) {\n if (previous.pk.length > 0) {\n buckets.dropPrimaryKey.push({ kind: \"dropPrimaryKey\", table, destructive: false, ...(previous.model.primaryKeyConstraintName === undefined ? {} : { constraintName: previous.model.primaryKeyConstraintName }) });\n }\n if (current.pk.length > 0) {\n buckets.addPrimaryKey.push({\n kind: \"addPrimaryKey\",\n table,\n columns: current.pk,\n ...(current.model.primaryKeyConstraintName === undefined ? {} : { constraintName: current.model.primaryKeyConstraintName }),\n destructive: false,\n });\n }\n }\n\n // Authored expression changes replace the named constraint. Live callers\n // must establish expression equivalence before passing catalog IR here.\n for (const [name, expression] of current.checks) {\n const before = previous.checks.get(name);\n if (before === expression) continue;\n if (before !== undefined && previous.model.checks?.some((check) => check.name === name && check.catalogExpression === true)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Unequal catalog CHECK text requires normalized evidence or explicit replacement through the live planner\", meta: { reason: \"check-inspection-unavailable\", table, name } });\n if (before !== undefined) buckets.dropCheck.push({ kind: \"dropCheck\", table, name, destructive: false });\n buckets.addCheck.push({ kind: \"addCheck\", table, name, expression, destructive: false });\n }\n for (const [name] of previous.checks) {\n if (current.checks.has(name)) continue;\n buckets.dropCheck.push({ kind: \"dropCheck\", table, name, destructive: false });\n }\n\n // Indexes (uniques included — normalize.ts already merged @unique fields in).\n for (const [key, index] of current.indexes) {\n if (previous.indexes.has(key)) continue;\n buckets.createIndex.push({\n kind: \"createIndex\",\n table,\n name: index.name,\n indexKind: index.kind,\n unique: index.unique,\n columns: index.columns,\n ...(index.where === undefined ? {} : { where: index.where }),\n ...(index.nullsNotDistinct === true ? { nullsNotDistinct: true } : {}),\n destructive: false,\n });\n }\n for (const [key, index] of previous.indexes) {\n if (current.indexes.has(key)) continue;\n buckets.dropIndex.push({ kind: \"dropIndex\", name: index.name, table, destructive: false, ...(index.constraintName === undefined ? {} : { constraintName: index.constraintName }) });\n }\n\n // Foreign keys. Cascade-action drift needs DROP + ADD — postgres has no\n // ALTER CONSTRAINT ... ON DELETE for FKs (LEARNINGS).\n for (const [key, fk] of current.fks) {\n const before = previous.fks.get(key);\n if (before === undefined) {\n buckets.addForeignKey.push({\n kind: \"addForeignKey\",\n table,\n constraintName: fk.constraintName,\n columns: fk.columns,\n refTable: fk.refTable,\n refColumns: fk.refColumns,\n onDelete: fk.onDelete,\n onUpdate: fk.onUpdate,\n destructive: false,\n });\n continue;\n }\n if (before.onDelete !== fk.onDelete || before.onUpdate !== fk.onUpdate) {\n buckets.dropForeignKey.push({\n kind: \"dropForeignKey\",\n table,\n constraintName: before.constraintName,\n destructive: false,\n });\n buckets.addForeignKey.push({\n kind: \"addForeignKey\",\n table,\n constraintName: fk.constraintName,\n columns: fk.columns,\n refTable: fk.refTable,\n refColumns: fk.refColumns,\n onDelete: fk.onDelete,\n onUpdate: fk.onUpdate,\n destructive: false,\n });\n }\n }\n for (const [key, fk] of previous.fks) {\n if (current.fks.has(key)) continue;\n buckets.dropForeignKey.push({\n kind: \"dropForeignKey\",\n table,\n constraintName: fk.constraintName,\n destructive: false,\n });\n }\n}\n",
|
|
40
|
+
"/**\n * EXPLICIT physical renames.\n *\n * The differ deliberately has no rename detection: two schemas that differ by\n * a name are indistinguishable from a drop plus a create, and guessing between\n * them from \"similar shapes\" is how a migration tool silently destroys a\n * column. A rename therefore only ever happens because someone WROTE one down,\n * as an old physical name and a new physical name, and it is validated against\n * both schemas before a single statement is rendered.\n *\n * `@map` / `@@map` remains the no-DDL option: mapping a model or field to the\n * name the database already uses changes generated code only. Use a rename\n * intent when the DATABASE object must actually move.\n *\n * What a physical rename preserves, on every dialect that supports it: the\n * rows, the column defaults, the indexes and constraints attached to the\n * object, and inbound foreign keys — the object keeps its identity, only its\n * name changes. PostgreSQL policy expressions follow the rename too, because\n * they are stored parsed and reference the object by identity, not by text.\n *\n * What refuses instead of guessing: renaming a table and one of its columns in\n * the same plan (the second intent's table name is then ambiguous), an intent\n * whose endpoints do not both check out against the two schemas, and two\n * intents pointing at the same object.\n */\n\nimport { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect, ModelIR, SchemaIR } from \"@vibeorm/schema\";\nimport type { MigrationStep } from \"./types.ts\";\n\n/** One deliberately written rename, in PHYSICAL (database) names. */\nexport type RenameIntent =\n | { readonly kind: \"table\"; readonly from: string; readonly to: string }\n | { readonly kind: \"column\"; readonly table: string; readonly from: string; readonly to: string };\n\n/** Physical table name of a model. */\nfunction tableOf(model: ModelIR): string {\n return model.dbName ?? model.name;\n}\n\nfunction findTable(params: { schema: SchemaIR; table: string }): ModelIR | undefined {\n return params.schema.models.find((model) => !model.isView && tableOf(model) === params.table);\n}\n\nfunction hasColumn(params: { model: ModelIR; column: string }): boolean {\n return params.model.fields.some((field) => (field.dbName ?? field.name) === params.column);\n}\n\nfunction ambiguous(params: { detail: string; meta: Record<string, unknown> }): VibeError {\n return new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `rename refused: ${params.detail}`,\n meta: { reason: \"rename-ambiguous\", ...params.meta },\n });\n}\n\n/**\n * Validate rename intents against the two schemas and turn them into steps,\n * returning the SOURCE schema rewritten as if the renames had happened.\n *\n * The rewrite is what keeps the rest of the diff honest: once the source model\n * carries the new physical name, the ordinary differ sees one table on both\n * sides and emits no drop/create pair for it. Only `dbName` moves — the\n * logical IR graph (relations, index field lists) is untouched, so nothing\n * downstream has to know a rename happened.\n */\nexport function planRenames(params: {\n from: SchemaIR;\n to: SchemaIR;\n renames: readonly RenameIntent[];\n dialect: Dialect;\n}): { readonly steps: readonly MigrationStep[]; readonly from: SchemaIR } {\n const { to, dialect } = params;\n if (params.renames.length === 0) return { steps: [], from: params.from };\n\n const renamedTables = new Map<string, string>();\n const renamedColumns = new Map<string, Map<string, string>>();\n const steps: MigrationStep[] = [];\n\n for (const intent of params.renames) {\n if (intent.kind === \"table\") {\n if (intent.from === intent.to) {\n throw ambiguous({ detail: `table \"${intent.from}\" renames to itself`, meta: { dialect, from: intent.from } });\n }\n if (renamedTables.has(intent.from) || [...renamedTables.values()].includes(intent.to)) {\n throw ambiguous({ detail: `table \"${intent.from}\" or \"${intent.to}\" appears in more than one rename`, meta: { dialect, from: intent.from, to: intent.to } });\n }\n const source = findTable({ schema: params.from, table: intent.from });\n if (source === undefined) {\n throw ambiguous({ detail: `the current database has no table \"${intent.from}\" to rename`, meta: { dialect, from: intent.from, to: intent.to } });\n }\n if (findTable({ schema: params.from, table: intent.to }) !== undefined) {\n throw ambiguous({ detail: `the current database already has a table named \"${intent.to}\"`, meta: { dialect, from: intent.from, to: intent.to } });\n }\n if (findTable({ schema: to, table: intent.to }) === undefined) {\n throw ambiguous({ detail: `the target schema has no table \"${intent.to}\" — a rename must name a table that exists on BOTH sides`, meta: { dialect, from: intent.from, to: intent.to } });\n }\n if (findTable({ schema: to, table: intent.from }) !== undefined) {\n throw ambiguous({ detail: `the target schema still has a table \"${intent.from}\", so this is not a rename`, meta: { dialect, from: intent.from, to: intent.to } });\n }\n renamedTables.set(intent.from, intent.to);\n steps.push({ kind: \"renameTable\", from: intent.from, to: intent.to, destructive: false });\n continue;\n }\n\n if (intent.from === intent.to) {\n throw ambiguous({ detail: `column \"${intent.table}\".\"${intent.from}\" renames to itself`, meta: { dialect, table: intent.table } });\n }\n if (renamedTables.has(intent.table) || [...renamedTables.values()].includes(intent.table)) {\n throw ambiguous({\n detail: `\"${intent.table}\" is renamed in the same plan, so a column rename on it is ambiguous — split the table rename and the column rename into two migrations`,\n meta: { dialect, table: intent.table, from: intent.from, to: intent.to },\n });\n }\n const sourceTable = findTable({ schema: params.from, table: intent.table });\n const targetTable = findTable({ schema: to, table: intent.table });\n if (sourceTable === undefined || targetTable === undefined) {\n throw ambiguous({ detail: `table \"${intent.table}\" must exist in both the current database and the target schema to rename one of its columns`, meta: { dialect, table: intent.table } });\n }\n const columns = renamedColumns.get(intent.table) ?? new Map<string, string>();\n if (columns.has(intent.from) || [...columns.values()].includes(intent.to)) {\n throw ambiguous({ detail: `column \"${intent.table}\".\"${intent.from}\" or \"${intent.to}\" appears in more than one rename`, meta: { dialect, table: intent.table } });\n }\n if (!hasColumn({ model: sourceTable, column: intent.from })) {\n throw ambiguous({ detail: `the current database has no column \"${intent.table}\".\"${intent.from}\" to rename`, meta: { dialect, table: intent.table, from: intent.from } });\n }\n if (hasColumn({ model: sourceTable, column: intent.to })) {\n throw ambiguous({ detail: `the current database already has a column \"${intent.table}\".\"${intent.to}\"`, meta: { dialect, table: intent.table, to: intent.to } });\n }\n if (!hasColumn({ model: targetTable, column: intent.to })) {\n throw ambiguous({ detail: `the target schema has no column \"${intent.table}\".\"${intent.to}\" — a rename must name a column that exists on BOTH sides`, meta: { dialect, table: intent.table, to: intent.to } });\n }\n if (hasColumn({ model: targetTable, column: intent.from })) {\n throw ambiguous({ detail: `the target schema still has a column \"${intent.table}\".\"${intent.from}\", so this is not a rename`, meta: { dialect, table: intent.table, from: intent.from } });\n }\n columns.set(intent.from, intent.to);\n renamedColumns.set(intent.table, columns);\n steps.push({ kind: \"renameColumn\", table: intent.table, from: intent.from, to: intent.to, destructive: false });\n }\n\n const rewritten: SchemaIR = {\n ...params.from,\n models: params.from.models.map((model) => {\n const table = tableOf(model);\n const columns = renamedColumns.get(table);\n const newTable = renamedTables.get(table);\n if (columns === undefined && newTable === undefined) return model;\n return {\n ...model,\n ...(newTable === undefined ? {} : { dbName: newTable }),\n ...(columns === undefined\n ? {}\n : {\n fields: model.fields.map((field) => {\n const renamed = columns.get(field.dbName ?? field.name);\n return renamed === undefined ? field : { ...field, dbName: renamed };\n }),\n }),\n };\n }),\n };\n\n // Table renames first: a column rename on a renamed table is refused above,\n // so the two groups never interact, but keeping the order explicit makes the\n // rendered SQL read the way an operator expects.\n return {\n steps: [...steps.filter((step) => step.kind === \"renameTable\"), ...steps.filter((step) => step.kind === \"renameColumn\")],\n from: rewritten,\n };\n}\n",
|
|
41
|
+
"/**\n * Dialect dispatcher for DDL rendering — the ONE public entry point. Routes to\n * the per-dialect renderers (ddl/postgres.ts, ddl/sqlite.ts, ddl/mysql.ts) so\n * every SQL-text decision stays in exactly one dialect module.\n */\n\nimport { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR } from \"@vibeorm/schema\";\nimport { renderPostgresSteps } from \"./postgres.ts\";\nimport { renderSqliteSteps, sqliteInvalidatedTables } from \"./sqlite.ts\";\nimport { renderMysqlSteps } from \"./mysql.ts\";\nimport type { MigrationStep } from \"../types.ts\";\n\ntype SqlitePreservation = {\n to?: SchemaIR;\n restore: Map<string, string[]>;\n columns: Map<string, Map<string, { sql: string; generated: boolean }>>;\n};\n\n/** Authored up/down generation uses the same trusted clauses the live planner verifies. */\nfunction declaredSqlitePreservation(params: { steps: readonly MigrationStep[]; from?: SchemaIR; to?: SchemaIR }): SqlitePreservation {\n const restore = new Map<string, string[]>();\n const columns = new Map<string, Map<string, { sql: string; generated: boolean }>>();\n let to = params.to;\n if (params.from === undefined || to === undefined || (params.from.migrationObjects?.length ?? 0) === 0) return { to, restore, columns };\n const invalid = sqliteInvalidatedTables({ steps: params.steps, from: params.from });\n const retained = new Set((to.migrationObjects ?? []).map((object) => sqlObjectKey({ identity: object.identity })));\n for (const object of params.from.migrationObjects ?? []) {\n const identity = object.identity;\n if (!(\"table\" in identity) || identity.table.namespace !== \"main\" || !invalid.rebuilt.has(identity.table.name) || !retained.has(sqlObjectKey({ identity }))) continue;\n const facts = object.expected?.facts;\n if (facts === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"SQLite rebuild requires independently declared preservation definitions\", meta: { reason: \"sqlite-preservation-unavailable\", identity } });\n if (identity.kind === \"trigger\" || identity.kind === \"index\") {\n if (identity.kind === \"index\" && to.models.some((model) => (model.dbName ?? model.name) === identity.table.name && model.indexes.some((index) => index.name === identity.name))) continue;\n if (typeof facts.definition !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Missing SQLite restoration SQL\", meta: { reason: \"sqlite-preservation-unavailable\", identity } });\n const statements = restore.get(identity.table.name) ?? [];\n statements.push(facts.definition);\n restore.set(identity.table.name, statements);\n } else if (identity.kind === \"column\" || identity.kind === \"generatedColumn\") {\n if (typeof facts.columnDefinition !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Missing SQLite column clause\", meta: { reason: \"sqlite-preservation-unavailable\", identity } });\n const fields = columns.get(identity.table.name) ?? new Map<string, { sql: string; generated: boolean }>();\n fields.set(identity.column, { sql: facts.columnDefinition, generated: Number(facts.generated) > 1 });\n columns.set(identity.table.name, fields);\n } else if (identity.kind === \"columnDefault\") {\n if (facts.definition !== null && typeof facts.definition !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Missing SQLite default clause\", meta: { reason: \"sqlite-preservation-unavailable\", identity } });\n const expression = facts.definition;\n to = { ...to, models: to.models.map((model) => (model.dbName ?? model.name) !== identity.table.name ? model : { ...model, fields: model.fields.map((field) => {\n if ((field.dbName ?? field.name) !== identity.column) return field;\n const { default: ignored, ...rest } = field;\n return { ...rest, ...(expression === null ? {} : { default: { kind: \"dbgenerated\" as const, sql: expression } }) };\n }) }) };\n }\n }\n return { to, restore, columns };\n}\n\n/**\n * Render migration steps to SQL statements (one string per statement, in\n * order) for a dialect.\n *\n * `from`/`to` — the schemas the steps were diffed from — are OPTIONAL for\n * postgres (ignored) but needed by sqlite whenever a step compiles to the\n * table-rebuild recipe (the target table shape lives on the schema, not the\n * step) and by sqlite/mysql for enum columns (CHECK / inline ENUM values).\n * `generateMigration` and `push` always pass them; direct callers rendering\n * rebuild-free, enum-free steps may omit them.\n */\nexport function renderSteps(params: {\n steps: readonly MigrationStep[];\n dialect: Dialect;\n from?: SchemaIR;\n to?: SchemaIR;\n /** Captured trigger/index SQL restored inside each SQLite rebuild transaction. */\n sqliteRestore?: ReadonlyMap<string, readonly string[]>;\n /** Verified generated/extra column clauses copied into rebuilt SQLite tables. */\n sqliteColumns?: ReadonlyMap<string, ReadonlyMap<string, { readonly sql: string; readonly generated: boolean }>>;\n}): string[] {\n const { steps, dialect, from, to } = params;\n // @collation (board #36) follows the @db.* native-type precedent: a\n // dialect-specific column annotation, rendered where it has meaning (mysql)\n // and inert elsewhere — NOT a capability refusal, so one portable schema\n // can carry it across the dialect matrix.\n switch (dialect) {\n case \"postgres\":\n return renderPostgresSteps({ steps });\n case \"sqlite\": {\n const preserved = declaredSqlitePreservation({ ...params, ...(from === undefined ? {} : { from }), ...(to === undefined ? {} : { to }) });\n return renderSqliteSteps({\n steps,\n restore: params.sqliteRestore ?? preserved.restore,\n preservedColumns: params.sqliteColumns ?? preserved.columns,\n ...(from === undefined ? {} : { from }),\n ...(preserved.to === undefined ? {} : { to: preserved.to }),\n });\n }\n case \"mysql\":\n return renderMysqlSteps({\n steps,\n ...(from === undefined ? {} : { from }),\n ...(to === undefined ? {} : { to }),\n });\n }\n}\n",
|
|
42
|
+
"/**\n * Postgres DDL renderer: migration steps → SQL statements.\n *\n * Every identifier is quoted through `postgresDialect.quoteIdent` — the ONE\n * quoting decision point (@vibeorm/sql). Choices, each pinned by a renderer\n * test:\n *\n * - autoincrement renders as `GENERATED BY DEFAULT AS IDENTITY` (SQL-standard,\n * no sequence-name coupling; postgres ≥10 and pglite both support it) — not\n * SERIAL. The introspector maps identity columns back to autoincrement.\n * - DROP TABLE is restricted; the differ drops dependent foreign keys first.\n * - Core table, enum and index identities always target the public namespace.\n * - scalar→array type changes carry the LEARNINGS `USING CASE WHEN col IS NULL\n * THEN NULL ELSE ARRAY[col] END` repair clause (postgres cannot implicit-cast).\n * - `ALTER TYPE ... ADD VALUE IF NOT EXISTS` appends at the end of the enum\n * (no BEFORE/AFTER positioning); fine inside a transaction on postgres ≥12.\n * - Unsupported columns render their `nativeType` verbatim and migrate like\n * any other column.\n */\n\nimport { renderExclusionSetup } from \"@vibeorm/sql\";\nimport { VibeError, isEnumType } from \"@vibeorm/schema\";\nimport type { FieldIR } from \"@vibeorm/schema\";\nimport { postgresDialect, renderRlsPolicyPath } from \"@vibeorm/sql\";\nimport {\n CASCADE_ACTION_SQL,\n columnTypeSql,\n defaultSql,\n isIdentityColumn,\n quotePgString,\n} from \"../postgres-types.ts\";\nimport type { MigrationStep } from \"../types.ts\";\nimport { renderRlsStep } from \"./rls.ts\";\nimport { assertEnumStringTransition, isEnumStringTransition } from \"../enum-values.ts\";\n\n// ─── Public API ───────────────────────────────────────────────────\n\n/** Render migration steps to postgres SQL (one string per statement, in order). */\nexport function renderPostgresSteps(params: { steps: readonly MigrationStep[] }): string[] {\n refuseSameTransactionEnumUse({ steps: params.steps });\n return params.steps.flatMap((step) => renderStep({ step }));\n}\n\n/**\n * PostgreSQL refuses to USE an enum member that was added in the same\n * transaction (\"unsafe use of new value of enum type\") — the member exists but\n * is not committed, so a DEFAULT or a backfill referring to it fails AT APPLY\n * TIME, after part of the migration already ran. Migrations run in one\n * transaction here (`push`, `runTransactional`), so this combination can never\n * succeed: refuse while rendering, naming the split, instead of shipping a\n * migration that cannot be applied (F34).\n *\n * Only NATIVE enums reach this: string-backed enums produce no `addEnumValue`\n * step, and sqlite/mysql inline their enums into the column.\n */\nfunction refuseSameTransactionEnumUse(params: { steps: readonly MigrationStep[] }): void {\n const added = new Map<string, Set<string>>();\n for (const step of params.steps) {\n if (step.kind !== \"addEnumValue\") continue;\n const values = added.get(step.enumName) ?? new Set<string>();\n values.add(step.value);\n added.set(step.enumName, values);\n }\n if (added.size === 0) return;\n\n const use = (field: FieldIR): { enumName: string; value: string } | undefined => {\n if (!isEnumType(field.type)) return undefined;\n const enumName = field.type.enum;\n const def = field.default;\n const candidates = def?.kind === \"list\" ? def.values : def?.kind === \"enumValue\" || def?.kind === \"literal\" ? [def.value] : [];\n const value = candidates.find((entry): entry is string => typeof entry === \"string\" && added.get(enumName)?.has(entry) === true);\n return value === undefined ? undefined : { enumName, value };\n };\n\n for (const step of params.steps) {\n if (step.kind !== \"createTable\" && step.kind !== \"addColumn\" && step.kind !== \"alterColumn\") {\n continue;\n }\n const fields: readonly FieldIR[] =\n step.kind === \"createTable\" ? step.columns : step.kind === \"addColumn\" ? [step.column] : [step.to];\n for (const field of fields) {\n const found = use(field);\n if (found === undefined) continue;\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `enum value \"${found.value}\" is added to \"${found.enumName}\" and used as a default on \"${step.table}\".\"${field.dbName ?? field.name}\" in the same migration — PostgreSQL cannot use an enum member before the transaction that added it commits. Split this into two migrations: the first containing only the ALTER TYPE ... ADD VALUE, the second the column change`,\n meta: { enum: found.enumName, value: found.value, table: step.table, column: field.dbName ?? field.name, rule: \"enum-value-used-in-adding-transaction\" },\n });\n }\n }\n}\n\n// ─── Per-step rendering ───────────────────────────────────────────\n\nfunction renderStep(params: { step: MigrationStep }): string[] {\n const { step } = params;\n switch (step.kind) {\n case \"addExclusion\":\n return [...renderExclusionSetup({ dialect: postgresDialect, exclusion: step.exclusion }), `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(step.exclusion.name)} ${step.exclusion.definition};`];\n case \"dropExclusion\":\n return [`ALTER TABLE ${publicName(step.table)} DROP CONSTRAINT ${q(step.exclusion.name)};`];\n case \"enableRls\":\n case \"forceRls\":\n case \"disableRls\":\n case \"noForceRls\":\n case \"createPolicy\":\n case \"dropPolicy\":\n return step.kind === \"createPolicy\"\n ? [renderRlsPolicyPath({ dialect: postgresDialect, stage: \"save\" }).text, renderRlsPolicyPath({ dialect: postgresDialect, stage: \"empty\" }).text, ...renderRlsStep({ step, dialect: \"postgres\" }), renderRlsPolicyPath({ dialect: postgresDialect, stage: \"restore\" }).text]\n : renderRlsStep({ step, dialect: \"postgres\" });\n case \"createEnum\": {\n const name = step.enumDef.dbName ?? step.enumDef.name;\n const values = step.enumDef.values.map((value) => quotePgString({ value })).join(\", \");\n return [`CREATE TYPE ${publicName(name)} AS ENUM (${values});`];\n }\n case \"dropEnum\":\n return [`DROP TYPE ${publicName(step.enumName)};`];\n case \"addEnumValue\":\n return [\n `ALTER TYPE ${publicName(step.enumName)} ADD VALUE IF NOT EXISTS ${quotePgString({ value: step.value })};`,\n ];\n case \"createTable\": {\n const lines = step.columns.map((column) => ` ${columnDefSql({ field: column })}`);\n if (step.primaryKey.length > 0) {\n const pkCols = step.primaryKey.map((column) => q(column)).join(\", \");\n lines.push(` CONSTRAINT ${q(step.primaryKeyConstraintName ?? `${step.table}_pkey`)} PRIMARY KEY (${pkCols})`);\n }\n for (const check of step.checks ?? []) {\n lines.push(` CONSTRAINT ${q(check.name)} CHECK (${check.expression})`);\n }\n return [`CREATE TABLE ${publicName(step.table)} (\\n${lines.join(\",\\n\")}\\n);`];\n }\n case \"dropTable\":\n case \"dropJoinTable\":\n return [`DROP TABLE ${publicName(step.table)};`];\n case \"dropView\":\n // No CASCADE: a view-on-view dependency fails LOUDLY instead of silently\n // taking a surviving dependent view with it (#26).\n return [`DROP VIEW IF EXISTS ${publicName(step.table)};`];\n case \"addColumn\":\n return [`ALTER TABLE ${publicName(step.table)} ADD COLUMN ${columnDefSql({ field: step.column })};`];\n case \"dropColumn\":\n return [`ALTER TABLE ${publicName(step.table)} DROP COLUMN ${q(step.column)};`];\n case \"alterColumn\":\n return renderAlterColumn({ step });\n case \"createIndex\": {\n const unique = step.unique ? \"UNIQUE \" : \"\";\n const using = !step.unique && step.indexKind !== \"btree\" ? ` USING ${step.indexKind}` : \"\";\n const cols = step.columns\n .map((column) => `${q(column.name)}${column.desc ? \" DESC\" : \"\"}`)\n .join(\", \");\n // pg 15+ clause; the flag sits between the column list and WHERE.\n const nulls = step.nullsNotDistinct === true ? \" NULLS NOT DISTINCT\" : \"\";\n const where = step.where === undefined ? \"\" : ` WHERE ${step.where}`;\n return [\n `CREATE ${unique}INDEX ${q(step.name)} ON ${publicName(step.table)}${using} (${cols})${nulls}${where};`,\n ];\n }\n case \"dropIndex\":\n if (step.constraintName !== undefined) {\n if (step.table === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Constraint-backed index removal requires its owning table\" });\n return [`ALTER TABLE ${publicName(step.table)} DROP CONSTRAINT ${q(step.constraintName)};`];\n }\n return [`DROP INDEX ${publicName(step.name)};`];\n case \"addCheck\":\n return [\n `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(step.name)} CHECK (${step.expression});`,\n ];\n case \"dropCheck\":\n return [`ALTER TABLE ${publicName(step.table)} DROP CONSTRAINT ${q(step.name)};`];\n case \"addForeignKey\": {\n const cols = step.columns.map((column) => q(column)).join(\", \");\n const refCols = step.refColumns.map((column) => q(column)).join(\", \");\n return [\n `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(step.constraintName)} FOREIGN KEY (${cols}) REFERENCES ${publicName(step.refTable)} (${refCols}) ON DELETE ${CASCADE_ACTION_SQL[step.onDelete]} ON UPDATE ${CASCADE_ACTION_SQL[step.onUpdate]};`,\n ];\n }\n case \"addForeignKeyNotValid\": {\n // NOT VALID skips the scan of existing rows, so the ACCESS EXCLUSIVE lock\n // is held for a catalog write instead of a full table read. New and\n // changed rows are enforced immediately; the existing ones are only\n // proven by the separate VALIDATE CONSTRAINT step below.\n const cols = step.columns.map((column) => q(column)).join(\", \");\n const refCols = step.refColumns.map((column) => q(column)).join(\", \");\n return [\n `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(step.constraintName)} FOREIGN KEY (${cols}) REFERENCES ${publicName(step.refTable)} (${refCols}) ON DELETE ${CASCADE_ACTION_SQL[step.onDelete]} ON UPDATE ${CASCADE_ACTION_SQL[step.onUpdate]} NOT VALID;`,\n ];\n }\n case \"addCheckNotValid\":\n return [\n `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(step.name)} CHECK (${step.expression}) NOT VALID;`,\n ];\n case \"validateConstraint\":\n // SHARE UPDATE EXCLUSIVE: concurrent reads and writes continue while the\n // scan runs. Cheaper than the combined ADD, not free.\n return [`ALTER TABLE ${publicName(step.table)} VALIDATE CONSTRAINT ${q(step.name)};`];\n case \"renameTable\":\n // Rows, defaults, indexes, constraints, inbound foreign keys and policy\n // expressions all follow the object: PostgreSQL stores them against its\n // identity, not its name.\n return [`ALTER TABLE ${publicName(step.from)} RENAME TO ${q(step.to)};`];\n case \"renameColumn\":\n return [`ALTER TABLE ${publicName(step.table)} RENAME COLUMN ${q(step.from)} TO ${q(step.to)};`];\n case \"dropForeignKey\":\n return [`ALTER TABLE ${publicName(step.table)} DROP CONSTRAINT ${q(step.constraintName)};`];\n case \"createJoinTable\": {\n // Prisma's implicit join-table shape: columns \"A\"/\"B\", a unique index on\n // (A, B), an index on B, both FKs cascading (see @vibeorm/schema m2m.ts).\n const aType = columnTypeSql({ field: { ...step.a.field, isList: false } });\n const bType = columnTypeSql({ field: { ...step.b.field, isList: false } });\n return [\n `CREATE TABLE ${publicName(step.table)} (\\n \"A\" ${aType} NOT NULL,\\n \"B\" ${bType} NOT NULL\\n);`,\n `CREATE UNIQUE INDEX ${q(`${step.table}_AB_unique`)} ON ${publicName(step.table)} (\"A\", \"B\");`,\n `CREATE INDEX ${q(`${step.table}_B_index`)} ON ${publicName(step.table)} (\"B\");`,\n `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(`${step.table}_A_fkey`)} FOREIGN KEY (\"A\") REFERENCES ${publicName(step.a.table)} (${q(step.a.column)}) ON DELETE CASCADE ON UPDATE CASCADE;`,\n `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(`${step.table}_B_fkey`)} FOREIGN KEY (\"B\") REFERENCES ${publicName(step.b.table)} (${q(step.b.column)}) ON DELETE CASCADE ON UPDATE CASCADE;`,\n ];\n }\n case \"addPrimaryKey\": {\n const cols = step.columns.map((column) => q(column)).join(\", \");\n return [\n `ALTER TABLE ${publicName(step.table)} ADD CONSTRAINT ${q(step.constraintName ?? `${step.table}_pkey`)} PRIMARY KEY (${cols});`,\n ];\n }\n case \"dropPrimaryKey\":\n return [`ALTER TABLE ${publicName(step.table)} DROP CONSTRAINT ${q(step.constraintName ?? `${step.table}_pkey`)};`];\n }\n}\n\n// ─── Column pieces ────────────────────────────────────────────────\n\nfunction columnDefSql(params: { field: FieldIR }): string {\n const { field } = params;\n const name = q(field.dbName ?? field.name);\n\n if (field.default?.kind === \"autoincrement\" && !isIdentityColumn({ field })) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `autoincrement default on \"${field.name}\" requires a non-list Int or BigInt column`,\n meta: { field: field.name },\n });\n }\n\n let def = `${name} ${columnTypeSql({ field })}`;\n if (isIdentityColumn({ field })) def += \" GENERATED BY DEFAULT AS IDENTITY\";\n if (!field.isOptional) def += \" NOT NULL\";\n const defaultExpr = defaultSql({ field });\n if (defaultExpr !== undefined) def += ` DEFAULT ${defaultExpr}`;\n return def;\n}\n\nfunction renderAlterColumn(params: {\n step: Extract<MigrationStep, { kind: \"alterColumn\" }>;\n}): string[] {\n const { step } = params;\n const statements: string[] = [];\n const column = q(step.column);\n const alterPrefix = `ALTER TABLE ${publicName(step.table)} ALTER COLUMN ${column}`;\n\n const storageChange = step.changes.includes(\"type\") && isEnumStringTransition({ from: step.from, to: step.to });\n if (storageChange) assertEnumStringTransition({ from: step.from, to: step.to, dialect: \"postgres\", table: step.table, column: step.column });\n // USING only casts stored rows, not the default expression. Drop a text\n // default before casting to a native enum, then restore the target default.\n const droppedDefault = storageChange && isEnumType(step.to.type) && defaultSql({ field: step.from }) !== undefined;\n if (droppedDefault) statements.push(`${alterPrefix} DROP DEFAULT;`);\n\n if (step.changes.includes(\"type\")) {\n // LEARNINGS: scalar→array of the same base type needs a USING repair —\n // postgres cannot implicit-cast a scalar into a one-element array.\n const scalarToArray =\n step.to.isList && !step.from.isList\n ? ` USING CASE WHEN ${column} IS NULL THEN NULL ELSE ARRAY[${column}] END`\n : \"\";\n statements.push(\n `${alterPrefix} SET DATA TYPE ${columnTypeSql({ field: step.to })}${storageChange ? ` USING ${column}::${columnTypeSql({ field: step.to })}` : scalarToArray};`,\n );\n }\n\n if (step.changes.includes(\"nullability\")) {\n statements.push(`${alterPrefix} ${step.to.isOptional ? \"DROP\" : \"SET\"} NOT NULL;`);\n }\n\n if (step.changes.includes(\"default\") || droppedDefault) {\n if (step.to.default?.kind === \"autoincrement\") {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `cannot add autoincrement to existing column \"${step.table}\".\"${step.column}\" — drop and recreate the column instead`,\n meta: { table: step.table, column: step.column },\n });\n }\n const defaultExpr = defaultSql({ field: step.to });\n statements.push(\n defaultExpr === undefined\n ? `${alterPrefix} DROP DEFAULT;`\n : `${alterPrefix} SET DEFAULT ${defaultExpr};`,\n );\n }\n\n return statements;\n}\n\n// ─── Quoting ──────────────────────────────────────────────────────\n\nfunction publicName(name: string): string {\n return `${q(\"public\")}.${q(name)}`;\n}\n\nfunction q(name: string): string {\n return postgresDialect.quoteIdent({ name });\n}\n",
|
|
43
|
+
"/**\n * SQLite DDL renderer: migration steps → SQL statements, including THE TABLE\n * REBUILD — sqlite has no ALTER COLUMN, cannot add/drop constraints, and its\n * DROP COLUMN is heavily restricted, so any such step compiles to the\n * documented 12-step recipe (https://sqlite.org/lang_altertable.html §7),\n * emitted as an ordered, self-contained statement block:\n *\n * PRAGMA foreign_keys=OFF;\n * BEGIN;\n * CREATE TABLE \"T_new\" (…target shape: columns, PK, FKs, enum CHECKs…);\n * INSERT INTO \"T_new\" (common cols) SELECT common cols FROM \"T\";\n * DROP TABLE \"T\";\n * ALTER TABLE \"T_new\" RENAME TO \"T\";\n * CREATE …INDEX… (every index of the target table);\n * PRAGMA foreign_key_check;\n * COMMIT;\n * PRAGMA foreign_keys=ON;\n *\n * Because the block manages its own transaction (PRAGMA foreign_keys is a\n * no-op inside one), callers must NOT wrap scripts containing it — push and\n * the runner detect this via `usesSelfManagedTransactions` (execute.ts).\n * Rebuild blocks are emitted AFTER all other statements so a rebuilt table's\n * new FKs can reference tables created earlier in the same script — EXCEPT a\n * rebuild that removes an FK to a table this migration drops, which is hoisted\n * ahead of the drops: sqlite's DROP TABLE cascades into surviving child rows\n * while the FK is still installed (F27).\n *\n * Cheap paths are preferred wherever sqlite's plain ALTER suffices:\n * `ADD COLUMN` (unless the column is required without a literal default, or\n * defaults to CURRENT_TIMESTAMP / an expression — both forbidden in ADD\n * COLUMN) and `DROP COLUMN` (unless the column is in the PK, any index or\n * partial-index predicate, an FK on either side, or carries an enum CHECK).\n *\n * Column-value transfer on rebuild: dropped columns are omitted, added\n * columns take their default (or NULL), type-changed columns are a PLAIN COPY\n * — sqlite's flexible typing keeps the stored values as-is, so e.g. non-numeric\n * TEXT survives verbatim inside an INTEGER column (documented lossy-ness:\n * nothing is coerced, nothing is validated beyond the new CHECK constraints).\n *\n * Other pinned choices:\n * - autoincrement renders `INTEGER PRIMARY KEY AUTOINCREMENT` (monotonic ids,\n * Prisma parity) — plain `INTEGER PRIMARY KEY` would reuse rowids after\n * deletes. The `PRIMARY KEY AUTOINCREMENT` text is also the introspection\n * marker. Costs the `sqlite_sequence` bookkeeping table (skipped on pull).\n * - Composite / non-autoincrement PKs render as an unnamed table-level\n * `PRIMARY KEY (…)` (sqlite keeps constraint names only as noise).\n * - Enums render TEXT + a NAMED column-level CHECK (see sqlite-types.ts) —\n * the name (`<table>_<column>_enum_<Enum>`) is how pull recovers the enum.\n * - `DROP TABLE` has no CASCADE on sqlite; table drops are topologically\n * ordered (referencing tables first) using the `from` schema.\n * - Index kinds other than btree/unique throw VIBE_UNSUPPORTED_CAPABILITY.\n */\n\nimport { VibeError, isEnumType, unsupportedCapability } from \"@vibeorm/schema\";\nimport type { EnumIR, FieldIR, SchemaIR } from \"@vibeorm/schema\";\nimport { sqliteDialect } from \"@vibeorm/sql\";\nimport { resolveEnumValues } from \"../enum-values.ts\";\nimport { orderDropsChildrenFirst } from \"./drop-order.ts\";\nimport { normalizeSchema } from \"../normalize.ts\";\nimport type { NormalizedSchema, NormalizedTable } from \"../normalize.ts\";\nimport { CASCADE_ACTION_SQL, quotePgString } from \"../postgres-types.ts\";\nimport {\n sqliteDefaultSql,\n sqliteEnumCheckName,\n sqliteStorageType,\n} from \"../sqlite-types.ts\";\nimport { describeStep } from \"../types.ts\";\nimport type { IndexColumn, MigrationStep, SqlExecutor } from \"../types.ts\";\nimport { isRlsStep, renderRlsStep } from \"./rls.ts\";\n\n// ─── Public API ───────────────────────────────────────────────────\n\n/**\n * Render migration steps to sqlite SQL. `from`/`to` (the schemas that produced\n * the steps) are required whenever a step triggers a table rebuild or renders\n * an enum column — `generateMigration` and `push` always pass them.\n */\nexport function renderSqliteSteps(params: {\n steps: readonly MigrationStep[];\n from?: SchemaIR;\n to?: SchemaIR;\n restore?: ReadonlyMap<string, readonly string[]>;\n preservedColumns?: ReadonlyMap<string, ReadonlyMap<string, { readonly sql: string; readonly generated: boolean }>>;\n}): string[] {\n const { steps } = params;\n for (const step of steps) if (isRlsStep({ step })) renderRlsStep({ step, dialect: \"sqlite\" });\n const fromNorm = params.from === undefined\n ? undefined\n : normalizeSchema({ schema: params.from, dialect: \"sqlite\" });\n const toNorm = params.to === undefined\n ? undefined\n : normalizeSchema({ schema: params.to, dialect: \"sqlite\" });\n const enums: ReadonlyMap<string, EnumIR> = toNorm?.enums ?? new Map();\n\n // ── Classification: which tables need the rebuild recipe? ──\n const { createdTables, foldedFks, rebuildTables } = classifyRebuilds({ steps, fromNorm });\n const rebuildSet = new Set(rebuildTables);\n\n // ── Topological drop order (referencing tables first — no CASCADE). ──\n const dropNames = steps\n .filter((step) => step.kind === \"dropTable\" || step.kind === \"dropJoinTable\")\n .map((step) => (step as Extract<MigrationStep, { kind: \"dropTable\" }>).table);\n const orderedDrops = orderDropsChildrenFirst({ names: dropNames, fromNorm });\n let dropCursor = 0;\n\n // ── Drop-order safety (F27) ──\n // With `PRAGMA foreign_keys=ON` (what every shipped adapter forces) sqlite's\n // DROP TABLE runs an implicit DELETE FROM first, and that fires the child\n // side's ON DELETE CASCADE. A surviving child whose FK this very migration\n // removes would therefore lose its rows — silently — because the FK removal\n // is a rebuild and rebuilds are emitted last. Such a rebuild is HOISTED to\n // run before the first drop; afterwards the parent has no referencing child\n // and its drop deletes nothing but itself.\n const droppedTables = new Set(dropNames);\n const hoistedRebuilds: string[] = [];\n if (droppedTables.size > 0 && fromNorm !== undefined) {\n for (const table of rebuildTables) {\n const releasesDroppedParent = [...(fromNorm.tables.get(table)?.fks.values() ?? [])].some(\n (fk) => droppedTables.has(fk.refTable),\n );\n if (!releasesDroppedParent) continue;\n // The one shape that cannot be ordered: the same rebuild also gains an FK\n // to a table this migration creates (creates come after drops). Refuse\n // instead of choosing between a broken FK and deleted rows.\n const awaitsNewParent = [...(toNorm?.tables.get(table)?.fks.values() ?? [])].some((fk) =>\n createdTables.has(fk.refTable),\n );\n if (awaitsNewParent) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `cannot order this sqlite migration safely: rebuilding \"${table}\" must happen BEFORE the dropped table(s) it references (${[\n ...droppedTables,\n ].join(\", \")}) so their cascade cannot delete its rows, but AFTER the table(s) its new foreign keys reference, which this same migration creates — split it into two migrations`,\n meta: { table, dropped: [...droppedTables] },\n });\n }\n hoistedRebuilds.push(table);\n }\n }\n const hoisted = new Set(hoistedRebuilds);\n let hoistedFlushed = false;\n\n // ── Emission: step order, rebuild-triggering steps absorbed. ──\n const statements: string[] = [];\n const renderRebuildBlock = (table: string): string[] => {\n const step = steps.find(\n (candidate) => \"table\" in candidate && candidate.table === table,\n ) as MigrationStep;\n requireSchemas({ step, fromNorm, toNorm });\n return renderTableRebuild({\n table,\n from: fromNorm as NormalizedSchema,\n to: toNorm as NormalizedSchema,\n restore: params.restore?.get(table) ?? [],\n preservedColumns: params.preservedColumns?.get(table) ?? new Map(),\n });\n };\n for (const step of steps) {\n switch (step.kind) {\n case \"addExclusion\": case \"dropExclusion\": throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: \"Exclusion constraints require PostgreSQL\", meta: { dialect: \"sqlite\", feature: \"exclusionConstraints\" } });\n case \"createEnum\":\n case \"dropEnum\":\n case \"addEnumValue\":\n break; // No standalone enum objects on sqlite — enums live in columns.\n case \"createTable\":\n statements.push(\n createTableSql({\n table: step.table,\n constraintTable: step.table,\n columns: step.columns,\n primaryKey: step.primaryKey,\n checks: step.checks ?? [],\n fks: (foldedFks.get(step.table) ?? []).map((fk) => ({\n constraintName: fk.constraintName,\n columns: fk.columns,\n refTable: fk.refTable,\n refColumns: fk.refColumns,\n onDelete: CASCADE_ACTION_SQL[fk.onDelete],\n onUpdate: CASCADE_ACTION_SQL[fk.onUpdate],\n })),\n enums,\n }),\n );\n break;\n case \"addCheck\":\n case \"dropCheck\":\n break; // Absorbed by the table rebuild classified above.\n case \"createJoinTable\": {\n const aType = sqliteStorageType({ field: { ...step.a.field, isList: false } });\n const bType = sqliteStorageType({ field: { ...step.b.field, isList: false } });\n statements.push(\n `CREATE TABLE ${q(step.table)} (\\n \"A\" ${aType} NOT NULL,\\n \"B\" ${bType} NOT NULL,\\n CONSTRAINT ${q(`${step.table}_A_fkey`)} FOREIGN KEY (\"A\") REFERENCES ${q(step.a.table)} (${q(step.a.column)}) ON DELETE CASCADE ON UPDATE CASCADE,\\n CONSTRAINT ${q(`${step.table}_B_fkey`)} FOREIGN KEY (\"B\") REFERENCES ${q(step.b.table)} (${q(step.b.column)}) ON DELETE CASCADE ON UPDATE CASCADE\\n);`,\n `CREATE UNIQUE INDEX ${q(`${step.table}_AB_unique`)} ON ${q(step.table)} (\"A\", \"B\");`,\n `CREATE INDEX ${q(`${step.table}_B_index`)} ON ${q(step.table)} (\"B\");`,\n );\n break;\n }\n case \"addColumn\":\n if (!rebuildSet.has(step.table)) {\n statements.push(\n `ALTER TABLE ${q(step.table)} ADD COLUMN ${columnDefSql({\n field: step.column,\n constraintTable: step.table,\n enums,\n inlinePkAutoincrement: false,\n })};`,\n );\n }\n break;\n case \"dropColumn\":\n if (!rebuildSet.has(step.table)) {\n statements.push(`ALTER TABLE ${q(step.table)} DROP COLUMN ${q(step.column)};`);\n }\n break;\n case \"createIndex\":\n if (!rebuildSet.has(step.table)) {\n statements.push(\n createIndexSql({\n table: step.table,\n name: step.name,\n unique: step.unique,\n kind: step.indexKind,\n columns: step.columns,\n where: step.where,\n nullsNotDistinct: step.nullsNotDistinct,\n }),\n );\n }\n break;\n case \"dropIndex\":\n // Always emitted — dropping an index of a soon-rebuilt table early is\n // harmless (the rebuild recreates the target set) and keeps the\n // GLOBAL index namespace clean for later creates.\n statements.push(`DROP INDEX ${q(step.name)};`);\n break;\n case \"dropTable\":\n case \"dropJoinTable\":\n if (!hoistedFlushed) {\n hoistedFlushed = true;\n for (const table of hoistedRebuilds) statements.push(...renderRebuildBlock(table));\n }\n statements.push(`DROP TABLE ${q(orderedDrops[dropCursor] as string)};`);\n dropCursor += 1;\n break;\n case \"dropView\":\n // Ordered first by the differ (#26) — a leftover view would otherwise\n // block the column drops (or rebuilds) beneath it.\n statements.push(`DROP VIEW IF EXISTS ${q(step.table)};`);\n break;\n case \"renameTable\":\n case \"renameColumn\": {\n // sqlite renames are real ALTERs (3.25+) and preserve rows, defaults\n // and indexes. They cannot be combined with a rebuild of the same\n // table in one migration: the rebuild recipe is written against one\n // table name, so the order would decide the outcome. Split them.\n const renamed = step.kind === \"renameTable\" ? step.from : step.table;\n if (rebuildSet.has(renamed) || (step.kind === \"renameTable\" && rebuildSet.has(step.to))) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `sqlite cannot rename \"${renamed}\" in the same migration that rebuilds it — the table-rebuild recipe is written against a single table name. Split the rename and the column/constraint change into two migrations`,\n meta: { reason: \"rename-ambiguous\", table: renamed, dialect: \"sqlite\" },\n });\n }\n statements.push(\n step.kind === \"renameTable\"\n ? `ALTER TABLE ${q(step.from)} RENAME TO ${q(step.to)};`\n : `ALTER TABLE ${q(step.table)} RENAME COLUMN ${q(step.from)} TO ${q(step.to)};`,\n );\n break;\n }\n case \"addForeignKeyNotValid\":\n case \"addCheckNotValid\":\n case \"validateConstraint\":\n // sqlite has no NOT VALID / VALIDATE split, and its constraint changes\n // go through a full table rebuild anyway — there is no staged path to\n // offer, so it refuses instead of pretending.\n throw unsupportedCapability({\n dialect: \"sqlite\",\n feature: \"stagedConstraints\",\n hint: \"sqlite applies constraint changes by rebuilding the table; add the constraint in one step\",\n });\n case \"alterColumn\":\n case \"addForeignKey\":\n case \"dropForeignKey\":\n case \"addPrimaryKey\":\n case \"dropPrimaryKey\":\n if (\n (step.kind === \"addForeignKey\" && createdTables.has(step.table)) ||\n !rebuildSet.has(step.table)\n ) {\n break; // Folded into CREATE TABLE, or absorbed by that table's rebuild.\n }\n requireSchemas({ step, fromNorm, toNorm });\n break;\n }\n }\n\n // ── Rebuild blocks last (new FK targets already exist by now). ──\n for (const table of rebuildTables) {\n if (hoisted.has(table)) continue; // Already emitted ahead of the drops.\n statements.push(...renderRebuildBlock(table));\n }\n\n return statements;\n}\n\n// ─── Rebuild classification ───────────────────────────────────────\n\ntype RebuildClassification = {\n readonly createdTables: ReadonlySet<string>;\n readonly foldedFks: ReadonlyMap<string, Extract<MigrationStep, { kind: \"addForeignKey\" }>[]>;\n /** Insertion order = deterministic block order. */\n readonly rebuildTables: readonly string[];\n};\n\nfunction classifyRebuilds(params: {\n steps: readonly MigrationStep[];\n fromNorm: NormalizedSchema | undefined;\n}): RebuildClassification {\n const { steps, fromNorm } = params;\n const createdTables = new Set<string>();\n for (const step of steps) {\n if (step.kind === \"createTable\" || step.kind === \"createJoinTable\") {\n createdTables.add(step.table);\n }\n }\n\n const foldedFks = new Map<string, Extract<MigrationStep, { kind: \"addForeignKey\" }>[]>();\n const rebuildTables: string[] = [];\n const markRebuild = (table: string): void => {\n if (!rebuildTables.includes(table)) rebuildTables.push(table);\n };\n\n for (const step of steps) {\n switch (step.kind) {\n case \"addExclusion\": case \"dropExclusion\": throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: \"Exclusion constraints require PostgreSQL\", meta: { dialect: \"sqlite\", feature: \"exclusionConstraints\" } });\n case \"alterColumn\":\n case \"dropForeignKey\":\n case \"addPrimaryKey\":\n case \"dropPrimaryKey\":\n // sqlite has no ALTER for CHECK constraints — both directions rebuild.\n case \"addCheck\":\n case \"dropCheck\":\n markRebuild(step.table);\n break;\n case \"addColumn\":\n if (!isCheapAddColumn({ field: step.column })) markRebuild(step.table);\n break;\n case \"dropColumn\":\n if (!canCheapDropColumn({ table: step.table, column: step.column, fromNorm })) {\n markRebuild(step.table);\n }\n break;\n case \"addForeignKey\":\n if (createdTables.has(step.table)) {\n const list = foldedFks.get(step.table);\n if (list === undefined) foldedFks.set(step.table, [step]);\n else list.push(step);\n } else {\n markRebuild(step.table);\n }\n break;\n default:\n break;\n }\n }\n return { createdTables, foldedFks, rebuildTables };\n}\n\n/**\n * Tables whose sqlite DDL will DROP and re-create them (the rebuild recipe) or\n * drop them outright — i.e. every table that loses its attached objects.\n * SQLite's `DROP TABLE` takes the table's triggers with it, and the rebuild\n * restores only the core indexes, so callers holding extension artifacts (FTS\n * synchronization triggers) must re-create theirs afterwards (F31).\n */\nexport function sqliteInvalidatedTables(params: {\n steps: readonly MigrationStep[];\n from?: SchemaIR;\n}): { rebuilt: Set<string>; dropped: Set<string> } {\n const fromNorm = params.from === undefined\n ? undefined\n : normalizeSchema({ schema: params.from, dialect: \"sqlite\" });\n const rebuilt = new Set(classifyRebuilds({ steps: params.steps, fromNorm }).rebuildTables);\n const dropped = new Set<string>();\n for (const step of params.steps) {\n if (step.kind === \"dropTable\" || step.kind === \"dropJoinTable\") dropped.add(step.table);\n }\n return { rebuilt, dropped };\n}\n\n/** Refuse live rebuilds whose table-level guarantees the IR cannot reproduce. */\nexport async function assertSqliteRebuildTableOptions(params: {\n executor: SqlExecutor;\n tables: ReadonlySet<string>;\n}): Promise<void> {\n if (params.tables.size === 0) return;\n const rows = await params.executor({ text: \"PRAGMA main.table_list;\", values: [] });\n for (const table of params.tables) {\n const row = rows.find((entry) => entry.schema === \"main\" && entry.name === table);\n if (row === undefined || Number(row.strict) !== 0 || Number(row.wr) !== 0) {\n throw unsupportedCapability({ dialect: \"sqlite\", feature: \"sqliteRebuildTableOptions\", hint: `Cannot reproduce the existing table options of \"${table}\"; use a reviewed migration that preserves STRICT and WITHOUT ROWID` });\n }\n }\n}\n\n// ─── The table rebuild ────────────────────────────────────────────\n\nfunction renderTableRebuild(params: {\n table: string;\n from: NormalizedSchema;\n to: NormalizedSchema;\n restore: readonly string[];\n preservedColumns: ReadonlyMap<string, { readonly sql: string; readonly generated: boolean }>;\n}): string[] {\n const { table, from, to } = params;\n const source = from.tables.get(table);\n const target = to.tables.get(table);\n if (source === undefined || target === undefined) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `cannot rebuild \"${table}\" — the table is missing from the ${source === undefined ? \"from\" : \"to\"} schema`,\n meta: { table },\n });\n }\n\n const tmp = `${table}_new`;\n const statements: string[] = [\"PRAGMA foreign_keys=OFF;\", \"BEGIN;\"];\n\n statements.push(\n createTableSql({\n table: tmp,\n // CHECK-constraint names carry the FINAL table name so introspection\n // recovers enums after the RENAME.\n constraintTable: table,\n columns: [...target.columns.values()].map((column) => column.field),\n primaryKey: target.pk,\n checks: [...target.checks].map(([name, expression]) => ({ name, expression })),\n fks: [...target.fks.values()].map((fk) => ({\n constraintName: fk.constraintName,\n columns: fk.columns,\n refTable: fk.refTable,\n refColumns: fk.refColumns,\n onDelete: CASCADE_ACTION_SQL[fk.onDelete],\n onUpdate: CASCADE_ACTION_SQL[fk.onUpdate],\n })),\n enums: to.enums,\n preservedColumns: params.preservedColumns,\n }),\n );\n\n // Transfer: target-order intersection of the two column sets. Dropped\n // columns are omitted; added columns take their default/NULL; type changes\n // copy values verbatim (see module doc for the lossy-ness contract).\n const common = [...new Set([...target.columns.keys(), ...params.preservedColumns.keys()])].filter((name) => params.preservedColumns.get(name)?.generated !== true && (source.columns.has(name) || params.preservedColumns.has(name)));\n if (common.length === 0) {\n throw unsupportedCapability({ dialect: \"sqlite\", feature: \"sqliteRebuildWithoutRowTransfer\", hint: `Rebuilding \"${table}\" has no transferable columns and would discard every row; use explicit renames or a reviewed data migration` });\n }\n const cols = common.map((name) => q(name)).join(\", \");\n statements.push(`INSERT INTO ${q(tmp)} (${cols}) SELECT ${cols} FROM ${q(table)};`);\n\n // Preserve deleted-ID history, including empty sources. The replacement's\n // sequence row might not exist yet; never lower a value advanced by the copy.\n const sourceAuto = autoincrementPkColumn({ columns: [...source.columns.values()].map((column) => column.field), primaryKey: source.pk });\n const targetAuto = autoincrementPkColumn({ columns: [...target.columns.values()].map((column) => column.field), primaryKey: target.pk });\n if (sourceAuto !== undefined && targetAuto !== undefined) {\n const sourceName = quotePgString({ value: table });\n const targetName = quotePgString({ value: tmp });\n statements.push(\n `INSERT INTO \"sqlite_sequence\" (\"name\", \"seq\") SELECT ${targetName}, \"seq\" FROM \"sqlite_sequence\" WHERE \"name\" = ${sourceName} AND NOT EXISTS (SELECT 1 FROM \"sqlite_sequence\" WHERE \"name\" = ${targetName});`,\n `UPDATE \"sqlite_sequence\" SET \"seq\" = MAX(\"seq\", COALESCE((SELECT \"seq\" FROM \"sqlite_sequence\" WHERE \"name\" = ${sourceName}), 0)) WHERE \"name\" = ${targetName};`,\n );\n }\n\n statements.push(`DROP TABLE ${q(table)};`, `ALTER TABLE ${q(tmp)} RENAME TO ${q(table)};`);\n\n for (const index of target.indexes.values()) {\n statements.push(\n createIndexSql({\n table,\n name: index.name,\n unique: index.unique,\n kind: index.kind,\n columns: index.columns,\n where: index.where,\n nullsNotDistinct: index.nullsNotDistinct,\n }),\n );\n }\n\n statements.push(...params.restore, \"PRAGMA foreign_key_check;\", \"COMMIT;\", \"PRAGMA foreign_keys=ON;\");\n return statements;\n}\n\n// ─── Cheap-path detection ─────────────────────────────────────────\n\n/**\n * `ALTER TABLE … ADD COLUMN` suffices unless sqlite forbids the shape: the\n * new column may not default to CURRENT_* or an expression, and a NOT NULL\n * column needs a literal default (app-level id generators provide none).\n */\nfunction isCheapAddColumn(params: { field: FieldIR }): boolean {\n const { field } = params;\n const kind = field.default?.kind;\n if (kind === \"autoincrement\" || kind === \"now\" || kind === \"dbgenerated\") return false;\n const hasLiteralDefault = kind === \"literal\" || kind === \"enumValue\";\n if (!field.isOptional && !hasLiteralDefault) return false;\n return true;\n}\n\n/**\n * `ALTER TABLE … DROP COLUMN` works only when nothing references the column:\n * not the PK, no index (or partial-index predicate), no FK on either side, no\n * enum CHECK. Without the `from` schema the answer is unknowable → rebuild.\n */\nfunction canCheapDropColumn(params: {\n table: string;\n column: string;\n fromNorm: NormalizedSchema | undefined;\n}): boolean {\n const { table, column, fromNorm } = params;\n if (fromNorm === undefined) return false;\n const fromTable = fromNorm.tables.get(table);\n if (fromTable === undefined) return false;\n\n if (fromTable.pk.includes(column)) return false;\n const normalized = fromTable.columns.get(column);\n if (normalized !== undefined && isEnumType(normalized.field.type)) return false;\n for (const index of fromTable.indexes.values()) {\n if (index.columns.some((indexColumn) => indexColumn.name === column)) return false;\n if (index.where !== undefined && index.where.includes(column)) return false;\n }\n for (const fk of fromTable.fks.values()) {\n if (fk.columns.includes(column)) return false;\n }\n for (const other of fromNorm.tables.values()) {\n for (const fk of other.fks.values()) {\n if (fk.refTable === table && fk.refColumns.includes(column)) return false;\n }\n }\n return true;\n}\n\n// ─── Table & column pieces ────────────────────────────────────────\n\ntype InlineFk = {\n readonly constraintName: string;\n readonly columns: readonly string[];\n readonly refTable: string;\n readonly refColumns: readonly string[];\n readonly onDelete: string;\n readonly onUpdate: string;\n};\n\nfunction createTableSql(params: {\n table: string;\n /** Table name used in CHECK-constraint names (the FINAL name on rebuilds). */\n constraintTable: string;\n columns: readonly FieldIR[];\n primaryKey: readonly string[];\n /** User-declared named CHECK constraints (raw expressions, verbatim). */\n checks: readonly { readonly name: string; readonly expression: string }[];\n fks: readonly InlineFk[];\n enums: ReadonlyMap<string, EnumIR>;\n preservedColumns?: ReadonlyMap<string, { readonly sql: string; readonly generated: boolean }>;\n}): string {\n const { table, constraintTable, columns, primaryKey, fks, enums } = params;\n\n const autoincrementPk = autoincrementPkColumn({ columns, primaryKey });\n const lines = columns.map(\n (field) =>\n ` ${params.preservedColumns?.get(field.dbName ?? field.name)?.sql ?? columnDefSql({\n field,\n constraintTable,\n enums,\n inlinePkAutoincrement: (field.dbName ?? field.name) === autoincrementPk,\n })}`,\n );\n\n for (const [name, column] of params.preservedColumns ?? []) {\n if (!columns.some((field) => (field.dbName ?? field.name) === name)) lines.push(` ${column.sql}`);\n }\n if (primaryKey.length > 0 && autoincrementPk === undefined) {\n lines.push(` PRIMARY KEY (${primaryKey.map((column) => q(column)).join(\", \")})`);\n }\n for (const check of params.checks) {\n lines.push(` CONSTRAINT ${q(check.name)} CHECK (${check.expression})`);\n }\n for (const fk of fks) {\n lines.push(\n ` CONSTRAINT ${q(fk.constraintName)} FOREIGN KEY (${fk.columns.map((column) => q(column)).join(\", \")}) REFERENCES ${q(fk.refTable)} (${fk.refColumns.map((column) => q(column)).join(\", \")}) ON DELETE ${fk.onDelete} ON UPDATE ${fk.onUpdate}`,\n );\n }\n\n return `CREATE TABLE ${q(table)} (\\n${lines.join(\",\\n\")}\\n);`;\n}\n\n/**\n * The db name of the single autoincrement Int/BigInt PK column — the one\n * column rendered inline as `INTEGER PRIMARY KEY AUTOINCREMENT` — or\n * undefined when the table has no such PK.\n */\nfunction autoincrementPkColumn(params: {\n columns: readonly FieldIR[];\n primaryKey: readonly string[];\n}): string | undefined {\n const { columns, primaryKey } = params;\n if (primaryKey.length !== 1) return undefined;\n const pkName = primaryKey[0] as string;\n const field = columns.find((candidate) => (candidate.dbName ?? candidate.name) === pkName);\n if (field === undefined) return undefined;\n const eligible =\n field.default?.kind === \"autoincrement\" &&\n !field.isList &&\n !isEnumType(field.type) &&\n (field.type === \"Int\" || field.type === \"BigInt\");\n return eligible ? pkName : undefined;\n}\n\nfunction columnDefSql(params: {\n field: FieldIR;\n constraintTable: string;\n enums: ReadonlyMap<string, EnumIR>;\n inlinePkAutoincrement: boolean;\n}): string {\n const { field, constraintTable, enums, inlinePkAutoincrement } = params;\n const name = field.dbName ?? field.name;\n\n if (field.default?.kind === \"autoincrement\" && !inlinePkAutoincrement) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `autoincrement on sqlite requires \"${field.name}\" to be the single-column Int or BigInt primary key`,\n meta: { field: field.name },\n });\n }\n if (inlinePkAutoincrement) {\n return `${q(name)} INTEGER PRIMARY KEY AUTOINCREMENT`;\n }\n\n let def = `${q(name)} ${sqliteStorageType({ field })}`;\n if (!field.isOptional) def += \" NOT NULL\";\n const defaultExpr = sqliteDefaultSql({ field });\n if (defaultExpr !== undefined) def += ` DEFAULT ${defaultExpr}`;\n\n if (isEnumType(field.type) && field.isUnsupported !== true) {\n const enumName = field.type.enum;\n const values = resolveEnumValues({ name: enumName, enums });\n if (values === undefined) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `enum \"${enumName}\" on column \"${field.name}\" is not declared in the schema — sqlite rendering needs the target schema's enums for the CHECK constraint`,\n meta: { field: field.name, enum: enumName },\n });\n }\n const check = sqliteEnumCheckName({ table: constraintTable, column: name, enumName });\n def += ` CONSTRAINT ${q(check)} CHECK (${q(name)} IN (${values\n .map((value) => quotePgString({ value }))\n .join(\", \")}))`;\n }\n\n return def;\n}\n\nfunction createIndexSql(params: {\n table: string;\n name: string;\n unique: boolean;\n kind: string;\n columns: readonly IndexColumn[];\n where: string | undefined;\n nullsNotDistinct?: boolean | undefined;\n}): string {\n const { table, name, unique, kind, columns, where } = params;\n if (params.nullsNotDistinct === true) {\n throw unsupportedCapability({\n dialect: \"sqlite\",\n feature: `UNIQUE NULLS NOT DISTINCT (index \"${name}\")`,\n hint: \"sqlite treats NULLs as distinct in unique indexes and has no switch — gate the flag per dialect\",\n });\n }\n if (!unique && kind !== \"btree\") {\n throw unsupportedCapability({\n dialect: \"sqlite\",\n feature: `index kind \"${kind}\" (index \"${name}\")`,\n hint: \"sqlite indexes are btree only; use an extension-specific virtual table for others\",\n });\n }\n // SQLITE-2: a Decimal column stores as TEXT and every compare/order site\n // reads CAST(col AS REAL) (B4) — a plain-column index can never serve those\n // (EQP-proven SCAN with the index present). Index the same expression, so\n // sqlite's expression-index matching kicks in.\n const cols = columns\n .map(\n (column) =>\n `${column.decimal === true ? `CAST(${q(column.name)} AS REAL)` : q(column.name)}${column.desc ? \" DESC\" : \"\"}`,\n )\n .join(\", \");\n const whereClause = where === undefined ? \"\" : ` WHERE ${where}`;\n return `CREATE ${unique ? \"UNIQUE \" : \"\"}INDEX ${q(name)} ON ${q(table)} (${cols})${whereClause};`;\n}\n\n// ─── Drop ordering ────────────────────────────────────────────────\n\n\n// ─── Context guard & quoting ──────────────────────────────────────\n\nfunction requireSchemas(params: {\n step: MigrationStep;\n fromNorm: NormalizedSchema | undefined;\n toNorm: NormalizedSchema | undefined;\n}): void {\n const { step, fromNorm, toNorm } = params;\n if (fromNorm !== undefined && toNorm !== undefined) return;\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `sqlite step \"${describeStep({ step })}\" requires a table rebuild — renderSteps needs the { from, to } schemas to construct it`,\n meta: { step: step.kind },\n });\n}\n\nfunction q(name: string): string {\n return sqliteDialect.quoteIdent({ name });\n}\n",
|
|
44
|
+
"/**\n * Topological ordering for DROP TABLE statements — children (referencing\n * tables) first.\n *\n * postgres never needs this: `DROP TABLE … CASCADE` takes inbound FK\n * constraints with it. sqlite and mysql have no working cascade for inbound\n * foreign keys — mysql refuses outright (errno 3730\n * `ER_FK_CANNOT_DROP_PARENT`, observed live on 8.4 when a fixture switch\n * dropped `Project` while the also-being-dropped `ProjectMember` still\n * referenced it). ONE shared implementation, consumed by both renderers —\n * the LEARNINGS rule: a structural rule is never re-implemented per consumer.\n */\n\nimport type { NormalizedSchema } from \"../normalize.ts\";\n\n/**\n * Order the tables in `names` so that no table is dropped while another\n * to-be-dropped table still references it. Tables unknown to `fromNorm` (or a\n * missing `fromNorm`, or a reference cycle) fall back to the given order —\n * rendering proceeds and the server reports what it cannot do (dialect\n * honesty beats silently dropping statements).\n */\nexport function orderDropsChildrenFirst(params: {\n names: readonly string[];\n fromNorm: NormalizedSchema | undefined;\n}): string[] {\n const { names, fromNorm } = params;\n if (fromNorm === undefined || names.length < 2) return [...names];\n\n const references = new Map<string, ReadonlySet<string>>();\n for (const name of names) {\n const table = fromNorm.tables.get(name);\n if (table !== undefined) {\n references.set(name, new Set([...table.fks.values()].map((fk) => fk.refTable)));\n continue;\n }\n const joinTable = fromNorm.joinTables.get(name);\n if (joinTable !== undefined) {\n references.set(name, new Set([joinTable.a.table, joinTable.b.table]));\n continue;\n }\n references.set(name, new Set());\n }\n\n const remaining = new Set(names);\n const result: string[] = [];\n while (remaining.size > 0) {\n let progressed = false;\n for (const name of names) {\n if (!remaining.has(name)) continue;\n const stillReferenced = [...remaining].some(\n (other) => other !== name && (references.get(other) ?? new Set()).has(name),\n );\n if (!stillReferenced) {\n result.push(name);\n remaining.delete(name);\n progressed = true;\n }\n }\n if (!progressed) {\n for (const name of names) if (remaining.has(name)) result.push(name);\n break;\n }\n }\n return result;\n}\n",
|
|
45
|
+
"/**\n * Public types of @vibeorm/migrate: the executor contract, the dialect-neutral\n * migration step model, and the runner's file/result shapes.\n *\n * Steps carry Schema-IR fragments (FieldIR, EnumIR) — never SQL text. SQL is\n * produced exclusively by the per-dialect renderers (ddl-postgres.ts), so every\n * SQL-text decision stays reviewable in one place (constitution rule 3/4).\n */\n\nimport type { CascadeAction, CheckIR, Dialect, EnumIR, FieldIR, SchemaIR } from \"@vibeorm/schema\";\nimport type { ExclusionIR } from \"@vibeorm/schema\";\nimport type { MigrationExecution } from \"./execution.ts\";\nimport type { DesiredState, MigrationDesiredState } from \"./desired-state.ts\";\nimport type { MigrationObjectState } from \"./inspect-objects.ts\";\nimport type { SqlObjectIdentity } from \"@vibeorm/schema\";\n\n// ─── Executor ─────────────────────────────────────────────────────\n\n/**\n * Minimal SQL execution contract the migrate engine runs on. Structurally\n * identical to @vibeorm/runtime's `SqlExecutor` (its `toSqlExecutor` bridges a\n * DatabaseAdapter to this shape) — declared here so the dependency direction\n * stays schema ← sql ← migrate.\n *\n * SESSION AFFINITY: the migrate engine issues session-scoped statements\n * through this contract (BEGIN/COMMIT, `PRAGMA foreign_keys`, advisory locks\n * `pg_advisory_lock` / `GET_LOCK`), so every call MUST hit the same database\n * session. Single-connection adapters (pglite, sqlite) satisfy this by\n * construction; pool-backed executors must pin one connection for the whole\n * migrate operation.\n */\nexport type SqlExecutor = ((params: {\n text: string;\n values?: unknown[];\n}) => Promise<Record<string, unknown>[]>) & {\n /** Reserve one session before lock acquisition; its callback receives a pinned executor. */\n readonly withSession?: <T>(params: { run: (executor: SqlExecutor) => Promise<T> }) => Promise<T>;\n};\n\n// ─── Step building blocks ─────────────────────────────────────────\n\n/** Which aspects of a column an `alterColumn` step changes. */\nexport type AlterColumnAspect = \"type\" | \"nullability\" | \"default\" | \"collation\";\n\n/** One column of an index, with its sort direction. */\nexport type IndexColumn = {\n readonly name: string;\n readonly desc: boolean;\n /**\n * The field is a Decimal (SQLITE-2, SQL review round 2). Inert everywhere\n * except the sqlite DDL renderer: Decimal stores as TEXT there and every\n * compare/order site reads `CAST(col AS REAL)` (B4), which a plain-column\n * index can never serve (EQP-proven SCAN) — sqlite renders an EXPRESSION\n * index over the same cast instead. Not part of the index comparison key:\n * both sides compare by column name + direction.\n */\n readonly decimal?: boolean;\n};\n\n/** One side of an implicit many-to-many join table. */\nexport type JoinTableEnd = {\n /** Referenced table (db name). */\n readonly table: string;\n /** Referenced primary-key column (db name). */\n readonly column: string;\n /** The referenced primary-key field — its type renders the join column's type. */\n readonly field: FieldIR;\n};\n\n// ─── Steps ────────────────────────────────────────────────────────\n\n/**\n * A dialect-neutral migration step produced by `diffSchemas`. `destructive`\n * marks steps that can lose data (dropTable / dropJoinTable / dropColumn /\n * dropEnum / narrowing type changes) — `push` refuses them without\n * `acceptDataLoss`, and `generateMigration` surfaces the flag.\n */\nexport type MigrationStep = (\n | { readonly kind: \"addExclusion\" | \"dropExclusion\"; readonly table: string; readonly exclusion: ExclusionIR; readonly destructive: false }\n | {\n readonly kind: \"enableRls\" | \"forceRls\" | \"disableRls\" | \"noForceRls\" | \"dropPolicy\";\n readonly table: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"createPolicy\";\n readonly table: string;\n readonly schema: SchemaIR;\n readonly model: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"createEnum\";\n readonly enumDef: EnumIR;\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropEnum\";\n readonly enumName: string;\n readonly destructive: true;\n }\n | {\n readonly kind: \"addEnumValue\";\n readonly enumName: string;\n readonly value: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"createTable\";\n readonly table: string;\n readonly columns: readonly FieldIR[];\n /** Primary-key column db names (empty = no PK). */\n readonly primaryKey: readonly string[];\n readonly primaryKeyConstraintName?: string;\n /** Named CHECK constraints, rendered into the CREATE TABLE. */\n readonly checks?: readonly CheckIR[];\n readonly destructive: false;\n }\n | {\n readonly kind: \"addCheck\";\n readonly table: string;\n readonly name: string;\n /** Raw SQL expression, rendered verbatim. */\n readonly expression: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropCheck\";\n readonly table: string;\n readonly name: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropTable\";\n readonly table: string;\n readonly destructive: true;\n }\n | {\n readonly kind: \"addColumn\";\n readonly table: string;\n readonly column: FieldIR;\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropColumn\";\n readonly table: string;\n readonly column: string;\n readonly destructive: true;\n }\n | {\n readonly kind: \"alterColumn\";\n readonly table: string;\n /** Column db name. */\n readonly column: string;\n readonly from: FieldIR;\n readonly to: FieldIR;\n readonly changes: readonly AlterColumnAspect[];\n readonly destructive: boolean;\n }\n | {\n readonly kind: \"createIndex\";\n readonly table: string;\n readonly name: string;\n /** IR index kind (\"btree\", \"gin\", …) — `unique` indexes are always btree. */\n readonly indexKind: string;\n readonly unique: boolean;\n readonly columns: readonly IndexColumn[];\n /** Partial-index predicate, raw SQL. */\n readonly where?: string;\n /** `UNIQUE NULLS NOT DISTINCT` (postgres 15+; sqlite/mysql renderers refuse). */\n readonly nullsNotDistinct?: boolean;\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropIndex\";\n readonly name: string;\n /** PostgreSQL unique-constraint backing indexes are dropped via their owner. */\n readonly constraintName?: string;\n /**\n * Table the index belongs to. Optional for postgres/sqlite (their DROP\n * INDEX is schema-global) but REQUIRED by the mysql renderer\n * (`DROP INDEX … ON table`); the differ always fills it.\n */\n readonly table?: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"addForeignKey\";\n readonly table: string;\n readonly constraintName: string;\n readonly columns: readonly string[];\n readonly refTable: string;\n readonly refColumns: readonly string[];\n readonly onDelete: CascadeAction;\n readonly onUpdate: CascadeAction;\n readonly destructive: false;\n }\n | {\n /**\n * Stage a foreign key without validating existing rows (postgres\n * `NOT VALID`). Skips the scan, NOT the brief ACCESS EXCLUSIVE lock;\n * `validateConstraint` finishes the job under a weaker lock. sqlite and\n * mysql have no such split and refuse this step.\n */\n readonly kind: \"addForeignKeyNotValid\";\n readonly table: string;\n readonly constraintName: string;\n readonly columns: readonly string[];\n readonly refTable: string;\n readonly refColumns: readonly string[];\n readonly onDelete: CascadeAction;\n readonly onUpdate: CascadeAction;\n readonly destructive: false;\n }\n | {\n /** Stage a CHECK without validating existing rows (postgres `NOT VALID`). */\n readonly kind: \"addCheckNotValid\";\n readonly table: string;\n readonly name: string;\n /** Raw SQL expression, rendered verbatim. */\n readonly expression: string;\n readonly destructive: false;\n }\n | {\n /** Validate a previously staged NOT VALID constraint (postgres only). */\n readonly kind: \"validateConstraint\";\n readonly table: string;\n readonly name: string;\n readonly destructive: false;\n }\n | {\n /**\n * Rename a physical table, preserving its rows, defaults, indexes and\n * inbound foreign keys. Only ever produced from an EXPLICIT rename\n * intent (renames.ts) — never inferred from a drop/create pair.\n */\n readonly kind: \"renameTable\";\n readonly from: string;\n readonly to: string;\n readonly destructive: false;\n }\n | {\n /** Rename a physical column, preserving its data, default and indexes. */\n readonly kind: \"renameColumn\";\n readonly table: string;\n readonly from: string;\n readonly to: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropForeignKey\";\n readonly table: string;\n readonly constraintName: string;\n readonly destructive: false;\n }\n | {\n readonly kind: \"createJoinTable\";\n readonly table: string;\n readonly a: JoinTableEnd;\n readonly b: JoinTableEnd;\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropJoinTable\";\n readonly table: string;\n readonly destructive: true;\n }\n | {\n readonly kind: \"addPrimaryKey\";\n readonly table: string;\n readonly constraintName?: string;\n readonly columns: readonly string[];\n readonly destructive: false;\n }\n | {\n readonly kind: \"dropPrimaryKey\";\n readonly table: string;\n readonly constraintName?: string;\n readonly destructive: false;\n }\n | {\n /**\n * Drop a view present in the live database but absent from the target\n * schema (board #26). Ordered FIRST — postgres refuses dropping a column\n * a leftover view depends on (2BP01), so removed views must go before\n * the table/column changes they block. Destructive: the view definition\n * is not stored in the IR, so the drop cannot be reversed.\n */\n readonly kind: \"dropView\";\n /** View db name. */\n readonly table: string;\n readonly destructive: true;\n }\n) & {\n /** Separate from data loss: a removal or potentially widening policy replacement. */\n readonly securityChange?: string;\n};\n\n/** One-line human description of a step (refusal messages, CLI output). */\nexport function describeStep(params: { step: MigrationStep }): string {\n const { step } = params;\n switch (step.kind) {\n case \"addExclusion\": return `add exclusion \"${step.exclusion.name}\" on \"${step.table}\"`;\n case \"dropExclusion\": return `drop exclusion \"${step.exclusion.name}\" on \"${step.table}\"`;\n case \"enableRls\": return `enable native RLS on \"${step.table}\"`;\n case \"forceRls\": return `force native RLS on \"${step.table}\"`;\n case \"disableRls\": return `disable native RLS on \"${step.table}\"`;\n case \"noForceRls\": return `remove forced native RLS on \"${step.table}\"`;\n case \"createPolicy\": return `create native RLS policy on \"${step.table}\"`;\n case \"dropPolicy\": return `drop native RLS policy on \"${step.table}\"`;\n case \"createEnum\":\n return `create enum \"${step.enumDef.dbName ?? step.enumDef.name}\"`;\n case \"dropEnum\":\n return `drop enum \"${step.enumName}\"`;\n case \"addEnumValue\":\n return `add value \"${step.value}\" to enum \"${step.enumName}\"`;\n case \"createTable\":\n return `create table \"${step.table}\"`;\n case \"dropTable\":\n return `drop table \"${step.table}\"`;\n case \"addColumn\":\n return `add column \"${step.table}\".\"${step.column.dbName ?? step.column.name}\"`;\n case \"dropColumn\":\n return `drop column \"${step.table}\".\"${step.column}\"`;\n case \"alterColumn\":\n return `alter column \"${step.table}\".\"${step.column}\" (${step.changes.join(\", \")})`;\n case \"createIndex\":\n return `create ${step.unique ? \"unique \" : \"\"}index \"${step.name}\" on \"${step.table}\"`;\n case \"addCheck\":\n return `add check \"${step.name}\" on \"${step.table}\"`;\n case \"dropCheck\":\n return `drop check \"${step.name}\" on \"${step.table}\"`;\n case \"dropIndex\":\n return `drop index \"${step.name}\"`;\n case \"addForeignKey\":\n return `add foreign key \"${step.constraintName}\" on \"${step.table}\"`;\n case \"addForeignKeyNotValid\":\n return `add foreign key \"${step.constraintName}\" on \"${step.table}\" (NOT VALID)`;\n case \"addCheckNotValid\":\n return `add check \"${step.name}\" on \"${step.table}\" (NOT VALID)`;\n case \"validateConstraint\":\n return `validate constraint \"${step.name}\" on \"${step.table}\"`;\n case \"renameTable\":\n return `rename table \"${step.from}\" to \"${step.to}\"`;\n case \"renameColumn\":\n return `rename column \"${step.table}\".\"${step.from}\" to \"${step.to}\"`;\n case \"dropForeignKey\":\n return `drop foreign key \"${step.constraintName}\" on \"${step.table}\"`;\n case \"createJoinTable\":\n return `create join table \"${step.table}\"`;\n case \"dropJoinTable\":\n return `drop join table \"${step.table}\"`;\n case \"addPrimaryKey\":\n return `add primary key on \"${step.table}\"`;\n case \"dropPrimaryKey\":\n return `drop primary key on \"${step.table}\"`;\n case \"dropView\":\n return `drop view \"${step.table}\"`;\n }\n}\n\n// ─── Runner shapes ────────────────────────────────────────────────\n\n/** A named migration: ordered SQL statements plus its aggregate destructiveness. */\nexport type MigrationFile = {\n /** Immutable package origin; absent preserves historical checksum rules. */\n readonly moduleOrigin?: import(\"./module-origin.ts\").ModuleMigrationOrigin;\n /** Reviewed desired state, checksum-bound for new migrations only. */\n readonly desiredState?: MigrationDesiredState;\n /** Offline --empty shell: cannot execute or establish trusted desired state until finalized. */\n readonly desiredStatePending?: true;\n readonly name: string;\n /** One SQL string per statement, in execution order. */\n readonly sql: readonly string[];\n /** True when any underlying step can lose data. */\n readonly destructive: boolean;\n /**\n * Reverse statements (`down.sql`), when the migration carries them.\n * Migrations generated before down-migration support have none —\n * `rollbackMigration` refuses those with a clear error.\n */\n readonly downSql?: readonly string[];\n /** Security changes are not authorized by an ordinary data-loss acknowledgement. */\n readonly securityChanges?: readonly string[];\n readonly downSecurityChanges?: readonly string[];\n /** Trusted source declarations used for drift preflight on generated migrations. */\n readonly rls?: { readonly from: SchemaIR; readonly to: SchemaIR };\n /**\n * Explicit execution semantics (transaction mode, migration-owned session\n * limits, declared per-statement operations). ABSENT means the dialect's\n * existing behaviour, and hashes exactly as it always did — see\n * execution.ts's checksum-compatibility rule.\n */\n readonly execution?: MigrationExecution;\n /** Execution semantics of `downSql`; absent means the dialect's existing behaviour. */\n readonly downExecution?: MigrationExecution;\n};\n\n/** Subset preserves programmatic calls; complete requires an ordered full chain. */\nexport type MigrationHistoryMode = \"subset\" | \"complete\";\n\n/** Pure replay validation before an operation such as reset destroys the database. */\nexport type MigrationReplayOptions = {\n readonly migrations: readonly MigrationFile[];\n readonly dialect?: Dialect;\n readonly acceptSecurityChanges?: boolean;\n readonly acceptIntegrityLoss?: boolean;\n readonly removeUnmanaged?: readonly SqlObjectIdentity[];\n readonly probe?: \"none\" | \"rollback\" | \"temporary\";\n};\n\n/** Result of a lock-held rollback selection and execution. */\nexport type RollbackResult = { readonly rolledBack: readonly string[] };\n\n/** Result of `applyMigrations`. */\nexport type AppliedResult = {\n /** Migrations executed by this call, in order. */\n readonly applied: readonly string[];\n /** Migrations already recorded and verified, skipped. */\n readonly skipped: readonly string[];\n};\n\n/** Result of `migrationStatus`. */\nexport type MigrationStatus = {\n /** Journal rows with no supplied file; omitted when empty for compatibility. */\n readonly unknownFiles?: readonly string[];\n /** Recorded migrations whose checksum matches. */\n readonly applied: readonly string[];\n /** Migrations with no record yet. */\n readonly pending: readonly string[];\n /** Recorded migrations whose checksum no longer matches their SQL. */\n readonly mismatched: readonly string[];\n /**\n * Migrations whose rollback started but did not finish (mysql only — its\n * DDL is non-transactional, so `rollbackMigration` records per-statement\n * progress). Re-run the rollback to resume, or repair with\n * `resolveMigration`.\n */\n readonly rollingBack: readonly string[];\n};\n\n/**\n * How one bookkeeping row stands against the migration file of the same name.\n * `unknown-file` is a recorded migration whose file is missing from the\n * migrations directory — history the tool cannot reverse.\n */\nexport type RecordedMigrationState =\n | \"applied\"\n | \"partial\"\n | \"mismatched\"\n | \"rolling-back\"\n | \"unknown-file\";\n\n/** One row of the `_vibe_migrations` journal, in the order it was written. */\nexport type RecordedMigration = {\n readonly name: string;\n /** Recorded checksum; empty for a `resolveMigration` repair record. */\n readonly checksum: string;\n /** Statements completed; NEGATIVE (-(k+1)) marks an unfinished rollback. */\n readonly statementIndex: number;\n readonly state: RecordedMigrationState;\n};\n\n/** Result of `push`. */\nexport type PushResult = {\n readonly objects?: readonly MigrationObjectState[];\n readonly blocked?: boolean;\n readonly unmanagedRemovals?: readonly SqlObjectIdentity[];\n readonly desiredState?: DesiredState;\n /** The diff that was applied (empty = database already matched). */\n readonly steps: readonly MigrationStep[];\n /** The SQL statements that were executed, in order. */\n readonly applied: readonly string[];\n /** Dry-run statements, never executed. */\n readonly planned?: readonly string[];\n readonly securityChanges?: readonly string[];\n};\n",
|
|
46
|
+
"/**\n * MySQL DDL renderer: migration steps → SQL statements.\n *\n * Every identifier is backtick-quoted through `mysqlDialect.quoteIdent` — the\n * ONE quoting decision point. Pinned choices:\n *\n * - String → varchar(191): utf8mb4 × 4 bytes keeps indexed String columns\n * inside the 767-byte legacy InnoDB index-key limit (`@db.Text` opts out —\n * TEXT columns are never indexed by us; indexing one would need a prefix\n * length we do not emit).\n * - autoincrement renders `AUTO_INCREMENT` (the column must be a key — the\n * PRIMARY KEY clause in the same CREATE TABLE satisfies that; ALTERing one\n * onto an existing column is refused, pg parity).\n * - Enums are inline `ENUM('A', 'B')` column types; the standalone enum steps\n * (createEnum/dropEnum/addEnumValue) render NOTHING — value changes arrive\n * as alterColumn steps (value-based type keys) and render as MODIFY COLUMN\n * with the widened list.\n * - alterColumn type/nullability → one `MODIFY COLUMN` with the full target\n * definition (mysql redefines the column wholesale); default-only changes\n * use `ALTER COLUMN … SET/DROP DEFAULT`.\n * - No partial indexes on mysql → VIBE_UNSUPPORTED_CAPABILITY naming the\n * index. Index kinds other than btree are refused the same way.\n * - `DROP INDEX … ON table` needs the table — the differ's dropIndex steps\n * carry it; a step without one is a VIBE_MIGRATION error.\n * - `DROP TABLE` has no cascade (mysql parses `CASCADE` and ignores it), and\n * dropping a parent still referenced by another to-be-dropped table fails\n * with errno 3730 `ER_FK_CANNOT_DROP_PARENT` (observed live on 8.4). FK\n * drops on SURVIVING tables come from the differ's bucket order; drops of\n * whole dependent groups are topologically reordered children-first here\n * (the shared `orderDropsChildrenFirst`, same rule as sqlite).\n */\n\nimport { VibeError, unsupportedCapability } from \"@vibeorm/schema\";\nimport type { EnumIR, FieldIR, SchemaIR } from \"@vibeorm/schema\";\nimport { mysqlDialect } from \"@vibeorm/sql\";\nimport { orderDropsChildrenFirst } from \"./drop-order.ts\";\nimport { normalizeSchema } from \"../normalize.ts\";\nimport { CASCADE_ACTION_SQL } from \"../postgres-types.ts\";\nimport { mysqlColumnTypeSql, mysqlDefaultSql } from \"../mysql-types.ts\";\nimport type { MigrationStep } from \"../types.ts\";\nimport { isRlsStep, renderRlsStep } from \"./rls.ts\";\nimport { assertEnumStringTransition } from \"../enum-values.ts\";\n\n// ─── Public API ───────────────────────────────────────────────────\n\n/**\n * Render migration steps to mysql SQL. `to` (the target schema) is required\n * whenever an enum column is rendered — the inline `ENUM(…)` type needs the\n * enum's values, which live on the schema, not the step. `from` enables the\n * topological drop order (children before referenced parents); without it,\n * drops render in step order.\n */\nexport function renderMysqlSteps(params: {\n steps: readonly MigrationStep[];\n from?: SchemaIR;\n to?: SchemaIR;\n}): string[] {\n for (const step of params.steps) {\n if (isRlsStep({ step })) renderRlsStep({ step, dialect: \"mysql\" });\n if (step.kind !== \"alterColumn\" || !step.changes.some((change) => change === \"type\" || change === \"nullability\" || change === \"collation\")) continue;\n const owner = [...(params.from?.migrationObjects ?? []), ...(params.to?.migrationObjects ?? [])].find((object) => {\n const identity = object.identity;\n return object.dialect === \"mysql\" && (identity.kind === \"columnDefault\" || identity.kind === \"generatedColumn\" || identity.kind === \"column\") && identity.table.name === step.table && identity.column === step.column;\n });\n if (owner !== undefined) throw unsupportedCapability({ dialect: \"mysql\", feature: \"mysqlOwnedColumnRewrite\", hint: `MODIFY COLUMN would overwrite migration-owned ${owner.id}; use a reviewed migration that preserves the complete column definition` });\n }\n const enums = new Map<string, EnumIR>();\n for (const enumDef of params.to?.enums ?? []) {\n enums.set(enumDef.dbName ?? enumDef.name, enumDef);\n }\n\n // Topological drop order — mysql refuses to drop a parent that another\n // to-be-dropped table still references (no cascade; see module doc).\n const dropNames = params.steps\n .filter((step) => step.kind === \"dropTable\" || step.kind === \"dropJoinTable\")\n .map((step) => (step as Extract<MigrationStep, { kind: \"dropTable\" }>).table);\n const fromNorm =\n params.from === undefined ? undefined : normalizeSchema({ schema: params.from, dialect: \"mysql\" });\n const orderedDrops = orderDropsChildrenFirst({ names: dropNames, fromNorm });\n for (const step of params.steps) {\n if (step.kind !== \"dropPrimaryKey\") continue;\n const table = fromNorm?.tables.get(step.table);\n if (table === undefined) continue;\n const auto = [...table.columns].find(([, column]) => column.field.default?.kind === \"autoincrement\")?.[0];\n if (auto === undefined) continue;\n const retainedIndex = [...table.indexes.values()].some((index) => index.columns[0]?.name === auto && !params.steps.some((candidate) => candidate.kind === \"dropIndex\" && candidate.table === step.table && candidate.name === index.name));\n if (!retainedIndex) throw unsupportedCapability({ dialect: \"mysql\", feature: \"mysqlAutoIncrementKeyRemoval\", hint: `Removing the last leading key of AUTO_INCREMENT column \"${step.table}.${auto}\" requires a reviewed combined ALTER` });\n }\n let dropCursor = 0;\n\n const inlineIndexes = new Map<MigrationStep, Extract<MigrationStep, { kind: \"createIndex\" }>>();\n const consumed = new Set<MigrationStep>();\n for (const step of params.steps) {\n const columns = step.kind === \"createTable\" ? step.columns : step.kind === \"addColumn\" ? [step.column] : [];\n const counters = columns.filter((field) => field.default?.kind === \"autoincrement\");\n if (counters.length > 1) throw unsupportedCapability({ dialect: \"mysql\", feature: \"multiple auto-increment columns\" });\n for (const column of counters) {\n const name = column.dbName ?? column.name;\n if (step.kind === \"createTable\" && step.primaryKey[0] === name) continue;\n if (step.kind !== \"createTable\" && step.kind !== \"addColumn\") continue;\n const key = params.steps.find((candidate): candidate is Extract<MigrationStep, { kind: \"createIndex\" }> => candidate.kind === \"createIndex\" && candidate.table === step.table && candidate.columns[0]?.name === name && !candidate.columns[0]?.desc && candidate.where === undefined && candidate.nullsNotDistinct !== true && (candidate.unique || candidate.indexKind === \"btree\"));\n if (key === undefined) throw unsupportedCapability({ dialect: \"mysql\", feature: `auto-increment column ${step.table}.${name} without an accompanying leading index` });\n inlineIndexes.set(step, key);\n consumed.add(key);\n }\n }\n return params.steps.flatMap((step) => {\n if (consumed.has(step)) return [];\n if (step.kind === \"dropTable\" || step.kind === \"dropJoinTable\") {\n const table = orderedDrops[dropCursor] as string;\n dropCursor += 1;\n return [`DROP TABLE ${q(table)};`];\n }\n return renderStep({ step, enums, inlineIndex: inlineIndexes.get(step) });\n });\n}\n\n// ─── Per-step rendering ───────────────────────────────────────────\n\nfunction renderStep(params: {\n step: MigrationStep;\n enums: ReadonlyMap<string, EnumIR>;\n inlineIndex?: Extract<MigrationStep, { kind: \"createIndex\" }>;\n}): string[] {\n const { step, enums } = params;\n switch (step.kind) {\n case \"enableRls\":\n case \"forceRls\":\n case \"disableRls\":\n case \"noForceRls\":\n case \"createPolicy\":\n case \"dropPolicy\":\n return renderRlsStep({ step, dialect: \"mysql\" });\n case \"createEnum\":\n case \"dropEnum\":\n case \"addEnumValue\":\n return []; // Enums are inline column types on mysql.\n case \"createTable\": {\n const lines = step.columns.map((column) => ` ${columnDefSql({ field: column, enums })}`);\n if (step.primaryKey.length > 0) {\n lines.push(` PRIMARY KEY (${step.primaryKey.map((column) => q(column)).join(\", \")})`);\n }\n if (params.inlineIndex !== undefined) lines.push(` ${inlineIndexSql({ index: params.inlineIndex })}`);\n for (const check of step.checks ?? []) {\n lines.push(` CONSTRAINT ${q(check.name)} CHECK (${check.expression})`);\n }\n return [`CREATE TABLE ${q(step.table)} (\\n${lines.join(\",\\n\")}\\n);`];\n }\n case \"dropTable\":\n case \"dropJoinTable\":\n return [`DROP TABLE ${q(step.table)};`];\n case \"dropView\":\n return [`DROP VIEW IF EXISTS ${q(step.table)};`];\n case \"addColumn\":\n return [\n `ALTER TABLE ${q(step.table)} ADD COLUMN ${columnDefSql({ field: step.column, enums })}${params.inlineIndex === undefined ? \"\" : `, ADD ${inlineIndexSql({ index: params.inlineIndex })}`};`,\n ];\n case \"dropColumn\":\n return [`ALTER TABLE ${q(step.table)} DROP COLUMN ${q(step.column)};`];\n case \"alterColumn\":\n return renderAlterColumn({ step, enums });\n case \"createIndex\": {\n if (step.where !== undefined) {\n throw unsupportedCapability({\n dialect: \"mysql\",\n feature: `partial index \"${step.name}\"`,\n hint: \"mysql has no partial indexes — drop the WHERE predicate or gate the index per dialect\",\n });\n }\n if (step.nullsNotDistinct === true) {\n throw unsupportedCapability({\n dialect: \"mysql\",\n feature: `UNIQUE NULLS NOT DISTINCT (index \"${step.name}\")`,\n hint: \"mysql treats NULLs as distinct in unique indexes and has no switch — gate the flag per dialect\",\n });\n }\n if (!step.unique && step.indexKind !== \"btree\") {\n throw unsupportedCapability({\n dialect: \"mysql\",\n feature: `index kind \"${step.indexKind}\" (index \"${step.name}\")`,\n hint: \"mysql secondary indexes are btree only\",\n });\n }\n const cols = step.columns\n .map((column) => `${q(column.name)}${column.desc ? \" DESC\" : \"\"}`)\n .join(\", \");\n return [\n `CREATE ${step.unique ? \"UNIQUE \" : \"\"}INDEX ${q(step.name)} ON ${q(step.table)} (${cols});`,\n ];\n }\n case \"addCheck\":\n // MySQL 8.0.16+ parses AND enforces CHECK constraints.\n return [\n `ALTER TABLE ${q(step.table)} ADD CONSTRAINT ${q(step.name)} CHECK (${step.expression});`,\n ];\n case \"addExclusion\": case \"dropExclusion\": throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: \"Exclusion constraints require PostgreSQL\", meta: { dialect: \"mysql\", feature: \"exclusionConstraints\" } });\n case \"dropCheck\":\n return [`ALTER TABLE ${q(step.table)} DROP CHECK ${q(step.name)};`];\n case \"dropIndex\": {\n if (step.table === undefined) {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `dropIndex \"${step.name}\" carries no table — mysql's DROP INDEX requires one`,\n meta: { index: step.name },\n });\n }\n return [`DROP INDEX ${q(step.name)} ON ${q(step.table)};`];\n }\n case \"addForeignKey\": {\n const cols = step.columns.map((column) => q(column)).join(\", \");\n const refCols = step.refColumns.map((column) => q(column)).join(\", \");\n return [\n `ALTER TABLE ${q(step.table)} ADD CONSTRAINT ${q(step.constraintName)} FOREIGN KEY (${cols}) REFERENCES ${q(step.refTable)} (${refCols}) ON DELETE ${CASCADE_ACTION_SQL[step.onDelete]} ON UPDATE ${CASCADE_ACTION_SQL[step.onUpdate]};`,\n ];\n }\n case \"renameTable\":\n return [`ALTER TABLE ${q(step.from)} RENAME TO ${q(step.to)};`];\n case \"renameColumn\":\n // MySQL 8.0.0+. The column keeps its type, default, indexes and inbound\n // foreign keys; only the name moves.\n return [`ALTER TABLE ${q(step.table)} RENAME COLUMN ${q(step.from)} TO ${q(step.to)};`];\n case \"addForeignKeyNotValid\":\n case \"addCheckNotValid\":\n case \"validateConstraint\":\n // MySQL has no NOT VALID / VALIDATE split: a constraint is checked when\n // it is added, full stop. Refusing is the honest answer — silently\n // emitting the ordinary ADD would promise a staged rollout that is not\n // happening. (`ALTER TABLE ... WITHOUT VALIDATION` exists only for\n // partition exchange, not for constraints.)\n throw unsupportedCapability({\n dialect: \"mysql\",\n feature: \"stagedConstraints\",\n hint: \"MySQL validates a constraint when it is added; add it in one step, or take the outage window that scan needs\",\n });\n case \"dropForeignKey\":\n return [`ALTER TABLE ${q(step.table)} DROP FOREIGN KEY ${q(step.constraintName)};`];\n case \"createJoinTable\": {\n const aType = mysqlColumnTypeSql({ field: { ...step.a.field, isList: false }, enums });\n const bType = mysqlColumnTypeSql({ field: { ...step.b.field, isList: false }, enums });\n return [\n `CREATE TABLE ${q(step.table)} (\\n \\`A\\` ${aType} NOT NULL,\\n \\`B\\` ${bType} NOT NULL\\n);`,\n `CREATE UNIQUE INDEX ${q(`${step.table}_AB_unique`)} ON ${q(step.table)} (\\`A\\`, \\`B\\`);`,\n `CREATE INDEX ${q(`${step.table}_B_index`)} ON ${q(step.table)} (\\`B\\`);`,\n `ALTER TABLE ${q(step.table)} ADD CONSTRAINT ${q(`${step.table}_A_fkey`)} FOREIGN KEY (\\`A\\`) REFERENCES ${q(step.a.table)} (${q(step.a.column)}) ON DELETE CASCADE ON UPDATE CASCADE;`,\n `ALTER TABLE ${q(step.table)} ADD CONSTRAINT ${q(`${step.table}_B_fkey`)} FOREIGN KEY (\\`B\\`) REFERENCES ${q(step.b.table)} (${q(step.b.column)}) ON DELETE CASCADE ON UPDATE CASCADE;`,\n ];\n }\n case \"addPrimaryKey\":\n return [\n `ALTER TABLE ${q(step.table)} ADD PRIMARY KEY (${step.columns.map((column) => q(column)).join(\", \")});`,\n ];\n case \"dropPrimaryKey\":\n return [`ALTER TABLE ${q(step.table)} DROP PRIMARY KEY;`];\n }\n}\n\n// ─── Column pieces ────────────────────────────────────────────────\n\nfunction columnDefSql(params: { field: FieldIR; enums: ReadonlyMap<string, EnumIR> }): string {\n const { field, enums } = params;\n const name = q(field.dbName ?? field.name);\n\n const autoincrement = field.default?.kind === \"autoincrement\";\n if (autoincrement && field.type !== \"Int\" && field.type !== \"BigInt\") {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `autoincrement default on \"${field.name}\" requires a non-list Int or BigInt column`,\n meta: { field: field.name },\n });\n }\n\n let def = `${name} ${mysqlColumnTypeSql({ field, enums })}`;\n if (field.collation !== undefined) def += ` COLLATE ${q(field.collation)}`;\n if (!field.isOptional) def += \" NOT NULL\";\n if (autoincrement) def += \" AUTO_INCREMENT\";\n const defaultExpr = mysqlDefaultSql({ field });\n if (defaultExpr !== undefined) def += ` DEFAULT ${defaultExpr}`;\n return def;\n}\n\nfunction renderAlterColumn(params: {\n step: Extract<MigrationStep, { kind: \"alterColumn\" }>;\n enums: ReadonlyMap<string, EnumIR>;\n}): string[] {\n const { step, enums } = params;\n assertEnumStringTransition({ from: step.from, to: step.to, dialect: \"mysql\", table: step.table, column: step.column });\n\n if (step.to.default?.kind === \"autoincrement\" && step.from.default?.kind !== \"autoincrement\") {\n throw new VibeError({\n code: \"VIBE_MIGRATION\",\n message: `cannot add autoincrement to existing column \"${step.table}\".\"${step.column}\" — drop and recreate the column instead`,\n meta: { table: step.table, column: step.column },\n });\n }\n\n // Type or nullability changes redefine the whole column (MODIFY COLUMN\n // carries type + nullability + default in one definition).\n if (step.changes.includes(\"type\") || step.changes.includes(\"nullability\") || step.changes.includes(\"collation\")) {\n const field = step.to.type === \"String\" && step.to.collation === undefined && step.from.collation !== undefined\n ? { ...step.to, collation: step.from.collation }\n : step.to;\n return [\n `ALTER TABLE ${q(step.table)} MODIFY COLUMN ${columnDefSql({ field, enums })};`,\n ];\n }\n\n // Default-only change.\n const defaultExpr = mysqlDefaultSql({ field: step.to });\n return [\n defaultExpr === undefined\n ? `ALTER TABLE ${q(step.table)} ALTER COLUMN ${q(step.column)} DROP DEFAULT;`\n : `ALTER TABLE ${q(step.table)} ALTER COLUMN ${q(step.column)} SET DEFAULT ${defaultExpr};`,\n ];\n}\n\n// ─── Quoting ──────────────────────────────────────────────────────\n\nfunction q(name: string): string {\n return mysqlDialect.quoteIdent({ name });\n}\n\nfunction inlineIndexSql(params: { index: Extract<MigrationStep, { kind: \"createIndex\" }> }): string {\n const { index } = params;\n return `${index.unique ? \"UNIQUE \" : \"\"}INDEX ${q(index.name)} (${index.columns.map((column) => `${q(column.name)}${column.desc ? \" DESC\" : \"\"}`).join(\", \")})`;\n}\n",
|
|
43
47
|
"/**\n * Extension artifacts in the migrate pipeline (extensions.md §3 migrate plane).\n *\n * Extensions own database objects the core differ does not model: CREATE\n * EXTENSION, generated tsvector columns, FTS5 shadow tables + triggers,\n * specialty indexes (gin_trgm_ops, hnsw, bm25, FULLTEXT). The contract:\n *\n * 1. `collectExtensionArtifacts` asks each configured extension for its\n * artifacts (dialect-correct, idempotent SQL + a structured owner).\n * 2. `stripExtensionArtifacts` removes owned objects from the INTROSPECTED\n * IR before diffing, so the core differ never schedules their drop —\n * the introspector-representation-is-the-contract rule (LEARNINGS).\n * 3. `planMissingArtifacts` decides which artifacts must be created, by\n * checking the introspected IR for their owners (columns, indexes,\n * tables by name); non-introspectable owners (postgres extensions,\n * triggers) rely on their idempotent IF NOT EXISTS forms and always run.\n *\n * Removing a declaration does NOT auto-drop its artifacts (mirrors the v1\n * phantom-join-table precedent) — `drop` SQL is carried for tooling, not\n * scheduled by push.\n */\n\nimport { extensionDeclarations } from \"@vibeorm/schema\";\nimport type {\n Dialect,\n ExtensionArtifact,\n ModelIR,\n SchemaIR,\n VibeExtension,\n} from \"@vibeorm/schema\";\n\n// ─── Collection ───────────────────────────────────────────────────\n\n/** Artifacts of every configured extension for this schema, in order. */\nexport type CollectedArtifacts = {\n /** CREATE EXTENSION-class artifacts — run BEFORE the core diff SQL. */\n readonly setup: readonly ExtensionArtifact[];\n /** Object artifacts (columns, indexes, shadow tables, triggers) — run AFTER. */\n readonly objects: readonly ExtensionArtifact[];\n};\n\nexport function collectExtensionArtifacts(params: {\n schema: SchemaIR;\n dialect: Dialect;\n extensions: readonly VibeExtension[];\n}): CollectedArtifacts {\n const { schema, dialect, extensions } = params;\n const setup: ExtensionArtifact[] = [];\n const objects: ExtensionArtifact[] = [];\n\n for (const extension of extensions) {\n const artifactsHook = extension.migrate?.artifacts;\n if (artifactsHook === undefined) continue;\n const declarations = extensionDeclarations({ schema, name: extension.name });\n // A configured extension with no schema presence contributes nothing —\n // unless it is a config-only (replication-class) extension.\n if (Object.keys(declarations).length === 0 && extension.schema?.configOnly !== true) continue;\n\n for (const artifact of artifactsHook({\n schema,\n dialect,\n provider: schema.datasource.provider,\n options: extension.options,\n declarations,\n })) {\n (artifact.owns.kind === \"postgresExtension\" ? setup : objects).push(artifact);\n }\n }\n return { setup, objects };\n}\n\n// ─── Introspection filtering ──────────────────────────────────────\n\nfunction ownedTableNames(params: { artifacts: readonly ExtensionArtifact[] }): {\n exact: Set<string>;\n prefixes: string[];\n} {\n const exact = new Set<string>();\n const prefixes: string[] = [];\n for (const artifact of params.artifacts) {\n if (artifact.owns.kind !== \"table\") continue;\n exact.add(artifact.owns.name);\n prefixes.push(...(artifact.owns.auxiliaryPrefixes ?? []));\n }\n return { exact, prefixes };\n}\n\n/**\n * Remove extension-owned objects from an INTROSPECTED SchemaIR so the core\n * differ never sees them (they are neither dropped nor re-created by it).\n */\nexport function stripExtensionArtifacts(params: {\n schema: SchemaIR;\n artifacts: readonly ExtensionArtifact[];\n}): SchemaIR {\n const { schema, artifacts } = params;\n if (artifacts.length === 0) return schema;\n\n const tables = ownedTableNames({ artifacts });\n const ownedColumns = new Map<string, Set<string>>();\n const ownedIndexes = new Map<string, Set<string>>();\n for (const artifact of artifacts) {\n if (artifact.owns.kind === \"column\") {\n const set = ownedColumns.get(artifact.owns.table) ?? new Set<string>();\n set.add(artifact.owns.column);\n ownedColumns.set(artifact.owns.table, set);\n } else if (artifact.owns.kind === \"index\") {\n const set = ownedIndexes.get(artifact.owns.table) ?? new Set<string>();\n set.add(artifact.owns.name);\n ownedIndexes.set(artifact.owns.table, set);\n }\n }\n\n const models: ModelIR[] = [];\n for (const model of schema.models) {\n const tableName = model.dbName ?? model.name;\n if (tables.exact.has(tableName) || tables.prefixes.some((prefix) => tableName.startsWith(prefix))) {\n continue;\n }\n const columns = ownedColumns.get(tableName);\n const indexes = ownedIndexes.get(tableName);\n if (columns === undefined && indexes === undefined) {\n models.push(model);\n continue;\n }\n models.push({\n ...model,\n fields: model.fields.filter((field) => !(columns?.has(field.dbName ?? field.name) ?? false)),\n indexes: model.indexes.filter(\n (index) => !(index.name !== undefined && (indexes?.has(index.name) ?? false)),\n ),\n });\n }\n\n return { ...schema, models };\n}\n\n// ─── Presence planning ────────────────────────────────────────────\n\n/** Owner presence the IR cannot answer, probed live by push (both optional). */\nexport type InstalledExtensionState = {\n /** `SELECT extname FROM pg_extension` — postgres only. */\n readonly pgExtensions?: ReadonlySet<string>;\n /** `sqlite_master WHERE type='trigger'` names — sqlite only. */\n readonly triggers?: ReadonlySet<string>;\n};\n\n/**\n * The artifacts whose owner is missing from the introspected IR (must be\n * created). Owners the IR cannot see — postgres extensions and triggers —\n * consult the live-probed `installed` state when given, else always plan;\n * their `create` SQL is idempotent (IF NOT EXISTS) so replays converge.\n */\nexport function planMissingArtifacts(params: {\n introspected: SchemaIR;\n artifacts: readonly ExtensionArtifact[];\n installed?: InstalledExtensionState;\n}): ExtensionArtifact[] {\n const { introspected, artifacts, installed } = params;\n if (artifacts.length === 0) return [];\n\n const modelByTable = new Map<string, ModelIR>();\n for (const model of introspected.models) {\n modelByTable.set(model.dbName ?? model.name, model);\n }\n\n return artifacts.filter((artifact) => {\n const owner = artifact.owns;\n switch (owner.kind) {\n case \"postgresExtension\":\n return installed?.pgExtensions === undefined ? true : !installed.pgExtensions.has(owner.name);\n case \"trigger\":\n return installed?.triggers === undefined ? true : !installed.triggers.has(owner.name);\n case \"table\":\n return !modelByTable.has(owner.name);\n case \"column\": {\n const model = modelByTable.get(owner.table);\n if (model === undefined) return true;\n return !model.fields.some((field) => (field.dbName ?? field.name) === owner.column);\n }\n case \"index\": {\n const model = modelByTable.get(owner.table);\n if (model === undefined) return true;\n return !model.indexes.some((index) => index.name === owner.name);\n }\n }\n });\n}\n\n/** Probe live owner state the IR cannot carry (used by push before planning). */\nexport async function probeInstalledExtensionState(params: {\n executor: (execParams: { text: string; values?: unknown[] }) => Promise<Record<string, unknown>[]>;\n dialect: Dialect;\n artifacts: readonly ExtensionArtifact[];\n}): Promise<InstalledExtensionState> {\n const { executor, dialect, artifacts } = params;\n const state: { pgExtensions?: ReadonlySet<string>; triggers?: ReadonlySet<string> } = {};\n\n if (dialect === \"postgres\" && artifacts.some((artifact) => artifact.owns.kind === \"postgresExtension\")) {\n const rows = await executor({ text: \"SELECT extname FROM pg_extension\" });\n state.pgExtensions = new Set(rows.map((row) => String(row[\"extname\"])));\n }\n if (dialect === \"sqlite\" && artifacts.some((artifact) => artifact.owns.kind === \"trigger\")) {\n // `values: []` is the adapter-sqlite READ contract on the raw path.\n const rows = await executor({\n text: \"SELECT name FROM sqlite_master WHERE type = 'trigger'\",\n values: [],\n });\n state.triggers = new Set(rows.map((row) => String(row[\"name\"])));\n }\n return state;\n}\n\n/** Flatten artifacts to their create statements, in order. */\nexport function artifactCreateSql(params: {\n artifacts: readonly ExtensionArtifact[];\n}): string[] {\n return params.artifacts.flatMap((artifact) => [...artifact.create]);\n}\n",
|
|
48
|
+
"import { createHash } from \"node:crypto\";\nimport { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, SqlObjectIdentity } from \"@vibeorm/schema\";\nimport { getSqlDialect, renderMigrationServerVersion, renderReplayCoverageGaps, renderShadowOperation, SHADOW_DATABASE } from \"@vibeorm/sql\";\nimport { canonicalMigrationJson } from \"./desired-state.ts\";\nimport { inspectMigrationInventory } from \"./inventory.ts\";\nimport { inspectSqlObjects, migrationNamespace, assertCatalogVisibility } from \"./inspect-objects.ts\";\nimport type { CatalogObject } from \"./inventory.ts\";\nimport { introspectPostgres } from \"./introspect/postgres.ts\";\nimport { introspectMysql } from \"./introspect/mysql.ts\";\nimport { introspectSqlite } from \"./introspect/sqlite.ts\";\nimport { schemaObjectIdentities } from \"./object-ownership.ts\";\nimport type { MigrationFile, SqlExecutor } from \"./types.ts\";\nimport type { ReplayReference } from \"./shadow-types.ts\";\n\n/** Input binding separate from immutable journal checksum compatibility. */\nexport function replayFingerprint(params: { value: unknown }): string {\n return createHash(\"sha256\").update(canonicalMigrationJson({ value: params.value })).digest(\"hex\");\n}\n\n/** Capture actual replay results, including custom objects absent from declarations. */\nexport async function captureReplayReference(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n migrations: readonly MigrationFile[];\n /** Only a marker already verified by the owning lifecycle may be hidden. */\n privateTable?: string;\n /** Only the dedicated lifecycle may exempt its PostgreSQL marker namespace. */\n privateNamespace?: string;\n}): Promise<ReplayReference> {\n const { executor, dialect } = params;\n const namespace = await migrationNamespace({ executor, dialect });\n await assertCatalogVisibility({ executor, dialect, namespace });\n const sqlDialect = getSqlDialect({ dialect });\n if (dialect === \"mysql\" && params.privateTable === SHADOW_DATABASE.table) {\n const [query] = renderShadowOperation({ dialect: sqlDialect, operation: { kind: \"markerColumns\" } });\n const columns = await executor({ text: query!.text, values: [...query!.values] });\n if (columns.length !== 1 || columns[0]?.name !== \"payload\" || columns[0]?.type !== \"longtext\" || columns[0]?.nullable !== \"NO\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Replay changed the private shadow marker; its objects cannot be excluded from reference inspection\", meta: { reason: \"shadow-ownership-changed\" } });\n }\n if (params.privateNamespace !== undefined) {\n if (dialect !== \"postgres\" || params.privateNamespace !== SHADOW_DATABASE.schema) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Unknown private shadow namespace\", meta: { reason: \"shadow-ownership-invalid\" } });\n // Replay itself can alter a marker or add objects alongside it. The initial\n // lifecycle check is not permission to hide a whole namespace afterwards.\n const [inventoryQuery] = renderShadowOperation({ dialect: sqlDialect, operation: { kind: \"inventory\" } });\n const privateObjects = (await executor({ text: inventoryQuery!.text, values: [...inventoryQuery!.values] })).filter((row) => row.namespace === params.privateNamespace);\n const [columnsQuery] = renderShadowOperation({ dialect: sqlDialect, operation: { kind: \"markerColumns\" } });\n const columns = await executor({ text: columnsQuery!.text, values: [...columnsQuery!.values] });\n if (columns.length !== 1 || columns[0]?.name !== \"payload\" || columns[0]?.type !== \"text\" || columns[0]?.nullable !== \"NO\" || privateObjects.some((row) => !(row.kind === \"namespace\" && row.name === SHADOW_DATABASE.schema || row.kind === \"relation\" && row.name === SHADOW_DATABASE.table))) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Replay changed the private shadow namespace; its objects cannot be excluded from reference inspection\", meta: { reason: \"shadow-ownership-changed\", objects: privateObjects } });\n }\n const coverage = renderReplayCoverageGaps({ dialect: sqlDialect, namespace, ...(params.privateNamespace === undefined ? {} : { privateNamespace: params.privateNamespace }) });\n const gaps = await executor({ text: coverage.text, values: [...coverage.values] });\n if (gaps.length > 0) throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: \"Replayed history contains objects whose full definitions are not represented by migration inspection. Use reviewed SQL for changes; automatic generation and verification require supported reference coverage.\", meta: { feature: \"replayInventoryCoverage\", dialect, namespace, objects: gaps } });\n const rls = [...params.migrations].reverse().find((migration) => migration.rls !== undefined)?.rls?.to;\n const physical = dialect === \"postgres\" ? await introspectPostgres({ executor, ...(rls === undefined ? {} : { rlsSchema: rls, requireInstalledRls: true }) })\n : dialect === \"mysql\" ? await introspectMysql({ executor }) : await introspectSqlite({ executor });\n const privateTable = params.privateTable !== undefined && physical.models.some((model) => !model.isView && (model.dbName ?? model.name) === params.privateTable) ? params.privateTable : undefined;\n const schema = privateTable === undefined ? physical : { ...physical, models: physical.models.filter((model) => model.isView || (model.dbName ?? model.name) !== privateTable) };\n const privateIdentity = (identity: SqlObjectIdentity): boolean => {\n if (privateTable === undefined) return false;\n if (identity.kind === \"table\") return identity.name.namespace === namespace && identity.name.name === privateTable;\n return \"table\" in identity && identity.table.namespace === namespace && identity.table.name === privateTable;\n };\n const observed = (await inspectMigrationInventory({ executor, dialect, namespace })).filter((object) => !privateIdentity(object.identity));\n const inventory: CatalogObject[] = [...new Map([\n ...schemaObjectIdentities({ schema, dialect, namespace }).filter((identity) => !privateIdentity(identity)).map((identity): CatalogObject => ({ identity })),\n ...observed,\n ].map((object) => [sqlObjectKey({ identity: object.identity }), object])).values()];\n const identities = new Map(inventory.map((object) => [sqlObjectKey({ identity: object.identity }), object.identity]));\n const definitions = [];\n const unavailable = [];\n const requested = [...identities.values()];\n const inspections = await inspectSqlObjects({ executor, dialect, identities: requested });\n for (const [index, identity] of requested.entries()) {\n const inspection = inspections[index]!;\n if (inspection.state === \"present\") definitions.push(inspection.definition);\n else unavailable.push({ identity, ownership: \"unknown\" as const, state: \"unavailable\" as const, reason: inspection.state === \"missing\" ? \"reference-object-missing\" : inspection.reason, differences: [] });\n }\n for (const object of inventory) if (object.inspectionUnavailable !== undefined) unavailable.push({ identity: object.identity, ownership: \"unknown\" as const, state: \"unavailable\" as const, reason: object.inspectionUnavailable, differences: [] });\n const versionQuery = renderMigrationServerVersion({ dialect: getSqlDialect({ dialect }) });\n const version = await executor({ text: versionQuery.text, values: [...versionQuery.values] });\n return {\n dialect, namespace,\n // Physical history can contain tables without ORM model keys. This is replay\n // evidence, not a fresh authored declaration to validate or persist.\n state: { schema, definitions }, inventory, unavailable,\n chainFingerprint: replayFingerprint({ value: params.migrations }),\n contextFingerprint: replayFingerprint({ value: { dialect, namespace, version } }),\n };\n}\n",
|
|
49
|
+
"import { hasMysqlGlobalCatalogVisibility } from \"./mysql-catalog-visibility.ts\";\nimport { VibeError, providerToDialect } from \"@vibeorm/schema\";\nimport { getSqlDialect, renderShadowOperation, SHADOW_DATABASE } from \"@vibeorm/sql\";\nimport type { ShadowOperation } from \"@vibeorm/sql\";\nimport { replayFingerprint } from \"./replay-reference.ts\";\nimport { migrationChecksum } from \"./migration-checksum.ts\";\nimport { finishShadowWork, withShadowConnection } from \"./shadow.ts\";\nimport type { MigrationReferenceOptions, ShadowDatabaseOptions } from \"./shadow-types.ts\";\nimport type { SqlExecutor } from \"./types.ts\";\n\ntype DedicatedOptions = Extract<ShadowDatabaseOptions, { readonly mode: \"dedicated\" }>;\ntype ReplayJournalEntry = { readonly name: string; readonly checksum: string; readonly statement_index: number; readonly error: null };\ntype Marker = { readonly version: 1; readonly ownerKey: string; readonly identity: string; readonly status: \"BUILDING\" | \"READY\"; readonly journal: readonly ReplayJournalEntry[] };\n\nfunction refuse(params: { reason: string; message: string; objects?: unknown }): never {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: params.message, meta: { reason: params.reason, ...(params.objects === undefined ? {} : { objects: params.objects }) } });\n}\n\nfunction readIdentity(params: { rows: readonly Record<string, unknown>[]; provider: DedicatedOptions[\"provider\"] }): { database: string; fingerprint: string } {\n const row = params.rows[0];\n if (params.rows.length !== 1 || typeof row?.database !== \"string\" || row.database.length === 0 || (params.provider === \"postgresql\" && (typeof row.database_id !== \"string\" || row.namespace !== \"public\")) || (params.provider === \"mysql\" && (typeof row.server_id !== \"string\" || ![0, 1, 2].includes(Number(row.name_folding))))) return refuse({ reason: \"shadow-identity-unavailable\", message: \"Cannot establish the dedicated database identity. Use automatic shadow mode or a supported isolated server connection.\" });\n // Conservatively fold MySQL names even on case-sensitive servers: false refusals are safer than alias resets.\n const database = params.provider === \"mysql\" ? row.database.toLowerCase() : row.database;\n return { database, fingerprint: replayFingerprint({ value: { ...row, database } }) };\n}\n\nfunction completedJournal(params: { rows: readonly unknown[]; reason: string }): ReplayJournalEntry[] {\n const entries: ReplayJournalEntry[] = [];\n const names = new Set<string>();\n for (const row of params.rows) {\n if (row === null || typeof row !== \"object\" || !(\"name\" in row) || typeof row.name !== \"string\" || row.name.length === 0 || names.has(row.name)\n || !(\"checksum\" in row) || typeof row.checksum !== \"string\" || !/^[a-f0-9]{64}$/.test(row.checksum)\n || !(\"statement_index\" in row) || (typeof row.statement_index !== \"number\" && (typeof row.statement_index !== \"string\" || !/^\\d+$/.test(row.statement_index)))\n || !Number.isSafeInteger(Number(row.statement_index)) || Number(row.statement_index) < 0 || !(\"error\" in row) || row.error !== null) {\n return refuse({ reason: params.reason, message: \"The shadow journal must contain unique completed replay entries with exact checksums and statement counts. Inspect the shadow before reuse.\" });\n }\n names.add(row.name);\n entries.push({ name: row.name, checksum: row.checksum, statement_index: Number(row.statement_index), error: null });\n }\n return entries.sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);\n}\n\n/**\n * Does a SHOW GRANTS database scope cover this database? MySQL grant names use\n * `_`/`%` wildcards and the server itself resolves privileges through them, so\n * a prefix grant such as `project\\_%` is a direct, honored grant. SHOW GRANTS\n * doubles stored backslashes, so an escaped literal underscore arrives as\n * `\\\\_`. A scope this parser cannot interpret simply does not cover — the\n * caller then refuses, never guesses.\n */\nfunction grantScopeCoversDatabase(params: { scope: string; database: string }): boolean {\n // scope is the quoted pattern plus trailing `.*`, e.g. `vibeorm\\\\_test%`.*\n const inner = params.scope.slice(1, -3).replaceAll(\"``\", \"`\").replaceAll(\"\\\\\\\\\", \"\\\\\");\n const literal = (char: string): string => char.replace(/[\\\\^$.*+?()[\\]{}|]/, \"\\\\$&\");\n let pattern = \"^\";\n for (let index = 0; index < inner.length; index += 1) {\n const char = inner[index]!;\n if (char === \"\\\\\" && index + 1 < inner.length) { pattern += literal(inner[index + 1]!); index += 1; }\n else if (char === \"_\") pattern += \"[\\\\s\\\\S]\";\n else if (char === \"%\") pattern += \"[\\\\s\\\\S]*\";\n else pattern += literal(char);\n }\n return new RegExp(`${pattern}$`).test(params.database);\n}\n\nfunction assertMysqlVisibility(params: { rows: readonly Record<string, unknown>[]; database: string }): void {\n const global = new Set<string>();\n const local = new Set<string>();\n for (const row of params.rows) {\n const values = Object.values(row);\n if (values.length !== 1 || typeof values[0] !== \"string\" || !values[0].startsWith(\"GRANT \")) return refuse({ reason: \"shadow-inventory-unavailable\", message: \"Dedicated MySQL inventory cannot establish unrestricted direct grants. Partial revokes or unknown grant records require automatic shadow mode.\" });\n // SHOW GRANTS FOR CURRENT_USER does not expand roles. Only direct table/database grants count.\n const match = /^GRANT ([A-Z_ ,]+) ON (\\*\\.\\*|`(?:``|[^`])+`\\.\\*) TO /.exec(values[0]);\n if (match === null) continue;\n const privileges = match[1]!.split(\", \");\n if (match[2] === \"*.*\") for (const privilege of privileges) global.add(privilege);\n else if (grantScopeCoversDatabase({ scope: match[2]!, database: params.database })) for (const privilege of privileges) local.add(privilege);\n }\n const administration = [\"SELECT\", \"INSERT\", \"UPDATE\", \"DELETE\", \"CREATE\", \"DROP\", \"REFERENCES\", \"INDEX\", \"ALTER\", \"CREATE VIEW\", \"SHOW VIEW\", \"CREATE ROUTINE\", \"ALTER ROUTINE\", \"EXECUTE\", \"EVENT\", \"TRIGGER\"];\n const visible = hasMysqlGlobalCatalogVisibility({ rows: params.rows });\n const administrable = global.has(\"ALL PRIVILEGES\") || local.has(\"ALL PRIVILEGES\") || administration.every((privilege) => global.has(privilege) || local.has(privilege));\n if (!visible || !administrable) return refuse({ reason: \"shadow-inventory-unavailable\", message: \"Dedicated MySQL reset requires direct global SHOW VIEW (or SELECT) without partial revokes to see inbound foreign keys in every database, plus administration privileges on the shadow. SHOW VIEW exposes metadata without granting external row reads. Role-only or database-local visibility is insufficient; use automatic shadow mode if these grants are unavailable.\" });\n}\n\nasync function readMarker(params: { rows: readonly Record<string, unknown>[] }): Promise<Marker> {\n const payload = params.rows[0]?.payload;\n if (params.rows.length !== 1 || typeof payload !== \"string\") return refuse({ reason: \"shadow-ownership-invalid\", message: \"Shadow ownership marker is missing or malformed; automatic claim/reset is refused.\" });\n const value: unknown = await Promise.resolve().then(() => JSON.parse(payload)).then((result: unknown) => result, (cause: unknown) => { throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Shadow marker is not valid JSON\", meta: { reason: \"shadow-ownership-invalid\" }, cause }); });\n if (value === null || typeof value !== \"object\" || !(\"version\" in value) || value.version !== 1 || !(\"ownerKey\" in value) || typeof value.ownerKey !== \"string\" || !(\"identity\" in value) || typeof value.identity !== \"string\" || !(\"status\" in value) || (value.status !== \"READY\" && value.status !== \"BUILDING\") || !(\"journal\" in value) || !Array.isArray(value.journal) || !value.journal.every((row: unknown) => row !== null && typeof row === \"object\" && \"name\" in row && typeof row.name === \"string\" && \"checksum\" in row && typeof row.checksum === \"string\")) return refuse({ reason: \"shadow-ownership-invalid\", message: \"Shadow marker has an unsupported ownership or replay-journal shape.\" });\n return { ...value as Marker, journal: completedJournal({ rows: value.journal, reason: \"shadow-ownership-invalid\" }) };\n}\n\n/** @internal Dedicated mode is a reset lease, never database deletion authority. */\nexport async function withDedicatedShadow<T>(params: MigrationReferenceOptions<T> & {\n readonly shadow: DedicatedOptions;\n readonly runReference: (executor: SqlExecutor, privateTable?: string) => Promise<T>;\n}): Promise<T> {\n const { shadow } = params;\n // Capture before invoking a connection factory or callback; later caller mutations cannot redefine success.\n const intendedJournal = completedJournal({ rows: params.migrations.map((migration) => ({ name: migration.name, checksum: migrationChecksum(migration), statement_index: migration.sql.length, error: null })), reason: \"shadow-replay-journal-changed\" });\n if (shadow.ownerKey.length === 0 || shadow.targetUrl.length === 0) return refuse({ reason: \"shadow-identity-unavailable\", message: \"Reusable shadow mode requires a project owner and a resolvable deployment target for an independent identity check.\" });\n const dialect = providerToDialect({ provider: shadow.provider });\n const sqlDialect = getSqlDialect({ dialect });\n const execute = async (executor: SqlExecutor, operation: ShadowOperation): Promise<Record<string, unknown>[]> => {\n let rows: Record<string, unknown>[] = [];\n for (const query of renderShadowOperation({ dialect: sqlDialect, operation })) rows = await executor({ text: query.text, values: [...query.values] });\n return rows;\n };\n const target = await params.openConnection({ provider: shadow.provider, url: shadow.targetUrl });\n const targetIdentity = await withShadowConnection({ connection: target, artifact: \"deployment identity connection\", run: async (executor) => readIdentity({ provider: shadow.provider, rows: await execute(executor, { kind: \"identity\" }) }) });\n const connection = await params.openConnection({ provider: shadow.provider, url: shadow.databaseUrl });\n return withShadowConnection({ connection, artifact: \"dedicated shadow connection\", run: async (executor) => {\n const identity = readIdentity({ provider: shadow.provider, rows: await execute(executor, { kind: \"identity\" }) });\n // No URL comparison or host-based assumption can authorize a reset. Equal physical names fail closed.\n if (identity.database === targetIdentity.database) return refuse({ reason: \"shadow-target-identity-conflict\", message: \"Shadow and target have the same resolved database name. Separation is not proven; use a dedicated shadow with a distinct name or automatic mode.\" });\n const lease = await execute(executor, { kind: \"lock\", database: replayFingerprint({ value: identity.database }).slice(0, 40) });\n if (dialect === \"mysql\" && Number(lease[0]?.acquired) !== 1) return refuse({ reason: \"shadow-lease-unavailable\", message: \"Another command holds the dedicated shadow lease. No reset was attempted.\" });\n return finishShadowWork({ artifact: identity.database, cleanup: async () => {\n const released = await execute(executor, { kind: \"unlock\", database: replayFingerprint({ value: identity.database }).slice(0, 40) });\n const confirmed = dialect === \"postgres\" ? released[0]?.released === true : released[0]?.released === 1 || released[0]?.released === \"1\";\n if (released.length !== 1 || !confirmed) return refuse({ reason: \"shadow-lease-release-failed\", message: \"The dedicated shadow lease release was not confirmed. The owned connection will still be closed; inspect its session before further use.\" });\n }, run: async () => {\n const lockedIdentity = readIdentity({ provider: shadow.provider, rows: await execute(executor, { kind: \"identity\" }) });\n if (lockedIdentity.fingerprint !== identity.fingerprint) return refuse({ reason: \"shadow-identity-changed\", message: \"Shadow identity changed after lease acquisition; reset is refused.\" });\n if (dialect === \"mysql\") {\n const grants = await execute(executor, { kind: \"grants\" }).then(undefined, (cause: unknown) => { throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot establish dedicated MySQL catalog visibility from direct grants\", meta: { reason: \"shadow-inventory-unavailable\" }, cause }); });\n assertMysqlVisibility({ rows: grants, database: identity.database });\n }\n const existing = (await execute(executor, { kind: \"markerExists\" })).length > 0;\n const inventory = await execute(executor, { kind: \"inventory\" }).then(undefined, (cause: unknown) => { throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot inspect the complete dedicated shadow inventory; no reset was attempted\", meta: { reason: \"shadow-inventory-unavailable\" }, cause }); });\n const externalReferences = inventory.filter((row) => row.kind === \"EXTERNAL FOREIGN KEY\");\n if (externalReferences.length !== 0) return refuse({ reason: \"shadow-external-reference\", message: \"Foreign keys from another database reference this shadow. No marker or objects were changed; remove those dependencies explicitly or use automatic shadow mode.\", objects: externalReferences });\n const isInfrastructure = (row: Record<string, unknown>): boolean => dialect === \"postgres\"\n ? row.namespace === SHADOW_DATABASE.schema && (row.kind === \"namespace\" && row.name === SHADOW_DATABASE.schema || row.kind === \"relation\" && row.name === SHADOW_DATABASE.table)\n : row.kind === \"BASE TABLE\" && row.name === SHADOW_DATABASE.table;\n if (!existing && inventory.length !== 0) return refuse({ reason: \"shadow-first-use-not-empty\", message: \"An unmarked database must be empty before it can be claimed as a shadow. No objects were reset.\", objects: inventory });\n if (existing) {\n const columns = await execute(executor, { kind: \"markerColumns\" });\n if (columns.length !== 1 || columns[0]?.name !== \"payload\" || columns[0]?.nullable !== \"NO\" || columns[0]?.type !== (dialect === \"postgres\" ? \"text\" : \"longtext\")) return refuse({ reason: \"shadow-ownership-invalid\", message: \"The shadow marker structure does not match the engine-owned structure.\" });\n const marker = await readMarker({ rows: await execute(executor, { kind: \"markerRead\" }) });\n if (marker.ownerKey !== shadow.ownerKey || marker.identity !== identity.fingerprint) return refuse({ reason: \"shadow-ownership-mismatch\", message: \"This dedicated shadow belongs to another project or database identity. No reset was attempted.\" });\n if (marker.status !== \"READY\") return refuse({ reason: \"shadow-recovery-required\", message: \"The shadow was interrupted while BUILDING. Inspect its objects and journal and perform explicit ownership-verified recovery before reuse; automatic reset is refused.\" });\n const journal = completedJournal({ rows: await execute(executor, { kind: \"journal\" }), reason: \"shadow-journal-changed\" });\n if (replayFingerprint({ value: journal }) !== replayFingerprint({ value: marker.journal })) return refuse({ reason: \"shadow-journal-changed\", message: \"The dedicated shadow journal changed outside its last successful replay. A foreign apply or repair may have used this database; reset is refused.\" });\n }\n const unsupported = inventory.filter((row) => dialect === \"postgres\" && !isInfrastructure(row) && (row.namespace !== \"public\" || row.kind === \"extension\"));\n if (unsupported.length > 0) return refuse({ reason: \"shadow-reset-scope-unavailable\", message: \"Dedicated shadow reset cannot preserve or isolate these namespaces/dependencies/extensions. Use automatic mode or a supported empty dedicated database.\", objects: unsupported });\n const building: Marker = { version: 1, ownerKey: shadow.ownerKey, identity: identity.fingerprint, status: \"BUILDING\", journal: [] };\n if (!existing) await execute(executor, { kind: \"markerCreate\" });\n await execute(executor, { kind: \"markerWrite\", value: JSON.stringify(building), insert: !existing });\n if (existing && dialect === \"postgres\") await execute(executor, { kind: \"resetPostgres\" });\n if (existing && dialect === \"mysql\") {\n const objects = inventory.filter((row) => !isInfrastructure(row));\n if (objects.some((row) => ![\"BASE TABLE\", \"VIEW\", \"FUNCTION\", \"PROCEDURE\", \"EVENT\", \"TRIGGER\"].includes(String(row.kind)))) return refuse({ reason: \"shadow-reset-scope-unavailable\", message: \"The dedicated MySQL database has an unsupported reset object.\", objects });\n await execute(executor, { kind: \"mysqlForeignKeys\", enabled: false });\n await finishShadowWork({ artifact: identity.database, cleanup: async () => { await execute(executor, { kind: \"mysqlForeignKeys\", enabled: true }); }, run: async () => {\n for (const kind of [\"EVENT\", \"VIEW\", \"PROCEDURE\", \"FUNCTION\", \"BASE TABLE\"] as const) for (const object of objects.filter((row) => row.kind === kind)) {\n if (typeof object.name !== \"string\") return refuse({ reason: \"shadow-inventory-unavailable\", message: \"Malformed reset inventory.\" });\n await execute(executor, { kind: \"dropMysqlObject\", object: kind === \"BASE TABLE\" ? \"TABLE\" : kind, name: object.name });\n }\n } });\n }\n const remaining = (await execute(executor, { kind: \"inventory\" })).filter((row) => !isInfrastructure(row));\n if (remaining.length !== 0) return refuse({ reason: \"shadow-reset-incomplete\", message: \"Shadow reset left objects behind. Replay was not started.\", objects: remaining });\n const result = await params.runReference(executor, dialect === \"mysql\" ? SHADOW_DATABASE.table : undefined).then(\n (value) => ({ ok: true as const, value }),\n (error: unknown) => {\n // A refusal tagged `shadowReusable` at its throw site made no database\n // change, so the ownership and journal rechecks below still decide READY.\n // Unknown failures and invalidated scratch (`shadowInvalid`) stay BUILDING.\n if (!(error instanceof VibeError) || error.meta.shadowInvalid === true || error.meta.shadowReusable !== true) throw error;\n return { ok: false as const, error };\n },\n );\n const after = await readMarker({ rows: await execute(executor, { kind: \"markerRead\" }) });\n if (replayFingerprint({ value: after }) !== replayFingerprint({ value: building })) return refuse({ reason: \"shadow-ownership-changed\", message: \"Replay changed the shadow's private ownership marker; it cannot be marked ready.\" });\n const journal = completedJournal({ rows: await execute(executor, { kind: \"journal\" }), reason: \"shadow-replay-journal-changed\" });\n if (replayFingerprint({ value: journal }) !== replayFingerprint({ value: intendedJournal })) return refuse({ reason: \"shadow-replay-journal-changed\", message: \"The callback changed the intended applied replay prefix or replay did not complete. The shadow remains BUILDING for inspection; no READY marker was written.\" });\n await execute(executor, { kind: \"markerWrite\", insert: false, value: JSON.stringify({ ...building, status: \"READY\", journal: intendedJournal }) });\n if (!result.ok) throw result.error;\n return result.value;\n } });\n } });\n}\n",
|
|
50
|
+
"import { randomUUID } from \"node:crypto\";\nimport { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { SchemaIR, SqlObjectDefinition } from \"@vibeorm/schema\";\nimport { getSqlDialect } from \"@vibeorm/sql\";\nimport { canonicalMigrationJson } from \"./desired-state.ts\";\nimport { diffSchemas } from \"./differ.ts\";\nimport { renderSteps } from \"./ddl/render.ts\";\nimport { inspectSqlObject } from \"./inspect-objects.ts\";\nimport { orderedMigrationObjects } from \"./object-ownership.ts\";\nimport { splitSqlStatements } from \"./sql-statements.ts\";\nimport type { ReplayReference } from \"./shadow-types.ts\";\nimport type { SqlExecutor } from \"./types.ts\";\n\ntype ScratchOutcome = { readonly ok: true } | { readonly ok: false; readonly error: VibeError };\n\nfunction comparisonFailure(params: { cause: unknown }): VibeError {\n return params.cause instanceof VibeError ? params.cause : new VibeError({ code: \"VIBE_MIGRATION\", message: \"Authored custom SQL could not be safely compiled on the independent scratch reference. Review dependencies and provide an explicit SQL migration when replacement is not supported.\", meta: { reason: \"migration-object-comparison-unavailable\" }, cause: params.cause });\n}\n\n// Inspect only the statement prefix; the shared splitter still owns statement\n// boundaries and quoted/stored-program bodies. PostgreSQL comments may nest.\nfunction leadingCommand(params: { sql: string }): string {\n const { sql } = params;\n let offset = 0;\n while (offset < sql.length) {\n if (/\\s/.test(sql[offset]!)) { offset++; continue; }\n if (sql.startsWith(\"--\", offset)) {\n const end = sql.indexOf(\"\\n\", offset + 2);\n offset = end < 0 ? sql.length : end + 1;\n continue;\n }\n if (!sql.startsWith(\"/*\", offset)) break;\n offset += 2;\n let depth = 1;\n while (offset < sql.length && depth > 0) {\n if (sql.startsWith(\"/*\", offset)) { depth++; offset += 2; }\n else if (sql.startsWith(\"*/\", offset)) { depth--; offset += 2; }\n else offset++;\n }\n }\n return sql.slice(offset);\n}\n\n/** Compile authored custom bodies on scratch; reject lost transactions and failed rollback. */\nexport async function compareReplayMigrationObjects(params: { executor: SqlExecutor; reference: ReplayReference; schema: SchemaIR }): Promise<SchemaIR> {\n const objects = orderedMigrationObjects({ objects: params.schema.migrationObjects ?? [] }).map((object) => ({ ...object,\n create: object.create.flatMap((sql) => splitSqlStatements({ sql, dialect: object.dialect })),\n drop: object.drop.flatMap((sql) => splitSqlStatements({ sql, dialect: object.dialect })),\n }));\n if (objects.length === 0) return params.schema;\n if (params.reference.dialect !== \"postgres\") throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: \"Independent authored custom-object comparison requires transactional scratch DDL. Use reviewed SQL for this dialect's custom objects.\", meta: { feature: \"authoredCustomObjectComparison\", dialect: params.reference.dialect, objects: objects.map((object) => object.identity) } });\n const before = new Map(params.reference.state.definitions.map((definition) => [sqlObjectKey({ identity: definition.identity }), definition]));\n for (const object of objects) {\n // Refuse control statements across the entire authored batch before any DDL.\n // Detecting a COMMIT only after execution is too late to roll back earlier drops.\n if (object.dialect !== params.reference.dialect || object.create.length === 0 || before.has(sqlObjectKey({ identity: object.identity })) && object.drop.length === 0 || [...object.create, ...object.drop].some((sql) => /^(?:BEGIN|START|COMMIT|END|ABORT|ROLLBACK|PREPARE|VACUUM|CREATE\\s+DATABASE|DROP\\s+DATABASE)\\b/i.test(leadingCommand({ sql })))) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Custom object cannot be safely dropped/recreated in a rollback-only shadow transaction. Supply a reviewed SQL migration.\", meta: { reason: \"migration-object-comparison-unavailable\", identity: object.identity } });\n }\n const definitions = new Map<string, SqlObjectDefinition>();\n const sentinel = getSqlDialect({ dialect: \"postgres\" }).quoteIdent({ name: `vibe_probe_${randomUUID().replaceAll(\"-\", \"\")}` });\n const checkSentinel = async (): Promise<void> => {\n // RELEASE must find the existing sentinel. Creating a savepoint alone would\n // falsely accept COMMIT AND CHAIN or a new transaction started by user SQL.\n await Promise.resolve().then(() => params.executor({ text: `RELEASE SAVEPOINT ${sentinel}` })).then(() => undefined, (cause: unknown) => {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Authored SQL destroyed the scratch transaction or its savepoint. Discard this scratch reference; no comparison result can be trusted.\", meta: { reason: \"migration-object-transaction-lost\", shadowInvalid: true }, cause });\n });\n await params.executor({ text: `SAVEPOINT ${sentinel}` });\n };\n const executeScratch = async (query: { text: string }): Promise<void> => {\n await params.executor(query);\n await checkSentinel();\n };\n await Promise.resolve().then(() => params.executor({ text: \"BEGIN\" })).then(() => undefined, (cause: unknown) => { throw comparisonFailure({ cause }); });\n const outcome = await Promise.resolve().then(async () => {\n await params.executor({ text: `SAVEPOINT ${sentinel}` });\n for (const object of [...objects].reverse()) if (before.has(sqlObjectKey({ identity: object.identity }))) for (const text of object.drop) await executeScratch({ text });\n // Initial table/type declarations make new triggers comparable without changing the target database.\n const creates = diffSchemas({ from: params.reference.state.schema, to: params.schema, dialect: \"postgres\" }).filter((step) => step.kind === \"createEnum\" || step.kind === \"createTable\");\n for (const text of renderSteps({ steps: creates, dialect: \"postgres\" })) await executeScratch({ text });\n for (const object of objects) for (const text of object.create) await executeScratch({ text });\n for (const object of objects) {\n const inspected = await inspectSqlObject({ executor: params.executor, dialect: \"postgres\", identity: object.identity });\n if (inspected.state !== \"present\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Authored custom SQL did not produce an inspectable object in the independent scratch probe.\", meta: { reason: \"migration-object-comparison-unavailable\", identity: object.identity, state: inspected.state } });\n definitions.set(sqlObjectKey({ identity: object.identity }), inspected.definition);\n }\n // CASCADE or custom drop SQL must not silently remove external dependents during the probe.\n for (const [key, expected] of before) {\n if (definitions.has(key)) continue;\n const inspected = await inspectSqlObject({ executor: params.executor, dialect: \"postgres\", identity: expected.identity });\n if (inspected.state !== \"present\" || canonicalMigrationJson({ value: inspected.definition }) !== canonicalMigrationJson({ value: expected })) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Custom scratch replacement changed a dependent object outside the declared replacement set. Supply reviewed SQL.\", meta: { reason: \"migration-object-dependency-unavailable\", identity: expected.identity } });\n }\n await checkSentinel();\n }).then((): ScratchOutcome => ({ ok: true }), (cause: unknown): ScratchOutcome => ({ ok: false, error: comparisonFailure({ cause }) }));\n // A rollback failure must not replace the original execution failure. Both\n // remain typed and inspectable; the caller must discard an unrestored scratch.\n const rollback = await Promise.resolve().then(() => params.executor({ text: \"ROLLBACK\" })).then((): ScratchOutcome => ({ ok: true }), (cause: unknown): ScratchOutcome => ({ ok: false, error: cause instanceof VibeError ? cause : new VibeError({ code: \"VIBE_MIGRATION\", message: \"Scratch rollback failed\", meta: { reason: \"migration-object-rollback-failed\" }, cause }) }));\n if (!rollback.ok) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Custom comparison scratch could not be rolled back. Discard the scratch reference and inspect the preserved execution and cleanup errors.\", meta: { reason: \"migration-object-rollback-failed\", shadowInvalid: true, cleanupFailure: rollback.error }, cause: outcome.ok ? rollback.error : outcome.error });\n if (!outcome.ok) throw outcome.error;\n for (const object of objects) {\n const key = sqlObjectKey({ identity: object.identity });\n const previous = before.get(key);\n if (previous !== undefined && canonicalMigrationJson({ value: previous }) !== canonicalMigrationJson({ value: definitions.get(key) })) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Authored custom object differs from replayed history. Supply a reviewed forward SQL migration; generation will not silently replace its body.\", meta: { reason: \"migration-object-replacement-required\", shadowReusable: true, identity: object.identity, id: object.id } });\n }\n return { ...params.schema, migrationObjects: objects.map((object) => ({ ...object, expected: definitions.get(sqlObjectKey({ identity: object.identity }))! })) };\n}\n",
|
|
51
|
+
"import { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { SchemaIR, SqlObjectIdentity, VibeExtension } from \"@vibeorm/schema\";\nimport { compareReplayMigrationObjects } from \"./replay-objects.ts\";\nimport { planSchemaMigration } from \"./planner.ts\";\nimport { resolvePostgresTypeIdentities } from \"./postgres-type-identity.ts\";\nimport { securityChangesOf } from \"./ddl/rls.ts\";\nimport type { SchemaMigrationPlan } from \"./planner.ts\";\nimport { assertNamedRemovals, removalIdentity } from \"./object-ownership.ts\";\nimport type { ReplayReference } from \"./shadow-types.ts\";\nimport type { MigrationFile, SqlExecutor } from \"./types.ts\";\n\n/** Replay-specific plan; all drop candidates remain visible until individually authorized. */\nexport type ReplayMigrationPlan = SchemaMigrationPlan & {\n readonly requiredRemovals: readonly SqlObjectIdentity[];\n readonly retainedObjects: readonly SqlObjectIdentity[];\n readonly securityChanges: readonly string[];\n /** Legacy replay may need approvals for removals that are already absent now. */\n readonly replayRemovals: readonly SqlObjectIdentity[];\n};\n\n/** Plan only on an independently replayed scratch session, without changing legacy live-planner defaults. */\nexport async function planReplayMigration(params: {\n executor: SqlExecutor;\n reference: ReplayReference;\n schema: SchemaIR;\n migrations: readonly MigrationFile[];\n extensions?: readonly VibeExtension[];\n replaceChecks?: readonly SqlObjectIdentity[];\n}): Promise<ReplayMigrationPlan> {\n const { executor, reference } = params;\n const moduleHeads = new Map<string, MigrationFile>();\n for (const migration of params.migrations) if (migration.moduleOrigin !== undefined) moduleHeads.set(migration.moduleOrigin.moduleId, migration);\n const immutableObjects = new Map([...moduleHeads.values()].flatMap((migration) => {\n const state = migration.moduleOrigin!.source.desiredState!.to;\n return (state.schema.migrationObjects ?? []).map((object) => [sqlObjectKey({ identity: object.identity }), object.expected ?? state.definitions.find((definition) => sqlObjectKey({ identity: definition.identity }) === sqlObjectKey({ identity: object.identity }))] as const);\n }));\n // Only independently replayed history may supply an unqualified authored\n // type's namespace. Do not make the live planner trust its physical target.\n const authored = reference.dialect === \"postgres\"\n ? (await resolvePostgresTypeIdentities({ executor, schema: params.schema, previous: reference.state.schema, mode: \"verify\" })).schema\n : params.schema;\n // Immutable module bodies were checked during runner replay. They are not\n // mutable application declarations and must not be recompiled or rewritten.\n const compared = await compareReplayMigrationObjects({ executor, reference, schema: { ...authored, migrationObjects: (authored.migrationObjects ?? []).filter((object) => !immutableObjects.has(sqlObjectKey({ identity: object.identity }))) } });\n const comparedObjects = new Map((compared.migrationObjects ?? []).map((object) => [sqlObjectKey({ identity: object.identity }), object]));\n const schema: SchemaIR = { ...compared, migrationObjects: (params.schema.migrationObjects ?? []).map((object) => {\n const key = sqlObjectKey({ identity: object.identity });\n if (!immutableObjects.has(key)) return comparedObjects.get(key)!;\n const expected = immutableObjects.get(key);\n return { ...object, ...(expected === undefined ? {} : { expected }) };\n }) };\n const probe = reference.dialect === \"postgres\" ? \"rollback\" : reference.dialect === \"mysql\" ? \"temporary\" : \"none\";\n // PostgreSQL probes need one caller-owned transaction. They execute only on scratch.\n if (probe === \"rollback\") await executor({ text: \"BEGIN\" });\n const plan = await Promise.resolve().then(() => planSchemaMigration({ executor, schema, physical: reference.state.schema, physicalInventory: reference.inventory, dialect: reference.dialect, namespace: reference.namespace, extensions: params.extensions, replaceChecks: params.replaceChecks, probe })).finally(async () => {\n if (probe === \"rollback\") await executor({ text: \"ROLLBACK\" });\n });\n const removals = new Map<string, SqlObjectIdentity>();\n for (const identity of [...plan.unmanagedRemovals, ...plan.steps.flatMap((step) => { const identity = removalIdentity({ step, namespace: plan.namespace }); return identity === undefined ? [] : [identity]; })]) removals.set(sqlObjectKey({ identity }), identity);\n const declared = new Set((schema.migrationObjects ?? []).map((object) => sqlObjectKey({ identity: object.identity })));\n const historicalObjects = new Map<string, SqlObjectIdentity>();\n for (const migration of params.migrations) for (const object of migration.desiredState?.to.schema.migrationObjects ?? []) historicalObjects.set(sqlObjectKey({ identity: object.identity }), object.identity);\n const present = new Set(reference.inventory.map((object) => sqlObjectKey({ identity: object.identity })));\n // Removed old registrations, and SQL-only custom objects absent from IR, cannot become a false clean verdict.\n const retainedObjects = reference.inventory.filter((object) => !declared.has(sqlObjectKey({ identity: object.identity })) && !removals.has(sqlObjectKey({ identity: object.identity })) && (object.identity.kind === \"function\" || object.identity.kind === \"trigger\" || historicalObjects.has(sqlObjectKey({ identity: object.identity })))).map((object) => object.identity);\n const removedRegistrations = [...historicalObjects].filter(([key]) => present.has(key) && !declared.has(key)).map(([, identity]) => identity);\n if (removedRegistrations.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Custom registrations removed from declarations still exist in replayed history. Restore the registration or supply reviewed SQL removing the exact named objects before generating again.\", meta: { reason: \"migration-object-removal-review-required\", shadowReusable: true, objects: removedRegistrations } });\n return { ...plan, requiredRemovals: [...removals.values()], retainedObjects, securityChanges: securityChangesOf({ steps: plan.steps }), replayRemovals: params.migrations.flatMap((migration) => migration.desiredState?.unmanagedRemovals ?? []) };\n}\n\n/** Publication authorization is separate from preview and applies even to represented historical objects. */\nexport function assertReplayRemovals(params: { plan: ReplayMigrationPlan; approved: readonly SqlObjectIdentity[]; acceptIntegrityLoss?: boolean }): void {\n const wanted = new Set([...params.plan.requiredRemovals, ...params.plan.replayRemovals].map((identity) => sqlObjectKey({ identity })));\n const keys = params.approved.map((identity) => sqlObjectKey({ identity }));\n if (new Set(keys).size !== keys.length) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Removal decisions contain duplicate identities\", meta: { reason: \"removal-decision-invalid\", shadowReusable: true } });\n const unused = params.approved.filter((identity) => !wanted.has(sqlObjectKey({ identity })));\n if (unused.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Removal decisions do not identify proposed removals. Custom objects without a generated removal require a reviewed hand-authored SQL migration.\", meta: { reason: \"removal-decision-unused\", shadowReusable: true, objects: unused } });\n assertNamedRemovals({ removals: params.plan.requiredRemovals, approved: params.approved, acceptIntegrityLoss: params.acceptIntegrityLoss });\n}\n",
|
|
52
|
+
"import { resolvePostgresTypeIdentities } from \"./postgres-type-identity.ts\";\nimport { prepareExclusionDiff } from \"./exclusions.ts\";\nimport { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR, SqlObjectIdentity, VibeExtension } from \"@vibeorm/schema\";\nimport { renderSqliteRebuildObjects, sqliteDialect } from \"@vibeorm/sql\";\nimport type { SqlExecutor, MigrationStep } from \"./types.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { artifactCreateSql, collectExtensionArtifacts, planMissingArtifacts, probeInstalledExtensionState, stripExtensionArtifacts } from \"./extensions.ts\";\nimport { introspectPhysicalPostgres } from \"./introspect/postgres.ts\";\nimport { introspectMysql } from \"./introspect/mysql.ts\";\nimport { introspectSqlite } from \"./introspect/sqlite.ts\";\nimport { legacyMigrationObjects, preserveMigrationObjects, removalIdentity, schemaObjectIdentities, sqlitePreservedSchema, orderedMigrationObjects, assertRetainedMigrationObjects } from \"./object-ownership.ts\";\nimport { assertMigrationState, inspectSqlObject, migrationNamespace, prepareCheckDiff, verifyMigrationState } from \"./inspect-objects.ts\";\nimport type { MigrationObjectState } from \"./inspect-objects.ts\";\nimport { inspectMigrationInventory } from \"./inventory.ts\";\nimport type { CatalogObject } from \"./inventory.ts\";\nimport { normalizeSchema } from \"./normalize.ts\";\nimport { diffSchemas } from \"./differ.ts\";\nimport { renderSteps } from \"./ddl/render.ts\";\nimport { assertSqliteRebuildTableOptions, sqliteInvalidatedTables } from \"./ddl/sqlite.ts\";\n\n/** Shared live plan; reports observations separately from trusted desired declarations. */\nexport type SchemaMigrationPlan = {\n readonly physical: SchemaIR;\n readonly from: SchemaIR;\n /** Desired schema with independently resolved PostgreSQL type evidence retained. */\n readonly to: SchemaIR;\n readonly namespace: string;\n readonly steps: readonly MigrationStep[];\n readonly sql: readonly string[];\n readonly objects: readonly MigrationObjectState[];\n readonly unmanagedRemovals: readonly SqlObjectIdentity[];\n readonly blocked: boolean;\n};\n\n/** Inspect and plan without executing repair DDL. The caller owns any opted-in probe transaction. */\nexport async function planSchemaMigration(params: {\n executor: SqlExecutor; schema: SchemaIR; dialect: Dialect; namespace?: string;\n /** Already-introspected physical IR, including verified native RLS when applicable. */\n physical?: SchemaIR;\n /** Inventory captured with physical; replay has already excluded verified private infrastructure. */\n physicalInventory?: readonly CatalogObject[];\n previous?: DesiredState; extensions?: readonly VibeExtension[];\n probe?: \"none\" | \"rollback\" | \"temporary\"; replaceChecks?: readonly SqlObjectIdentity[];\n}): Promise<SchemaMigrationPlan> {\n const { executor, dialect } = params;\n const resolved = dialect === \"postgres\" ? await resolvePostgresTypeIdentities({ executor, schema: params.schema, ...(params.previous === undefined ? {} : { previous: params.previous.schema }), mode: \"verify\" }) : { schema: params.schema, unavailable: [] };\n const schema = resolved.schema;\n const namespace = params.namespace ?? await migrationNamespace({ executor, dialect });\n const collected = collectExtensionArtifacts({ schema, dialect, extensions: params.extensions ?? [] });\n const artifacts = [...collected.setup, ...collected.objects];\n const legacyObjects = legacyMigrationObjects({ artifacts, dialect, namespace });\n const objects = orderedMigrationObjects({ objects: schema.migrationObjects ?? [] });\n assertRetainedMigrationObjects({ from: params.previous?.schema.migrationObjects ?? [], to: objects });\n for (const object of objects) if (object.dialect !== dialect) throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: `Migration object ${object.id} requires ${object.dialect}`, meta: { feature: \"migrationObject\", dialect } });\n const physical = params.physical ?? (dialect === \"postgres\" ? await introspectPhysicalPostgres({ executor }) : dialect === \"mysql\" ? await introspectMysql({ executor }) : await introspectSqlite({ executor }));\n if (params.previous !== undefined) assertMigrationState({ report: await verifyMigrationState({ executor, expected: params.previous, dialect, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n const inventory = params.physicalInventory ?? await inspectMigrationInventory({ executor, dialect, namespace });\n for (const object of inventory) {\n const identity = object.identity;\n if (identity.kind !== \"table\" || physical.models.some((model) => (model.dbName ?? model.name) === identity.name.name) || normalizeSchema({ schema: physical, dialect }).joinTables.has(identity.name.name)) continue;\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Catalog table is not visible to schema introspection; automatic planning cannot prove the complete physical state\", meta: { reason: \"inventory-unavailable\", identity: object.identity } });\n }\n // Creating a new column has no existing type to adopt. Direct push may emit\n // its authored DDL; persisted migrations still require resolved evidence.\n const states: MigrationObjectState[] = resolved.unavailable.map((identity) => {\n const exists = identity.kind === \"column\" && [physical, params.previous?.schema].some((source) => source?.models.some((model) => (model.dbName ?? model.name) === identity.table.name && model.fields.some((field) => (field.dbName ?? field.name) === identity.column)));\n return { identity, ownership: \"schema\", state: exists ? \"unavailable\" : \"missing\", reason: \"type-reference-required\", differences: [] };\n });\n if (dialect === \"mysql\" && inventory.some((object) => object.identity.kind === \"view\" || object.identity.kind === \"function\" || object.identity.kind === \"trigger\") && params.previous === undefined && physical.models.length > 0) states.push(...inventory.filter((object) => object.identity.kind === \"view\" || object.identity.kind === \"function\" || object.identity.kind === \"trigger\").map((object): MigrationObjectState => ({ identity: object.identity, ownership: \"unknown\", state: \"unavailable\", reason: \"dependency-inspection-unavailable\", differences: [] })));\n const creates: string[] = [];\n for (const object of objects) {\n for (const dependency of object.dependsOn) {\n if ([...objects.map((entry) => entry.identity), ...schemaObjectIdentities({ schema, dialect, namespace })].some((identity) => sqlObjectKey({ identity }) === sqlObjectKey({ identity: dependency }))) continue;\n const state = await inspectSqlObject({ executor, dialect, identity: dependency });\n if (state.state !== \"present\") states.push({ identity: dependency, ownership: \"migration\", state: \"unavailable\", reason: \"dependency-unavailable\", differences: [] });\n }\n const expected = object.expected ?? params.previous?.definitions.find((entry) => sqlObjectKey({ identity: entry.identity }) === sqlObjectKey({ identity: object.identity }));\n const live = await inspectSqlObject({ executor, dialect, identity: object.identity });\n if (expected === undefined) states.push({ identity: object.identity, ownership: \"migration\", state: \"unavailable\", differences: [], reason: \"independent-definition-required\" });\n else if (live.state === \"missing\") {\n states.push({ identity: object.identity, ownership: \"migration\", state: \"missing\", differences: [] });\n creates.push(...object.create);\n } else {\n const report = await verifyMigrationState({ executor, dialect, expected: { schema: { ...schema, models: [], migrationObjects: [object] }, definitions: [expected] } });\n states.push(...report.objects);\n }\n }\n for (const object of legacyObjects) {\n if (objects.some((entry) => sqlObjectKey({ identity: entry.identity }) === sqlObjectKey({ identity: object.identity }))) throw new VibeError({ code: \"VIBE_SCHEMA_INVALID\", message: \"Duplicate combined and migration-only ownership\", meta: { identity: object.identity } });\n const expected = object.expected ?? params.previous?.definitions.find((entry) => sqlObjectKey({ identity: entry.identity }) === sqlObjectKey({ identity: object.identity }));\n if (expected === undefined) states.push({ identity: object.identity, ownership: \"migration\", state: \"unavailable\", reason: \"legacy-definition-required\", differences: [] });\n else {\n const live = await inspectSqlObject({ executor, dialect, identity: object.identity });\n if (live.state === \"missing\") states.push({ identity: object.identity, ownership: \"migration\", state: \"missing\", differences: [] });\n else states.push(...(await verifyMigrationState({ executor, dialect, expected: { schema: { ...schema, models: [], migrationObjects: [object] }, definitions: [expected] } })).objects);\n }\n }\n // Removing a migration-only registration does not surrender its former ownership.\n const protectedObjects = [...legacyObjects, ...objects, ...(params.previous?.schema.migrationObjects ?? [])];\n const stripped = preserveMigrationObjects({ from: stripExtensionArtifacts({ schema: physical, artifacts }), to: schema, objects: protectedObjects, namespace });\n const checked = await prepareCheckDiff({ executor, from: stripped, to: schema, dialect, ...(params.probe === undefined ? {} : { probe: params.probe }), ...(params.previous === undefined ? {} : { previous: params.previous }), ...(params.replaceChecks === undefined ? {} : { replaceChecks: params.replaceChecks }) });\n const from = await prepareExclusionDiff({ ...params, from: checked, to: schema });\n const steps = diffSchemas({ from, to: schema, dialect });\n const known = new Set(schemaObjectIdentities({ schema: params.previous?.schema ?? schema, dialect, namespace }).map((identity) => sqlObjectKey({ identity })));\n // Constraint-backed UNIQUEs and ordinary unique indexes are the same authored\n // guarantee. Recover the catalog owner's name only when the independent IR\n // already declares that exact key shape.\n const declaredIndexes = normalizeSchema({ schema: params.previous?.schema ?? schema, dialect });\n const physicalIndexes = normalizeSchema({ schema: physical, dialect });\n for (const [table, model] of physicalIndexes.tables) for (const [key, index] of model.indexes) {\n if (index.constraintName !== undefined && declaredIndexes.tables.get(table)?.indexes.has(key)) known.add(sqlObjectKey({ identity: { kind: \"constraint\", constraintType: \"unique\", table: { namespace, name: table }, name: index.constraintName } }));\n }\n const migrationOwned = new Set(protectedObjects.map((object) => sqlObjectKey({ identity: object.identity })));\n const removals = steps.flatMap((step) => { const identity = removalIdentity({ step, namespace }); return identity === undefined ? [] : [identity]; });\n const droppedTables = new Set(steps.flatMap((step) => step.kind === \"dropTable\" || step.kind === \"dropJoinTable\" ? [step.table] : []));\n const unmanagedRemovals: SqlObjectIdentity[] = [];\n const invalid = dialect === \"sqlite\" ? sqliteInvalidatedTables({ steps, from: physical }) : { rebuilt: new Set<string>(), dropped: new Set<string>() };\n if (dialect === \"sqlite\") await assertSqliteRebuildTableOptions({ executor, tables: invalid.rebuilt });\n for (const object of inventory) {\n const key = sqlObjectKey({ identity: object.identity });\n const normalizedOwner = object.backingConstraint === undefined ? undefined : inventory.find((entry) => entry.identity.kind === \"constraint\" && entry.identity.name === object.backingConstraint && \"table\" in object.identity && entry.identity.table.name === object.identity.table.name);\n const ownership = migrationOwned.has(key) ? \"migration\" : known.has(key) || (normalizedOwner !== undefined && known.has(sqlObjectKey({ identity: normalizedOwner.identity }))) ? \"schema\" : \"unknown\";\n if (object.inspectionUnavailable !== undefined) states.push({ identity: object.identity, ownership, state: \"unavailable\", reason: object.inspectionUnavailable, differences: [] });\n if (object.inspectionUnavailable !== undefined && invalid.rebuilt.has(\"table\" in object.identity ? object.identity.table.name : object.identity.name.name)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"SQLite rebuild cannot discard an unrepresented constraint; declare its independent definition or use a reviewed migration\", meta: { reason: \"sqlite-preservation-unavailable\", identity: object.identity } });\n if (ownership === \"unknown\") states.push({ identity: object.identity, ownership, state: \"unavailable\", reason: \"unmanaged\", differences: [] });\n let collateral = \"table\" in object.identity && object.identity.table.namespace === namespace && droppedTables.has(object.identity.table.name);\n const declared = protectedObjects.find((entry) => sqlObjectKey({ identity: entry.identity }) === key);\n if (declared?.dependsOn.some((dependency) => removals.some((identity) => sqlObjectKey({ identity }) === sqlObjectKey({ identity: dependency })) || (\"table\" in dependency && dependency.table.namespace === namespace && droppedTables.has(dependency.table.name)))) collateral = true;\n if (ownership === \"unknown\" && object.identity.kind === \"function\" && steps.some((step) => step.kind === \"dropTable\" || step.kind === \"dropColumn\" || step.kind === \"dropJoinTable\")) states.push({ identity: object.identity, ownership, state: \"unavailable\", reason: \"dependency-inspection-unavailable\", differences: [] });\n if (dialect === \"postgres\" && steps.some((step) => step.kind === \"dropTable\" || step.kind === \"dropColumn\" || step.kind === \"dropJoinTable\")) {\n const inspected = await inspectSqlObject({ executor, dialect, identity: object.identity });\n if (inspected.state !== \"present\") {\n states.push({ identity: object.identity, ownership, state: \"unavailable\", reason: \"dependency-inspection-unavailable\", differences: [] });\n } else {\n const addresses = inspected.definition.facts.dependencyAddresses;\n if (Array.isArray(addresses)) for (const address of addresses) {\n const value: unknown = JSON.parse(String(address));\n if (!Array.isArray(value) || !Array.isArray(value[2])) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Malformed catalog dependency address\" });\n const names = value[2] as unknown[];\n if (names[0] !== namespace || typeof names[1] !== \"string\") continue;\n if (droppedTables.has(names[1]) || steps.some((step) => step.kind === \"dropColumn\" && step.table === names[1] && step.column === names[2])) collateral = true;\n }\n }\n }\n if (dialect === \"sqlite\" && ownership === \"unknown\" && object.identity.kind === \"generatedColumn\" && invalid.rebuilt.has(object.identity.table.name)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"SQLite generated-column preservation requires an independent ownership declaration\", meta: { reason: \"sqlite-preservation-unavailable\", identity: object.identity } });\n const removed = collateral || removals.some((identity) => sqlObjectKey({ identity }) === key);\n if (removed && ownership === \"migration\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Automatic DDL would remove a migration-owned object\", meta: { reason: \"migration-owned-removal\", identity: object.identity } });\n if (removed && ownership === \"unknown\" && object.backingConstraint === undefined) unmanagedRemovals.push(object.identity);\n }\n const invalidated = new Set([...invalid.rebuilt, ...invalid.dropped]);\n const installed = await probeInstalledExtensionState({ executor, dialect, artifacts });\n const triggers = installed.triggers === undefined ? undefined : new Set(installed.triggers);\n for (const artifact of artifacts) if (artifact.owns.kind === \"trigger\" && invalidated.has(artifact.owns.table)) triggers?.delete(artifact.owns.name);\n const missing = planMissingArtifacts({ introspected: physical, artifacts, installed: { ...installed, ...(triggers === undefined ? {} : { triggers }) } });\n const restore = new Map<string, string[]>();\n const preservedColumns = new Map<string, Map<string, { sql: string; generated: boolean }>>();\n const preservedDefaults = new Map<string, Map<string, string | null>>();\n if (invalid.rebuilt.size > 0) {\n const query = renderSqliteRebuildObjects({ dialect: sqliteDialect });\n const rows = await executor({ text: query.text, values: [] });\n const targetIndexes = normalizeSchema({ schema, dialect });\n for (const row of rows) {\n const table = String(row.tbl_name);\n if (!invalid.rebuilt.has(table) || typeof row.sql !== \"string\") continue;\n if (row.type === \"index\" && (steps.some((step) => step.kind === \"dropIndex\" && step.table === table && step.name === row.name) || [...(targetIndexes.tables.get(table)?.indexes.values() ?? [])].some((index) => index.name === row.name))) continue;\n const statements = restore.get(table) ?? [];\n statements.push(row.sql);\n restore.set(table, statements);\n }\n for (const object of protectedObjects) {\n const identity = object.identity;\n if ((identity.kind !== \"column\" && identity.kind !== \"columnDefault\" && identity.kind !== \"generatedColumn\") || !invalid.rebuilt.has(identity.table.name)) continue;\n const live = await inspectSqlObject({ executor, dialect, identity });\n if (live.state !== \"present\" || (identity.kind !== \"columnDefault\" && typeof live.definition.facts.columnDefinition !== \"string\")) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot read the verified SQLite column definition for preservation\", meta: { reason: \"sqlite-preservation-unavailable\", identity } });\n if (identity.kind === \"columnDefault\") {\n const definition = live.definition.facts.definition;\n if (definition !== null && typeof definition !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot preserve SQLite default\", meta: { identity } });\n const defaults = preservedDefaults.get(identity.table.name) ?? new Map<string, string | null>();\n defaults.set(identity.column, definition);\n preservedDefaults.set(identity.table.name, defaults);\n } else {\n const columns = preservedColumns.get(identity.table.name) ?? new Map<string, { sql: string; generated: boolean }>();\n columns.set(identity.column, { sql: String(live.definition.facts.columnDefinition), generated: Number(live.definition.facts.generated) > 1 });\n preservedColumns.set(identity.table.name, columns);\n }\n }\n }\n const preserved = dialect === \"sqlite\" ? sqlitePreservedSchema({ from: physical, to: schema, objects: protectedObjects }) : schema;\n const target: SchemaIR = { ...preserved, models: preserved.models.map((model) => ({ ...model, fields: model.fields.map((field) => {\n const defaults = preservedDefaults.get(model.dbName ?? model.name);\n const column = field.dbName ?? field.name;\n if (!defaults?.has(column)) return field;\n const { default: ignored, ...rest } = field;\n const expression = defaults.get(column);\n return { ...rest, ...(typeof expression === \"string\" ? { default: { kind: \"dbgenerated\" as const, sql: expression } } : {}) };\n }) })) };\n const core = renderSteps({ steps, dialect, from: dialect === \"sqlite\" ? physical : from, to: dialect === \"mysql\" ? { ...target, migrationObjects: protectedObjects } : target, sqliteRestore: restore, sqliteColumns: preservedColumns });\n const sql = [...artifactCreateSql({ artifacts: missing.filter((artifact) => artifact.owns.kind === \"postgresExtension\") }), ...core,\n ...artifactCreateSql({ artifacts: missing.filter((artifact) => artifact.owns.kind !== \"postgresExtension\" && !(artifact.owns.kind === \"trigger\" && invalid.rebuilt.has(artifact.owns.table))) }), ...creates];\n if (sql.length === 0) {\n const definitions = [...(params.previous?.definitions ?? [])];\n for (const object of objects) if (object.expected !== undefined && !definitions.some((definition) => sqlObjectKey({ identity: definition.identity }) === sqlObjectKey({ identity: object.identity }))) definitions.push(object.expected);\n const report = await verifyMigrationState({ executor, dialect, expected: { schema, definitions }, ...(params.probe === undefined ? {} : { probe: params.probe }) });\n states.push(...report.objects);\n }\n const blocked = states.some((state) => state.reason === \"dependency-inspection-unavailable\" || (state.ownership !== \"unknown\" && state.reason !== \"legacy-definition-required\" && (state.state === \"unavailable\" || state.state === \"changed\" || state.state === \"missing\" && sql.length === 0)));\n return { physical, from, to: schema, namespace, steps, objects: states, unmanagedRemovals, blocked, sql: blocked ? [] : sql };\n}\n\n",
|
|
53
|
+
"import { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR, SqlObjectIdentity, VibeExtension } from \"@vibeorm/schema\";\nimport { generateMigration } from \"./runner.ts\";\nimport { captureMigrationReference } from \"./reference-state.ts\";\nimport { compileDesiredState } from \"./compile-desired-state.ts\";\nimport { assertMigrationState, verifyMigrationState } from \"./inspect-objects.ts\";\nimport type { MigrationStateReport } from \"./inspect-objects.ts\";\nimport { verifyMigrationReference } from \"./verify-history.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { orderedMigrationObjects } from \"./object-ownership.ts\";\nimport { joinSqlStatements, splitSqlStatements } from \"./sql-statements.ts\";\nimport type { ReplayReference } from \"./shadow-types.ts\";\nimport type { MigrationFile, SqlExecutor } from \"./types.ts\";\n\n/** Render a first baseline from declarations, never from the populated target. */\nexport function generateBaselineMigration(params: {\n schema: SchemaIR;\n name: string;\n dialect: Dialect;\n extensions?: readonly VibeExtension[];\n}): MigrationFile {\n const objects = orderedMigrationObjects({ objects: params.schema.migrationObjects ?? [] });\n for (const object of objects) if (object.dialect !== params.dialect) throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: `Baseline object ${object.id} requires ${object.dialect}`, meta: { identity: object.identity, dialect: params.dialect } });\n const prerequisites = objects.filter((object) => object.identity.kind === \"postgresExtension\" || object.identity.kind === \"enum\" || object.identity.kind === \"sequence\");\n const prerequisiteKeys = new Set(prerequisites.map((object) => sqlObjectKey({ identity: object.identity })));\n for (const object of prerequisites) {\n const unresolved = object.dependsOn.filter((identity) => !prerequisiteKeys.has(sqlObjectKey({ identity })));\n if (unresolved.length > 0) throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: \"Baseline prerequisite depends on objects created later. Supply reviewed initial SQL with an explicit dependency order.\", meta: { reason: \"baseline-prerequisite-order\", identity: object.identity, dependencies: unresolved } });\n }\n const schema = { ...params.schema, migrationObjects: objects.filter((object) => !prerequisiteKeys.has(sqlObjectKey({ identity: object.identity }))) };\n const generated = generateMigration({ from: { datasource: schema.datasource, models: [], enums: [], extensions: [] }, to: schema, name: params.name, dialect: params.dialect, extensions: params.extensions ?? [] });\n // The loader is the checksum/statement-count contract, including custom bodies.\n const sql = splitSqlStatements({ sql: joinSqlStatements({ sql: [...prerequisites.flatMap((object) => object.create), ...generated.sql] }), dialect: params.dialect });\n if (sql.length === 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"A baseline must create declared database objects\", meta: { reason: \"baseline-empty\" } });\n return { name: generated.name, sql, destructive: generated.destructive,\n ...(generated.rls === undefined ? {} : { rls: generated.rls }),\n ...(generated.securityChanges === undefined ? {} : { securityChanges: generated.securityChanges }) };\n}\n\n/** Prove the independently replayed SQL implements declarations, including raw CHECKs. Scratch only. */\nexport async function verifyBaselineDeclarations(params: {\n executor: SqlExecutor;\n schema: SchemaIR;\n dialect: Dialect;\n}): Promise<DesiredState> {\n const captured = await captureMigrationReference({ referenceExecutor: params.executor, schema: params.schema, dialect: params.dialect });\n const authored = (params.schema.migrationObjects ?? []).flatMap((object) => object.expected === undefined ? [] : [object.expected]);\n const customKeys = new Set((params.schema.migrationObjects ?? []).map((object) => sqlObjectKey({ identity: object.identity })));\n const customDefinitions = captured.definitions.filter((definition) => customKeys.has(sqlObjectKey({ identity: definition.identity })) && !authored.some((entry) => sqlObjectKey({ identity: entry.identity }) === sqlObjectKey({ identity: definition.identity })));\n const verify = async (): Promise<void> => {\n // Normalize AUTHORED expressions on scratch, rather than accepting captured\n // constraints as their own proof. Custom SQL cannot silently weaken a CHECK.\n const compiled = params.dialect === \"postgres\"\n ? await compileDesiredState({ ...params, schema: captured.schema, steps: [], probe: \"rollback\" })\n : { schema: captured.schema, definitions: authored };\n const expected = { ...compiled, definitions: [...compiled.definitions, ...customDefinitions] };\n assertMigrationState({ report: await verifyMigrationState({ ...params, expected, ...(params.dialect === \"mysql\" ? { probe: \"temporary\" as const } : {}) }) });\n };\n if (params.dialect === \"postgres\") {\n await params.executor({ text: \"BEGIN\" });\n await verify().finally(() => params.executor({ text: \"ROLLBACK\" }));\n } else await verify();\n return captured;\n}\n\n/** Successful comparison includes explicitly excluded extras, never a claim of full ownership. */\nexport type BaselineVerification = MigrationStateReport & { readonly unmanaged: readonly SqlObjectIdentity[] };\n\n/** Compare an independent replay to a target using catalog reads only; never probe or repair target DDL. */\nexport async function verifyBaselineTarget(params: {\n executor: SqlExecutor;\n reference: ReplayReference;\n /** The still-open, independently replayed reference; required for native policy facts. */\n referenceExecutor?: SqlExecutor;\n excludeUnmanaged?: readonly SqlObjectIdentity[];\n}): Promise<BaselineVerification> {\n const { reference } = params;\n if (reference.unavailable.length > 0 || reference.inventory.some((object) => object.inspectionUnavailable !== undefined)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Baseline reference contains objects that cannot be inspected. Supply supported reviewed declarations before adoption.\", meta: { reason: \"baseline-reference-unavailable\", objects: reference.unavailable, inventory: reference.inventory.filter((object) => object.inspectionUnavailable !== undefined) } });\n const comparison = await verifyMigrationReference({ executor: params.executor, dialect: reference.dialect, reference, referenceExecutor: params.referenceExecutor }).catch((cause: unknown) => {\n if (cause instanceof VibeError && cause.meta.reason === \"verification-rls-reference-required\") throw new VibeError({ code: cause.code, message: cause.message, meta: { reason: \"baseline-rls-reference-required\" }, cause });\n throw cause;\n });\n const security = comparison.objects.filter((object) => object.reason === \"native-rls-mismatch\");\n if (security.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Target native RLS policies or flags differ from the independent baseline. Restore the reviewed security declarations before recording; no target policies were changed.\", meta: { reason: \"baseline-rls-mismatch\", shadowReusable: true, expected: security.flatMap((object) => object.differences.flatMap((difference) => difference.expected === undefined ? [] : [difference.expected])), actual: security.flatMap((object) => object.differences.flatMap((difference) => difference.actual === undefined ? [] : [difference.actual])) } });\n if (comparison.unavailable.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Baseline comparison contains objects whose definitions cannot be verified in the target context; use a supported reference before adoption.\", meta: { reason: \"baseline-target-unavailable\", shadowReusable: true, objects: comparison.unavailable } });\n // Unmanaged extras have their own exact exclusion check below. They may be\n // excluded, but missing/changed declared objects must still refuse adoption.\n const report: MigrationStateReport = { inSync: comparison.objects.every((object) => object.state === \"matching\"), objects: comparison.objects };\n assertMigrationState({ report });\n const unmanaged = comparison.unmanaged.map((object) => object.identity);\n const extras = new Set(unmanaged.map((identity) => sqlObjectKey({ identity })));\n const exclusions = params.excludeUnmanaged ?? [];\n const excluded = new Set(exclusions.map((identity) => sqlObjectKey({ identity })));\n if (excluded.size !== exclusions.length || exclusions.some((identity) => !extras.has(sqlObjectKey({ identity })))) throw new VibeError({ code: \"VIBE_CONFIG\", message: \"Baseline exclusions must uniquely name actual unmanaged target objects, never declared objects\", meta: { reason: \"baseline-exclusion-invalid\", shadowReusable: true, exclusions } });\n const unreviewed = unmanaged.filter((identity) => !excluded.has(sqlObjectKey({ identity })));\n if (unreviewed.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Target has unmanaged objects. Register their SQL or explicitly exclude each identity with --exclude-unmanaged; no target objects were removed.\", meta: { reason: \"baseline-unmanaged-objects\", shadowReusable: true, objects: unreviewed } });\n return { ...report, unmanaged };\n}\n",
|
|
54
|
+
"import { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR } from \"@vibeorm/schema\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { createDesiredState } from \"./desired-state.ts\";\nimport { inspectSqlObject, migrationNamespace } from \"./inspect-objects.ts\";\nimport { resolvePostgresTypeIdentities } from \"./postgres-type-identity.ts\";\nimport { introspectPhysicalPostgres } from \"./introspect/postgres.ts\";\nimport { columnTypeKey } from \"./postgres-types.ts\";\nimport { schemaObjectIdentities } from \"./object-ownership.ts\";\nimport type { SqlExecutor } from \"./types.ts\";\n\n/**\n * Capture normalized definitions from an independently built reference database.\n * The caller must supply a disposable reference built from reviewed migrations,\n * never the target whose drift or adoption will be checked against this record.\n */\nexport async function captureMigrationReference(params: {\n referenceExecutor: SqlExecutor;\n schema: SchemaIR;\n dialect: Dialect;\n}): Promise<DesiredState> {\n const namespace = await migrationNamespace({ executor: params.referenceExecutor, dialect: params.dialect });\n const identities = [...schemaObjectIdentities({ schema: params.schema, dialect: params.dialect, namespace }), ...(params.schema.migrationObjects ?? []).map((object) => object.identity)];\n const definitions = [];\n for (const identity of new Map(identities.map((identity) => [sqlObjectKey({ identity }), identity])).values()) {\n // Column/default/index/FK shapes already have structured IR comparison. Raw\n // definitions and maintenance objects need the independent catalog reference.\n if (!params.schema.migrationObjects?.some((object) => sqlObjectKey({ identity: object.identity }) === sqlObjectKey({ identity })) && !(identity.kind === \"constraint\" && (identity.constraintType === \"check\" || identity.constraintType === \"exclusion\"))) continue;\n const result = await inspectSqlObject({ executor: params.referenceExecutor, dialect: params.dialect, identity });\n if (result.state !== \"present\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Independent reference object is missing or unavailable\", meta: { reason: \"reference-unavailable\", identity, state: result.state } });\n definitions.push(result.definition);\n }\n let schema = params.schema;\n if (params.dialect === \"postgres\" && schema.models.some((model) => model.fields.some((field) => field.isUnsupported === true))) {\n const resolved = await resolvePostgresTypeIdentities({ executor: params.referenceExecutor, schema, mode: \"reference\" });\n if (resolved.unavailable.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Resolve unsupported types in the independent reference before capture\", meta: { reason: \"type-reference-required\", columns: resolved.unavailable } });\n const physical = await introspectPhysicalPostgres({ executor: params.referenceExecutor });\n for (const model of resolved.schema.models) for (const field of model.fields) {\n if (field.isUnsupported !== true) continue;\n const actual = physical.models.find((entry) => entry.name === (model.dbName ?? model.name))?.fields.find((entry) => entry.name === (field.dbName ?? field.name));\n if (actual === undefined || columnTypeKey({ field }) !== columnTypeKey({ field: actual })) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Independent reference column does not match its declared PostgreSQL type\", meta: { reason: \"reference-type-mismatch\", table: model.dbName ?? model.name, column: field.dbName ?? field.name } });\n }\n schema = resolved.schema;\n }\n return createDesiredState({ schema, dialect: params.dialect, definitions });\n}\n",
|
|
55
|
+
"import { deparseExclusion } from \"./exclusions.ts\";\nimport { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR, SqlObjectDefinition } from \"@vibeorm/schema\";\nimport { renderExclusionSetup, getSqlDialect, renderMigrationServerVersion } from \"@vibeorm/sql\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { createDesiredState } from \"./desired-state.ts\";\nimport { deparsePostgresCheckDefinition } from \"./inspect-objects.ts\";\nimport { renderSteps } from \"./ddl/render.ts\";\nimport type { MigrationStep, SqlExecutor } from \"./types.ts\";\n\n/** Compile authored PostgreSQL CHECKs including newly created tables under an explicit rollback probe. */\nexport async function compileDesiredState(params: {\n executor: SqlExecutor;\n schema: SchemaIR;\n dialect: Dialect;\n steps: readonly MigrationStep[];\n probe: \"rollback\";\n}): Promise<DesiredState> {\n if (params.dialect !== \"postgres\") throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: \"Rollback declaration compilation requires PostgreSQL\", meta: { feature: \"desiredStateCompilation\", dialect: params.dialect } });\n if (params.steps.some((step) => step.kind === \"alterColumn\" || step.kind === \"addColumn\" || step.kind === \"addEnumValue\")) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"CHECK compilation after column or enum changes requires an independently built reference with the new type context\", meta: { reason: \"reference-required\" } });\n const definitions: SqlObjectDefinition[] = (params.schema.migrationObjects ?? []).flatMap((object) => object.expected === undefined ? [] : [object.expected]);\n await params.executor({ text: \"SAVEPOINT vibeorm_desired_state\" });\n try {\n // Only render new empty table/type definitions. Never run arbitrary extension SQL,\n // data statements, destructive operations or scripts supplied by the application.\n const newObjects = params.steps.filter((step) => step.kind === \"createTable\" || step.kind === \"createEnum\" || step.kind === \"addEnumValue\");\n for (const text of renderSteps({ steps: newObjects, dialect: \"postgres\" })) await params.executor({ text });\n const models = [];\n for (const model of params.schema.models) {\n const table = { namespace: \"public\", name: model.dbName ?? model.name };\n const exclusions = [];\n for (const exclusion of model.exclusions ?? []) {\n for (const text of renderExclusionSetup({ dialect: getSqlDialect({ dialect: \"postgres\" }), exclusion })) await params.executor({ text });\n exclusions.push({ ...exclusion, normalizationSource: exclusion.definition, normalizedDefinition: await deparseExclusion({ executor: params.executor, table: table.name, definition: exclusion.definition }) });\n }\n models.push({ ...model, ...(exclusions.length ? { exclusions } : {}) });\n for (const check of model.checks ?? []) definitions.push(await deparsePostgresCheckDefinition({ executor: params.executor, table, expression: check.expression, constraint: check.name, probe: \"rollback\" }));\n }\n const query = renderMigrationServerVersion({ dialect: getSqlDialect({ dialect: params.dialect }) });\n const version = (await params.executor({ text: query.text, values: [] }))[0]?.version;\n if (typeof version !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot determine definition normalization version\" });\n return { ...createDesiredState({ schema: { ...params.schema, models }, dialect: params.dialect, definitions }), normalization: { format: \"catalog-v1\", dialect: params.dialect, serverVersion: version } };\n } finally {\n await params.executor({ text: \"ROLLBACK TO SAVEPOINT vibeorm_desired_state\" });\n await params.executor({ text: \"RELEASE SAVEPOINT vibeorm_desired_state\" });\n }\n}\n",
|
|
56
|
+
"import { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, QualifiedSqlName, SqlObjectDefinition, SqlObjectFacts, SqlObjectIdentity } from \"@vibeorm/schema\";\nimport { getSqlDialect, renderReplayCoverageGaps } from \"@vibeorm/sql\";\nimport { canonicalMigrationJson } from \"./desired-state.ts\";\nimport { migrationChecksum } from \"./migration-checksum.ts\";\nimport { compareSqlitePrimaryKeyRepresentations } from \"./compare-sqlite-primary-key.ts\";\nimport { comparePostgresReferenceRls } from \"./compare-reference-rls.ts\";\nimport { migrationNamespace, verifyMigrationState } from \"./inspect-objects.ts\";\nimport type { MigrationObjectState } from \"./inspect-objects.ts\";\nimport { inspectMigrationInventory } from \"./inventory.ts\";\nimport type { CatalogObject } from \"./inventory.ts\";\nimport type { ReplayReference } from \"./shadow-types.ts\";\nimport type { MigrationFile, RecordedMigration, SqlExecutor } from \"./types.ts\";\n\n/** Select only the exact checksum-bound applied prefix returned by readMigrationHistory. */\nexport function selectMigrationVerificationPrefix(params: {\n readonly migrations: readonly MigrationFile[];\n readonly recorded: readonly RecordedMigration[];\n}): readonly MigrationFile[] {\n const seen = new Set<string>();\n for (const [index, file] of params.migrations.entries()) {\n const previous = params.migrations[index - 1];\n if (seen.has(file.name) || (previous !== undefined && previous.name.localeCompare(file.name) > 0)) {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Verification requires a complete local migration chain in unique name order\", meta: { reason: \"verification-history-order\", migration: file.name } });\n }\n seen.add(file.name);\n }\n for (const [index, row] of params.recorded.entries()) {\n const file = params.migrations[index];\n if (row.state !== \"applied\" || row.statementIndex < 0 || row.checksum === \"\" || file?.name !== row.name || file.desiredStatePending === true || migrationChecksum(file) !== row.checksum) {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Verification requires an exact, complete, checksum-verified applied prefix; inspect migrate status and resolve the history discrepancy first\", meta: { reason: \"verification-history-unverified\", migration: row.name, state: row.state } });\n }\n }\n return params.migrations.slice(0, params.recorded.length);\n}\n\n/** Coverage is limited to represented objects in the migration namespace, not all database infrastructure. */\nexport type MigrationVerificationReport = {\n readonly inSync: boolean;\n readonly scope: \"migration-namespace\";\n readonly namespace: string;\n readonly objects: readonly MigrationObjectState[];\n readonly unavailable: readonly MigrationObjectState[];\n readonly unmanaged: readonly CatalogObject[];\n};\n\n/** Compare independently replayed evidence using catalog reads only, never target normalization probes. */\nexport async function verifyMigrationReference(params: {\n readonly executor: SqlExecutor;\n readonly dialect: Dialect;\n readonly reference: ReplayReference;\n /** Live independent replay connection; required when its schema declares native RLS. */\n readonly referenceExecutor?: SqlExecutor;\n}): Promise<MigrationVerificationReport> {\n const { executor, dialect } = params;\n if (params.reference.dialect !== dialect) throw referenceContextError();\n const namespace = await migrationNamespace({ executor, dialect });\n if (params.reference.namespace !== namespace && dialect !== \"mysql\") throw referenceContextError();\n const reference = params.reference.namespace === namespace ? params.reference\n : await rebaseMysqlVerificationReference({ reference: params.reference, namespace });\n const inventory = await inspectMigrationInventory({ executor, dialect, namespace });\n // Inventory establishes catalog visibility first. Coverage rows describe gaps,\n // not representable SqlObjectIdentity values or present/missing verdicts.\n const coverage = renderReplayCoverageGaps({ dialect: getSqlDialect({ dialect }), namespace });\n const gaps = await executor({ text: coverage.text, values: [...coverage.values] });\n if (gaps.length > 0) throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: \"Target contains objects whose full definitions are outside migration inspection coverage; verification is unavailable. No target changes were made.\", meta: { feature: \"targetInventoryCoverage\", dialect, namespace, objects: gaps } });\n const security = dialect === \"postgres\" ? await comparePostgresReferenceRls({ executor, referenceExecutor: params.referenceExecutor, schema: reference.state.schema }) : { inSync: true, objects: [] };\n const inspected = await verifyMigrationState({ executor, dialect, expected: reference.state, probe: \"none\", batch: true });\n const structural = dialect === \"sqlite\" ? compareSqlitePrimaryKeyRepresentations({ report: inspected }) : inspected;\n const result = { inSync: structural.inSync && security.inSync, objects: [...structural.objects, ...security.objects] };\n const definitions = new Set(reference.state.definitions.map((definition) => sqlObjectKey({ identity: definition.identity })));\n const known = new Set([\n ...reference.inventory.map((object) => sqlObjectKey({ identity: object.identity })),\n ...definitions,\n ...reference.unavailable.map((object) => sqlObjectKey({ identity: object.identity })),\n ]);\n const unavailable: MigrationObjectState[] = [\n ...reference.unavailable,\n ...result.objects.filter((object) => object.state === \"unavailable\"),\n ];\n const unavailableKeys = new Set(reference.unavailable.map((object) => sqlObjectKey({ identity: object.identity })));\n for (const object of reference.inventory) {\n const key = sqlObjectKey({ identity: object.identity });\n const reason = object.inspectionUnavailable ?? (definitions.has(key) || unavailableKeys.has(key) ? undefined : \"reference-definition-unavailable\");\n if (reason !== undefined) unavailable.push({ identity: object.identity, ownership: \"unknown\", state: \"unavailable\", reason, differences: [] });\n }\n for (const object of inventory) {\n if (object.inspectionUnavailable !== undefined) unavailable.push({ identity: object.identity, ownership: \"unknown\", state: \"unavailable\", reason: object.inspectionUnavailable, differences: [] });\n }\n const unmanaged = inventory.filter((object) => !known.has(sqlObjectKey({ identity: object.identity })));\n return {\n inSync: result.inSync && unavailable.length === 0 && unmanaged.length === 0,\n scope: \"migration-namespace\",\n namespace,\n objects: result.objects,\n unavailable,\n unmanaged,\n };\n}\n\n/** Comparison-only evidence: rebasing must not forge a new replay/context fingerprint. */\nexport type MigrationComparisonReference = Pick<ReplayReference, \"namespace\" | \"state\" | \"inventory\" | \"unavailable\">;\n\n/** Rebase structured MySQL catalog identities and FK namespace fields, never SQL text. */\nexport async function rebaseMysqlVerificationReference(params: {\n readonly reference: ReplayReference;\n readonly namespace: string;\n}): Promise<MigrationComparisonReference> {\n const { reference, namespace } = params;\n if (reference.dialect !== \"mysql\" || namespace.length === 0) throw referenceContextError();\n if (reference.namespace === namespace) return { namespace, state: reference.state, inventory: reference.inventory, unavailable: reference.unavailable };\n const identity = (value: SqlObjectIdentity): SqlObjectIdentity => rebaseIdentity({ identity: value, from: reference.namespace, to: namespace });\n const unavailable: MigrationObjectState[] = reference.unavailable.map((object) => ({ ...object, identity: identity(object.identity) }));\n const definitions: SqlObjectDefinition[] = [];\n for (const definition of reference.state.definitions) {\n const rebased = identity(definition.identity);\n const facts = await mysqlComparisonFacts({ definition, definitions: reference.state.definitions, from: reference.namespace, to: namespace });\n if (facts === undefined) {\n unavailable.push({ identity: rebased, ownership: \"unknown\", state: \"unavailable\", reason: \"mysql-reference-sql-context-unavailable\", differences: [] });\n } else {\n definitions.push({ ...definition, identity: rebased, facts, dependencies: definition.dependencies.map(identity) });\n }\n }\n const byIdentity = new Map(definitions.map((definition) => [sqlObjectKey({ identity: definition.identity }), definition]));\n const schema = reference.state.schema;\n return {\n namespace,\n state: {\n ...reference.state,\n definitions,\n schema: {\n ...schema,\n ...(schema.migrationObjects === undefined ? {} : { migrationObjects: schema.migrationObjects.map((object) => {\n const { expected: ignored, ...declaration } = object;\n const rebased = identity(object.identity);\n const expected = byIdentity.get(sqlObjectKey({ identity: rebased }));\n return { ...declaration, identity: rebased, dependsOn: object.dependsOn.map(identity), ...(expected === undefined ? {} : { expected }) };\n }) }),\n },\n },\n inventory: reference.inventory.map((object) => ({ ...object, identity: identity(object.identity) })),\n unavailable,\n };\n}\n\nfunction rebaseIdentity(params: { identity: SqlObjectIdentity; from: string; to: string }): SqlObjectIdentity {\n const name = (value: QualifiedSqlName): QualifiedSqlName => value.namespace === params.from ? { ...value, namespace: params.to } : value;\n const object = params.identity;\n if (\"table\" in object) return { ...object, table: name(object.table) };\n if (object.kind === \"function\") return { ...object, name: name(object.name), argumentTypes: object.argumentTypes.map(name) };\n return { ...object, name: name(object.name) };\n}\n\nfunction exactFactKeys(params: { facts: Readonly<Record<string, unknown>>; keys: readonly string[] }): boolean {\n return Object.keys(params.facts).length === params.keys.length && params.keys.every((key) => Object.hasOwn(params.facts, key));\n}\n\nfunction plainMysqlColumn(params: { facts: SqlObjectFacts }): boolean {\n const facts = params.facts;\n if (!exactFactKeys({ facts, keys: [\"type\", \"nullable\", \"definition\", \"generated\", \"extra\", \"collation\"] }) || facts.generated !== \"\") return false;\n if (facts.extra === \"\" || facts.extra === \"auto_increment\") return true;\n // These built-in temporal defaults cannot refer to a database namespace.\n // Preserve their exact precision and ON UPDATE facts for the comparison.\n return typeof facts.type === \"string\" && /^(?:datetime|timestamp)(?:\\([0-6]\\))?$/i.test(facts.type)\n && typeof facts.definition === \"string\" && /^current_timestamp(?:\\([0-6]?\\))?$/i.test(facts.definition)\n && typeof facts.extra === \"string\" && /^DEFAULT_GENERATED(?: on update CURRENT_TIMESTAMP(?:\\([0-6]?\\))?)?$/i.test(facts.extra)\n && facts.collation === null;\n}\n\nasync function mysqlComparisonFacts(params: {\n definition: SqlObjectDefinition;\n definitions: readonly SqlObjectDefinition[];\n from: string;\n to: string;\n}): Promise<SqlObjectFacts | undefined> {\n const { identity, facts } = params.definition;\n // These allowlists are bound to migration-objects.ts's MySQL SELECT aliases.\n // Unknown fields are not presumed independent of the database context.\n if (identity.kind === \"table\") return exactFactKeys({ facts, keys: [\"type\", \"engine\", \"collation\"] }) ? facts : undefined;\n if (identity.kind === \"column\") return plainMysqlColumn({ facts }) ? facts : undefined;\n if (identity.kind === \"columnDefault\") {\n if (!exactFactKeys({ facts, keys: [\"definition\"] })) return undefined;\n if (facts.definition === null) return facts;\n // columnDefault inspection strips EXTRA. Its companion column must prove\n // its default is a literal or a proven namespace-independent built-in.\n const key = sqlObjectKey({ identity: { ...identity, kind: \"column\" } });\n const column = params.definitions.find((definition) => sqlObjectKey({ identity: definition.identity }) === key);\n return column !== undefined && plainMysqlColumn({ facts: column.facts }) && column.facts.definition === facts.definition ? facts : undefined;\n }\n if (identity.kind !== \"index\" && identity.kind !== \"constraint\") return undefined;\n const foreignKey = identity.kind === \"constraint\" && identity.constraintType === \"foreignKey\";\n if (identity.kind === \"constraint\") {\n if (identity.constraintType !== \"foreignKey\" && identity.constraintType !== \"primaryKey\" && identity.constraintType !== \"unique\") return undefined;\n if (!exactFactKeys({ facts, keys: [\"type\", \"enforced\", \"definition\", \"onUpdate\", \"onDelete\", \"matchOption\", \"members\"] }) || facts.definition !== null) return undefined;\n } else if (!exactFactKeys({ facts, keys: [\"name\", \"nonUnique\", \"method\", \"visible\", \"members\"] })) return undefined;\n if (!Array.isArray(facts.members) || facts.members.length === 0) return undefined;\n const members: string[] = [];\n for (const text of facts.members) {\n // This decodes our catalog-v1 JSON member records, not SQL. A malformed\n // member has no safe rebasing proof and must not become a clean verdict.\n const member: unknown = await Promise.resolve().then((): unknown => JSON.parse(text)).then((value) => value, () => undefined);\n if (member === null || typeof member !== \"object\" || Array.isArray(member)) return undefined;\n const row = member as Record<string, unknown>;\n if (typeof row.name !== \"string\") return undefined;\n if (identity.kind === \"index\") {\n if (!exactFactKeys({ facts: row, keys: [\"name\", \"expression\", \"prefixLength\", \"collation\"] }) || row.expression !== null\n || (row.prefixLength !== null && typeof row.prefixLength !== \"number\") || (row.collation !== null && typeof row.collation !== \"string\")) return undefined;\n members.push(text);\n } else {\n if (!exactFactKeys({ facts: row, keys: [\"name\", \"referenceNamespace\", \"referenceTable\", \"referenceColumn\"] })) return undefined;\n if (foreignKey ? [row.referenceNamespace, row.referenceTable, row.referenceColumn].some((value) => typeof value !== \"string\" || value.length === 0)\n : [row.referenceNamespace, row.referenceTable, row.referenceColumn].some((value) => value !== null)) return undefined;\n members.push(canonicalMigrationJson({ value: { ...row, referenceNamespace: row.referenceNamespace === params.from ? params.to : row.referenceNamespace } }));\n }\n }\n return { ...facts, members };\n}\n\nfunction referenceContextError(): VibeError {\n return new VibeError({ code: \"VIBE_MIGRATION\", message: \"Replay and target dialect/namespace differ; safe reference translation is unavailable. Use a supported same-namespace reference setup\", meta: { reason: \"verification-reference-context\" } });\n}\n",
|
|
57
|
+
"import { sqliteColumnClauses, sqliteTableConstraints } from \"@vibeorm/sql\";\nimport type { MigrationObjectState, MigrationStateReport } from \"./inspect-objects.ts\";\n\nconst IDENTIFIER = '(?:\"(?:[^\"]|\"\")+\"|`(?:[^`]|``)+`|\\\\[[^\\\\]]+\\\\]|[A-Za-z_][A-Za-z_0-9]*)';\n\ntype TableProof = {\n readonly key: string;\n readonly columns: readonly { readonly name: string; readonly sql: string }[];\n readonly constraints: readonly string[];\n};\n\nfunction escape(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction namePattern(name: string): string {\n return `(?:${[name, `\"${name.replaceAll('\"', '\"\"')}\"`, `\\`${name.replaceAll(\"`\", \"``\")}\\``, `[${name}]`].map(escape).join(\"|\")})`;\n}\n\nfunction tableProof(params: { sql: string }): TableProof | undefined {\n // This is a bounded equivalence proof, not a general SQL normalizer. Existing\n // parsers locate clauses; a full reconstruction below accounts for EVERY byte\n // outside them. Unknown clauses, comments between clauses and options refuse.\n const header = new RegExp(`^\\\\s*CREATE\\\\s+TABLE\\\\s+${IDENTIFIER}\\\\s*\\\\(`, \"i\").exec(params.sql);\n if (header === null) return undefined;\n const columns = sqliteColumnClauses(params);\n const constraints = sqliteTableConstraints(params);\n const clauses = [\n ...columns.map((column) => escape(column.sql)),\n ...constraints.map((constraint) => `${constraint.named ? `CONSTRAINT\\\\s+${namePattern(constraint.name)}\\\\s+` : \"\"}${escape(constraint.sql)}`),\n ];\n if (!new RegExp(`^\\\\s*${clauses.join(\"\\\\s*,\\\\s*\")}\\\\s*\\\\)\\\\s*;?\\\\s*$`).test(params.sql.slice(header[0].length))) return undefined;\n const integerKey = new RegExp(`^${IDENTIFIER}\\\\s+INTEGER\\\\s+NOT\\\\s+NULL(\\\\s+PRIMARY\\\\s+KEY)?$`, \"i\");\n const inline = columns.filter((column) => integerKey.exec(column.sql)?.[1] !== undefined);\n const tableKeys = constraints.filter((constraint) => constraint.type === \"primaryKey\");\n let key: string;\n if (inline.length === 1 && tableKeys.length === 0) key = inline[0]!.name;\n else if (inline.length === 0 && tableKeys.length === 1) {\n const primary = tableKeys[0]!;\n if (primary.columns.length !== 1 || !new RegExp(`^PRIMARY\\\\s+KEY\\\\s*\\\\(\\\\s*${IDENTIFIER}\\\\s*\\\\)$`, \"i\").test(primary.sql)) return undefined;\n key = primary.columns[0]!;\n const column = columns.find((column) => column.name === key);\n if (column === undefined || !integerKey.test(column.sql)) return undefined;\n } else return undefined;\n return {\n key,\n columns: columns.map((column) => ({ name: column.name, sql: column.name === key ? \"INTEGER NOT NULL PRIMARY KEY\" : column.sql })),\n // Keep other constraint names and complete bodies exact, including literals.\n constraints: constraints.filter((constraint) => constraint.type !== \"primaryKey\").map((constraint) => JSON.stringify(constraint)),\n };\n}\n\n/** Accept only proven single INTEGER NOT NULL key syntax changes; retain every other difference. */\nexport function compareSqlitePrimaryKeyRepresentations(params: { report: MigrationStateReport }): MigrationStateReport {\n const proofs = new Map<string, string>();\n for (const object of params.report.objects) {\n if (object.identity.kind !== \"table\" || object.state !== \"changed\") continue;\n const definition = object.differences.find((difference) => difference.attribute === \"definition\");\n if (typeof definition?.expected !== \"string\" || typeof definition.actual !== \"string\") continue;\n const expected = tableProof({ sql: definition.expected });\n const actual = tableProof({ sql: definition.actual });\n if (expected !== undefined && actual !== undefined && JSON.stringify(expected) === JSON.stringify(actual)) proofs.set(JSON.stringify(object.identity.name), expected.key);\n }\n const objects = params.report.objects.map((object): MigrationObjectState => {\n if (object.state !== \"changed\") return object;\n const identity = object.identity;\n const key = identity.kind === \"table\" ? proofs.get(JSON.stringify(identity.name)) : \"table\" in identity ? proofs.get(JSON.stringify(identity.table)) : undefined;\n if (key === undefined) return object;\n const differences = object.differences.filter((difference) => !(identity.kind === \"table\" && difference.attribute === \"definition\")\n && !(identity.kind === \"column\" && identity.column === key && difference.attribute === \"columnDefinition\"));\n return { ...object, differences, state: differences.length === 0 ? \"matching\" : \"changed\" };\n });\n return { inSync: objects.every((object) => object.state === \"matching\"), objects };\n}\n",
|
|
58
|
+
"import { VibeError } from \"@vibeorm/schema\";\nimport type { SchemaIR } from \"@vibeorm/schema\";\nimport { canonicalMigrationJson } from \"./desired-state.ts\";\nimport { readPostgresRls } from \"./introspect/postgres-rls.ts\";\nimport type { PostgresRlsTable } from \"./introspect/postgres-rls.ts\";\nimport type { MigrationObjectState, MigrationStateReport } from \"./inspect-objects.ts\";\nimport type { SqlExecutor } from \"./types.ts\";\n\nfunction securityFacts(params: { tables: readonly PostgresRlsTable[] }): ReadonlyMap<string, unknown> {\n return new Map(params.tables.filter((table) => table.enabled || table.force || table.policies.length > 0).map((table) => [table.table, {\n table: table.table, enabled: table.enabled, force: table.force,\n policies: table.policies.map(({ comment: ignored, ...policy }) => policy),\n }]));\n}\n\n/** Compare replayed native policy facts without target locks, policy DDL or normalization probes. */\nexport async function comparePostgresReferenceRls(params: {\n readonly executor: SqlExecutor;\n readonly referenceExecutor?: SqlExecutor;\n readonly schema: SchemaIR;\n}): Promise<MigrationStateReport> {\n if (params.schema.rls !== undefined && params.referenceExecutor === undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Native RLS verification requires the independently replayed reference connection; target policy probes are not permitted.\", meta: { reason: \"verification-rls-reference-required\" } });\n // Only the applied replay's schema decides whether policy expectations exist.\n // An unprotected reference still checks for unexpected active target policies.\n const expected = securityFacts({ tables: params.schema.rls === undefined ? [] : await readPostgresRls({ executor: params.referenceExecutor! }) });\n const actual = securityFacts({ tables: await readPostgresRls({ executor: params.executor }) });\n const objects: MigrationObjectState[] = [...new Set([...expected.keys(), ...actual.keys()])].sort().map((table) => {\n const before = expected.get(table);\n const after = actual.get(table);\n const matching = canonicalMigrationJson({ value: before }) === canonicalMigrationJson({ value: after });\n return {\n identity: { kind: \"table\", name: { namespace: \"public\", name: table } },\n ownership: \"schema\", state: matching ? \"matching\" : \"changed\",\n ...(matching ? {} : { reason: \"native-rls-mismatch\" }),\n differences: matching ? [] : [{ attribute: \"nativeRls\", expected: before, actual: after }],\n };\n });\n return { inSync: objects.every((object) => object.state === \"matching\"), objects };\n}\n",
|
|
59
|
+
"import { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect } from \"@vibeorm/schema\";\nimport { getSqlDialect, renderStatement } from \"@vibeorm/sql\";\nimport { ensureMigrationsTable, validateMigrationReplay, withMigrationLock } from \"./runner.ts\";\nimport { readMigrationHistory } from \"./history.ts\";\nimport { migrationChecksum } from \"./migration-checksum.ts\";\nimport { MIGRATIONS_TABLE_NAME } from \"./journal-table.ts\";\nimport type { MigrationFile, SqlExecutor } from \"./types.ts\";\n\nfunction transactionFailure(params: { cause: unknown }): VibeError {\n if (params.cause instanceof VibeError) return params.cause;\n return new VibeError({ code: \"VIBE_MIGRATION\", message: \"SQLite baseline recording failed; inspect the journal and transaction outcome before retrying.\", meta: { reason: \"baseline-record-transaction-failed\" }, cause: params.cause });\n}\n\n/** An initial adoption records one checksum and real statement count, never executes its SQL. */\nexport async function recordBaselineMigration(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n migration: MigrationFile;\n acceptSecurityChanges?: boolean;\n dryRun?: boolean;\n verify: (params: { executor: SqlExecutor }) => Promise<void>;\n}): Promise<void> {\n if (params.migration.moduleOrigin !== undefined) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Package module migrations must use the immutable module installation workflow, not baseline adoption\", meta: { reason: \"baseline-module-unsupported\" } });\n validateMigrationReplay({ dialect: params.dialect, migrations: [params.migration], acceptSecurityChanges: params.acceptSecurityChanges });\n await withMigrationLock({ executor: params.executor, dialect: params.dialect, run: async (executor) => {\n const record = async (): Promise<void> => {\n const assertEmpty = async (): Promise<void> => {\n const history = await readMigrationHistory({ executor, migrations: [params.migration], dialect: params.dialect });\n if (history.recorded.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Baseline recording requires an absent or empty migration journal. Use normal apply or explicit recovery for existing history.\", meta: { reason: \"baseline-journal-not-empty\", shadowReusable: true, recorded: history.recorded.map((row) => ({ name: row.name, state: row.state })) } });\n };\n await assertEmpty();\n await params.verify({ executor });\n await assertEmpty();\n if (params.dryRun === true) return;\n await ensureMigrationsTable({ executor, dialect: params.dialect });\n const query = renderStatement({ dialect: getSqlDialect({ dialect: params.dialect }), statement: {\n kind: \"insert\", table: { name: MIGRATIONS_TABLE_NAME }, columns: [\"name\", \"checksum\", \"statement_index\"],\n rows: [[params.migration.name, migrationChecksum(params.migration), params.migration.sql.length]],\n } });\n await executor({ text: query.text, values: [...query.values] });\n };\n if (params.dialect !== \"sqlite\" || params.dryRun === true) return record();\n // Named SQLite baseline-record transaction boundary: acquire the write\n // reservation before observing the journal. Dry-run stays read-only and\n // does not claim an atomic verification/record guarantee.\n await executor({ text: \"BEGIN IMMEDIATE\" }).then(undefined, (cause: unknown) => { throw transactionFailure({ cause }); });\n await Promise.resolve().then(record).then(async () => {\n await executor({ text: \"COMMIT\" });\n }).then(undefined, async (cause: unknown) => {\n await executor({ text: \"ROLLBACK\" }).then(undefined, (rollback: unknown) => {\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Baseline recording failed and its SQLite transaction could not be rolled back. Inspect the journal and connection state before retrying; the outcome is uncertain.\", meta: { reason: \"baseline-record-rollback-failed\" }, cause: new AggregateError([cause, rollback], \"Baseline recording and rollback failed\") });\n });\n throw transactionFailure({ cause });\n });\n } });\n}\n",
|
|
60
|
+
"import type { Dialect } from \"@vibeorm/schema\";\nimport { getSqlDialect, renderModuleJournal, renderMigrationHistoryQuery } from \"@vibeorm/sql\";\nimport { MIGRATIONS_TABLE_NAME } from \"./journal-table.ts\";\nimport { classifyJournal } from \"./runner.ts\";\nimport { migrationNamespace } from \"./inspect-objects.ts\";\nimport { readJournalRows } from \"./journal-read.ts\";\nimport type { MigrationFile, RecordedMigration, SqlExecutor } from \"./types.ts\";\n\n/** Read-only history separates a missing journal from an unreadable or partial one. */\nexport type MigrationHistory = { readonly tablePresent: boolean; readonly recorded: readonly RecordedMigration[] };\n\n/** Never creates a table, acquires an advisory lock or executes native-RLS probes. */\nexport async function readMigrationHistory(params: { executor: SqlExecutor; migrations: readonly MigrationFile[]; dialect: Dialect }): Promise<MigrationHistory> {\n const namespace = await migrationNamespace({ executor: params.executor, dialect: params.dialect });\n const query = params.migrations.some((migration) => migration.moduleOrigin !== undefined)\n ? renderModuleJournal({ dialect: getSqlDialect({ dialect: params.dialect }), table: MIGRATIONS_TABLE_NAME, operation: { kind: \"read\" } })\n : renderMigrationHistoryQuery({ dialect: getSqlDialect({ dialect: params.dialect }), namespace });\n const recorded = await readJournalRows({ executor: params.executor, dialect: params.dialect, query });\n if (recorded === undefined) return { tablePresent: false, recorded: [] };\n return { tablePresent: true, recorded: classifyJournal({ dialect: params.dialect, migrations: params.migrations, recorded }) };\n}\n",
|
|
44
61
|
"/**\n * Down-migration generation: the REVERSE diff of an up migration, with v1's\n * two rollback rules baked in (LEARNINGS / issue #15):\n *\n * 1. RE-ADDED COLUMNS COME BACK NULLABLE. The reverse of `dropColumn` is\n * `addColumn`, but the dropped column's data is gone — re-adding it\n * NOT NULL would fail on any populated table. Every `addColumn` step in a\n * down migration is therefore forced optional (its default, when present,\n * is kept). Whole-table re-creates (`createTable`) keep their NOT NULLs:\n * the re-created table is empty.\n * 2. IRREVERSIBLE UP-STEPS ARE SKIPPED, NOT THROWN. An up migration that\n * added an enum value has no reverse — postgres cannot drop enum values,\n * and sqlite/mysql refuse narrowing an inline enum whose rows may hold the\n * value. The rollback target keeps those values and the skip is reported\n * in `skipped`, so \"undo the last migration\" still works (v1's\n * `isReversible: false` behavior).\n *\n * Extension artifacts: object artifacts the up migration created (columns,\n * indexes, shadow tables, triggers) are dropped by the down migration via\n * their own `drop` SQL. `CREATE EXTENSION`-class artifacts are never dropped\n * — other database objects may depend on the extension — and are reported in\n * `skipped` instead.\n */\n\nimport { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport { preserveMigrationObjects, sqlitePreservedSchema, orderedMigrationObjects } from \"./object-ownership.ts\";\nimport type { Dialect, EnumIR, SchemaIR, VibeExtension } from \"@vibeorm/schema\";\nimport { diffSchemas } from \"./differ.ts\";\nimport { renderSteps } from \"./ddl/render.ts\";\nimport {\n collectExtensionArtifacts,\n planMissingArtifacts,\n stripExtensionArtifacts,\n} from \"./extensions.ts\";\nimport type { MigrationStep } from \"./types.ts\";\nimport { securityChangesOf } from \"./ddl/rls.ts\";\n\n// ─── Result shape ─────────────────────────────────────────────────\n\n/** A generated down migration: reverse SQL plus what could NOT be reversed. */\nexport type DownMigrationFile = {\n /** Actual rollback declaration, including retained enum values and nullable re-added columns. */\n readonly target: SchemaIR;\n readonly name: string;\n /** One SQL string per statement, in execution order. */\n readonly sql: readonly string[];\n /** True when any reverse step can lose data (e.g. dropping an up-added column). */\n readonly destructive: boolean;\n /** Separate review category: never covered by acceptDataLoss. */\n readonly securityChanges?: readonly string[];\n /**\n * Human descriptions of up-changes this down migration cannot reverse\n * (added enum values, installed postgres extensions). Empty = full reverse.\n */\n readonly skipped: readonly string[];\n};\n\n// ─── Rollback target construction ─────────────────────────────────\n\n/**\n * Build the schema the down migration returns the database to. It is `from`\n * (the pre-migration shape) EXCEPT that enum values the up migration added\n * are retained — no dialect can remove an enum value a row may already hold —\n * with one `skipped` entry per retained value.\n */\nfunction buildRollbackTarget(params: {\n from: SchemaIR;\n to: SchemaIR;\n dialect: Dialect;\n}): { target: SchemaIR; skipped: string[] } {\n const { from, to, dialect } = params;\n const skipped: string[] = [];\n\n const toEnumsByKey = new Map<string, EnumIR>();\n for (const enumDef of to.enums) {\n toEnumsByKey.set(enumDef.dbName ?? enumDef.name, enumDef);\n }\n\n let patched = false;\n const enums: EnumIR[] = from.enums.map((enumDef) => {\n const key = enumDef.dbName ?? enumDef.name;\n const after = toEnumsByKey.get(key);\n if (after === undefined) return enumDef; // Enum dropped by up — reverse re-creates it.\n\n const before = new Set(enumDef.values);\n const added = after.values.filter((value) => !before.has(value));\n if (added.length === 0) return enumDef;\n\n for (const value of added) {\n skipped.push(\n `enum \"${key}\": value \"${value}\" added by the up migration is kept — ${dialect} cannot drop enum values`,\n );\n }\n patched = true;\n return { ...enumDef, values: [...enumDef.values, ...added] };\n });\n\n // Unknown pre-migration collations cannot be restored by guessing a server\n // default. Retain the new value and name the incomplete rollback explicitly.\n const models = dialect !== \"mysql\" ? from.models : from.models.map((model) => {\n const afterModel = to.models.find((candidate) => (candidate.dbName ?? candidate.name) === (model.dbName ?? model.name));\n return { ...model, fields: model.fields.map((field) => {\n const after = afterModel?.fields.find((candidate) => (candidate.dbName ?? candidate.name) === (field.dbName ?? field.name));\n if (field.type !== \"String\" || field.collation !== undefined || after?.collation === undefined) return field;\n patched = true;\n skipped.push(`column \"${model.dbName ?? model.name}\".\"${field.dbName ?? field.name}\": previous collation was not recorded; \"${after.collation}\" is retained`);\n return { ...field, collation: after.collation };\n }) };\n });\n return { target: patched ? { ...from, enums, models } : from, skipped };\n}\n\n/** Rule 1: every re-added column comes back nullable (see module doc). */\nfunction forceReAddedColumnsNullable(params: {\n steps: readonly MigrationStep[];\n}): MigrationStep[] {\n return params.steps.map((step) => {\n if (step.kind !== \"addColumn\" || step.column.isOptional) return step;\n return { ...step, column: { ...step.column, isOptional: true } };\n });\n}\n\n// ─── Public API ───────────────────────────────────────────────────\n\n/**\n * Generate the DOWN migration for an up migration described by the same\n * `from`/`to` pair handed to `generateMigration`: `from` is the current\n * database shape, `to` the schema the up migration moves to. The down\n * migration transforms `to` back into `from` (modulo the skipped\n * irreversibles), so callers write it alongside the up file and apply it\n * newest-first to roll back.\n */\nexport function generateDownMigration(params: {\n from: SchemaIR;\n to: SchemaIR;\n name: string;\n /** Rendering dialect; postgres if omitted. */\n dialect?: Dialect;\n /** Configured extension instances — their up-created artifacts are dropped. */\n extensions?: readonly VibeExtension[];\n}): DownMigrationFile {\n const { from, to, name } = params;\n const dialect = params.dialect ?? \"postgres\";\n\n const artifacts = collectExtensionArtifacts({\n schema: to,\n dialect,\n extensions: params.extensions ?? [],\n });\n const allArtifacts = [...artifacts.setup, ...artifacts.objects];\n const owned = [...(from.migrationObjects ?? []), ...(to.migrationObjects ?? [])];\n const strippedFrom = preserveMigrationObjects({ from: stripExtensionArtifacts({ schema: from, artifacts: allArtifacts }), to: from, objects: owned });\n\n const { target, skipped } = buildRollbackTarget({ from: strippedFrom, to, dialect });\n\n // Rule 2 for views (#26): an up migration that DROPPED a view has no\n // reverse — the IR does not store view definitions (views are created\n // out-of-band in this wave), so the down migration cannot re-create it.\n const toViewNames = new Set(\n to.models.filter((model) => model.isView).map((model) => model.dbName ?? model.name),\n );\n const skippedViews = new Set<string>();\n for (const model of target.models) {\n if (!model.isView) continue;\n const name = model.dbName ?? model.name;\n if (!toViewNames.has(name)) {\n skippedViews.add(name);\n skipped.push(\n `view \"${name}\" dropped by the up migration is not re-created — its definition is not stored in the schema; re-create it manually`,\n );\n }\n }\n\n const effectiveTarget: SchemaIR = { ...target, models: target.models.filter((model) => !model.isView || !skippedViews.has(model.dbName ?? model.name)) };\n const steps = forceReAddedColumnsNullable({\n steps: diffSchemas({ from: to, to: effectiveTarget, dialect }),\n });\n const restored: SchemaIR = { ...effectiveTarget, models: effectiveTarget.models.map((model) => ({ ...model, fields: model.fields.map((field) => {\n const added = steps.find((step) => step.kind === \"addColumn\" && step.table === (model.dbName ?? model.name) && (step.column.dbName ?? step.column.name) === (field.dbName ?? field.name));\n return added?.kind === \"addColumn\" ? { ...field, isOptional: added.column.isOptional } : field;\n }) })) };\n const coreSql = renderSteps({ steps, dialect, from: to, to: dialect === \"sqlite\" ? sqlitePreservedSchema({ from, to: restored, objects: from.migrationObjects ?? [] }) : restored });\n\n // Drop the artifacts the up migration created (mirrors generateMigration's\n // planning), object artifacts first. CREATE EXTENSION is never reversed.\n const created = planMissingArtifacts({ introspected: from, artifacts: allArtifacts });\n const artifactDropSql: string[] = [];\n for (const artifact of [...created].reverse()) {\n if (artifact.owns.kind === \"postgresExtension\") {\n skipped.push(\n `extension \"${artifact.owns.name}\" stays installed — other objects may depend on it (drop it manually if intended)`,\n );\n continue;\n }\n artifactDropSql.push(...artifact.drop);\n }\n\n const previousKeys = new Set((from.migrationObjects ?? []).map((object) => sqlObjectKey({ identity: object.identity })));\n const ownedDropSql: string[] = [];\n for (const object of orderedMigrationObjects({ objects: to.migrationObjects ?? [] }).reverse()) {\n if (previousKeys.has(sqlObjectKey({ identity: object.identity }))) continue;\n if (object.identity.kind === \"postgresExtension\") { skipped.push(`extension ${object.id} remains installed`); continue; }\n if (object.drop.length === 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Migration object ${object.id} needs reviewed reverse SQL`, meta: { reason: \"migration-object-reverse-required\", id: object.id } });\n ownedDropSql.push(...object.drop);\n }\n return {\n name,\n target: restored,\n sql: [...ownedDropSql, ...artifactDropSql, ...coreSql],\n destructive: steps.some((step) => step.destructive),\n ...(securityChangesOf({ steps }).length === 0 ? {} : { securityChanges: securityChangesOf({ steps }) }),\n skipped,\n };\n}\n",
|
|
45
|
-
"/** Live schema push through the shared planner, with independent DDL authorizations. */\nimport { VibeError, assertValidSchemaIR, providerToDialect, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR, SqlObjectIdentity, VibeExtension } from \"@vibeorm/schema\";\nimport { DIALECT_CAPABILITIES } from \"@vibeorm/sql\";\nimport { cleanupSelfManagedFailure, executeStatement, usesSelfManagedTransactions } from \"./execute.ts\";\nimport { introspectPostgres } from \"./introspect/postgres.ts\";\nimport { introspectSqlite } from \"./introspect/sqlite.ts\";\nimport { introspectMysql } from \"./introspect/mysql.ts\";\nimport { describeStep } from \"./types.ts\";\nimport { assertSecurityAcknowledgement, securityChangesOf } from \"./ddl/rls.ts\";\nimport type { PushResult, SqlExecutor } from \"./types.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { createDesiredState } from \"./desired-state.ts\";\nimport { assertRemovalAuthorization } from \"./object-ownership.ts\";\nimport { assertMigrationState, verifyMigrationState } from \"./inspect-objects.ts\";\nimport { planSchemaMigration } from \"./planner.ts\";\n\n/** Plan and apply a schema. Row loss, integrity loss and unmanaged removal require separate decisions. */\nexport async function push(params: {\n executor: SqlExecutor;\n schema: SchemaIR;\n acceptDataLoss?: boolean;\n acceptIntegrityLoss?: boolean;\n removeUnmanaged?: readonly SqlObjectIdentity[];\n previousState?: DesiredState;\n probe?: \"none\" | \"rollback\" | \"temporary\";\n replaceChecks?: readonly SqlObjectIdentity[];\n acceptSecurityChanges?: boolean;\n previousSchema?: SchemaIR;\n dryRun?: boolean;\n extensions?: readonly VibeExtension[];\n}): Promise<PushResult> {\n assertValidSchemaIR({ schema: params.schema });\n const dialect = providerToDialect({ provider: params.schema.datasource.provider });\n if (dialect !== \"postgres\") return pushChanges({ ...params, dialect });\n await params.executor({ text: \"BEGIN\" });\n let committed = false;\n try {\n const result = await pushChanges({ ...params, dialect });\n if (params.dryRun !== true) {\n await params.executor({ text: \"COMMIT\" });\n committed = true;\n }\n return result;\n } finally {\n if (!committed) await params.executor({ text: \"ROLLBACK\" });\n }\n}\n\nasync function pushChanges(params: Parameters<typeof push>[0] & { dialect: Dialect }): Promise<PushResult> {\n const { executor, schema, dialect } = params;\n // Native RLS verification keeps its existing lock and transaction lifetime.\n const physical = dialect === \"postgres\" ? await introspectPostgres({ executor, rlsSchema: params.previousSchema ?? schema, inTransaction: true, requireInstalledRls: params.previousSchema !== undefined }) : undefined;\n const plan = await planSchemaMigration({ executor, schema, dialect,\n ...(physical === undefined ? {} : { physical }),\n ...(params.previousState === undefined ? {} : { previous: params.previousState }),\n ...(params.extensions === undefined ? {} : { extensions: params.extensions }),\n ...(params.probe === undefined ? {} : { probe: params.probe }),\n ...(params.replaceChecks === undefined ? {} : { replaceChecks: params.replaceChecks }),\n });\n const { steps, sql } = plan;\n const securityChanges = securityChangesOf({ steps });\n if (params.dryRun === true) return { steps, applied: [], planned: sql, securityChanges, objects: plan.objects, blocked: plan.blocked, unmanagedRemovals: plan.unmanagedRemovals };\n if (plan.blocked) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Schema push is blocked by unverified object definitions\", meta: { reason: \"migration-state-unverified\", objects: plan.objects } });\n assertSecurityAcknowledgement({ securityChanges, ...(params.acceptSecurityChanges === undefined ? {} : { acceptSecurityChanges: params.acceptSecurityChanges }) });\n const destructive = steps.filter((step) => step.destructive);\n if (destructive.length > 0 && params.acceptDataLoss !== true) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `push refused: ${destructive.length} destructive step(s) would lose data; pass acceptDataLoss: true: ${destructive.map((step) => describeStep({ step })).join(\"; \")}`, meta: { destructive: destructive.map((step) => describeStep({ step })) } });\n assertRemovalAuthorization({ steps, dialect, namespace: plan.namespace,\n ...(params.previousState === undefined ? {} : { previous: params.previousState }),\n ...(params.acceptIntegrityLoss === undefined ? {} : { acceptIntegrityLoss: params.acceptIntegrityLoss }),\n ...(params.removeUnmanaged === undefined ? {} : { removeUnmanaged: params.removeUnmanaged }),\n });\n const approved = new Set((params.removeUnmanaged ?? []).map((identity) => sqlObjectKey({ identity })));\n const unapproved = plan.unmanagedRemovals.filter((identity) => !approved.has(sqlObjectKey({ identity })));\n if (unapproved.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"DDL would remove unmanaged dependent objects; approve their exact identities\", meta: { reason: \"unmanaged-removal-required\", objects: unapproved } });\n const wrap = dialect !== \"postgres\" && DIALECT_CAPABILITIES[dialect].transactionalDdl && !usesSelfManagedTransactions({ sql });\n if (wrap) await executor({ text: \"BEGIN\" });\n try {\n for (const statement of sql) await executeStatement({ executor, statement, dialect });\n if ((schema.migrationObjects?.length ?? 0) > 0) assertMigrationState({ report: await verifyMigrationState({ executor, dialect, expected: createDesiredState({ schema: { ...schema, models: [] }, dialect }) }) });\n if (wrap) await executor({ text: \"COMMIT\" });\n } catch (error) {\n if (wrap) {\n try { await executor({ text: \"ROLLBACK\" }); } catch { /* Preserve the original execution failure. */ }\n } else if (dialect === \"sqlite\") await cleanupSelfManagedFailure({ executor });\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: `push failed while applying schema changes: ${error instanceof Error ? error.message : String(error)}`, meta: { statements: sql }, cause: error });\n }\n return { steps, applied: sql, securityChanges, objects: plan.objects, desiredState: createDesiredState({ schema, dialect }) };\n}\n\n/** Introspect the live database; PostgreSQL refuses lossy native policy export. */\nexport async function pull(params: { executor: SqlExecutor; dialect?: Dialect }): Promise<SchemaIR> {\n switch (params.dialect ?? \"postgres\") {\n case \"postgres\": return introspectPostgres({ executor: params.executor });\n case \"sqlite\": return introspectSqlite({ executor: params.executor });\n case \"mysql\": return introspectMysql({ executor: params.executor });\n }\n}\n",
|
|
46
|
-
"import { prepareExclusionDiff } from \"./exclusions.ts\";\nimport { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR, SqlObjectIdentity, VibeExtension } from \"@vibeorm/schema\";\nimport { renderSqliteRebuildObjects, sqliteDialect } from \"@vibeorm/sql\";\nimport type { SqlExecutor, MigrationStep } from \"./types.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { artifactCreateSql, collectExtensionArtifacts, planMissingArtifacts, probeInstalledExtensionState, stripExtensionArtifacts } from \"./extensions.ts\";\nimport { introspectPhysicalPostgres } from \"./introspect/postgres.ts\";\nimport { introspectMysql } from \"./introspect/mysql.ts\";\nimport { introspectSqlite } from \"./introspect/sqlite.ts\";\nimport { legacyMigrationObjects, preserveMigrationObjects, removalIdentity, schemaObjectIdentities, sqlitePreservedSchema, orderedMigrationObjects, assertRetainedMigrationObjects } from \"./object-ownership.ts\";\nimport { assertMigrationState, inspectSqlObject, migrationNamespace, prepareCheckDiff, verifyMigrationState } from \"./inspect-objects.ts\";\nimport type { MigrationObjectState } from \"./inspect-objects.ts\";\nimport { inspectMigrationInventory } from \"./inventory.ts\";\nimport { normalizeSchema } from \"./normalize.ts\";\nimport { diffSchemas } from \"./differ.ts\";\nimport { renderSteps } from \"./ddl/render.ts\";\nimport { assertSqliteRebuildTableOptions, sqliteInvalidatedTables } from \"./ddl/sqlite.ts\";\n\n/** Shared live plan; reports observations separately from trusted desired declarations. */\nexport type SchemaMigrationPlan = {\n readonly physical: SchemaIR;\n readonly from: SchemaIR;\n readonly namespace: string;\n readonly steps: readonly MigrationStep[];\n readonly sql: readonly string[];\n readonly objects: readonly MigrationObjectState[];\n readonly unmanagedRemovals: readonly SqlObjectIdentity[];\n readonly blocked: boolean;\n};\n\n/** Inspect and plan without executing repair DDL. The caller owns any opted-in probe transaction. */\nexport async function planSchemaMigration(params: {\n executor: SqlExecutor; schema: SchemaIR; dialect: Dialect; namespace?: string;\n /** Already-introspected physical IR, including verified native RLS when applicable. */\n physical?: SchemaIR;\n previous?: DesiredState; extensions?: readonly VibeExtension[];\n probe?: \"none\" | \"rollback\" | \"temporary\"; replaceChecks?: readonly SqlObjectIdentity[];\n}): Promise<SchemaMigrationPlan> {\n const { executor, schema, dialect } = params;\n const namespace = params.namespace ?? await migrationNamespace({ executor, dialect });\n const collected = collectExtensionArtifacts({ schema, dialect, extensions: params.extensions ?? [] });\n const artifacts = [...collected.setup, ...collected.objects];\n const legacyObjects = legacyMigrationObjects({ artifacts, dialect, namespace });\n const objects = orderedMigrationObjects({ objects: schema.migrationObjects ?? [] });\n assertRetainedMigrationObjects({ from: params.previous?.schema.migrationObjects ?? [], to: objects });\n for (const object of objects) if (object.dialect !== dialect) throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: `Migration object ${object.id} requires ${object.dialect}`, meta: { feature: \"migrationObject\", dialect } });\n const physical = params.physical ?? (dialect === \"postgres\" ? await introspectPhysicalPostgres({ executor }) : dialect === \"mysql\" ? await introspectMysql({ executor }) : await introspectSqlite({ executor }));\n if (params.previous !== undefined) assertMigrationState({ report: await verifyMigrationState({ executor, expected: params.previous, dialect, ...(params.probe === undefined ? {} : { probe: params.probe }) }) });\n const inventory = await inspectMigrationInventory({ executor, dialect, namespace });\n for (const object of inventory) {\n const identity = object.identity;\n if (identity.kind !== \"table\" || physical.models.some((model) => (model.dbName ?? model.name) === identity.name.name) || normalizeSchema({ schema: physical, dialect }).joinTables.has(identity.name.name)) continue;\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Catalog table is not visible to schema introspection; automatic planning cannot prove the complete physical state\", meta: { reason: \"inventory-unavailable\", identity: object.identity } });\n }\n const states: MigrationObjectState[] = [];\n if (dialect === \"mysql\" && inventory.some((object) => object.identity.kind === \"view\" || object.identity.kind === \"function\" || object.identity.kind === \"trigger\") && params.previous === undefined && physical.models.length > 0) states.push(...inventory.filter((object) => object.identity.kind === \"view\" || object.identity.kind === \"function\" || object.identity.kind === \"trigger\").map((object): MigrationObjectState => ({ identity: object.identity, ownership: \"unknown\", state: \"unavailable\", reason: \"dependency-inspection-unavailable\", differences: [] })));\n const creates: string[] = [];\n for (const object of objects) {\n for (const dependency of object.dependsOn) {\n if ([...objects.map((entry) => entry.identity), ...schemaObjectIdentities({ schema, dialect, namespace })].some((identity) => sqlObjectKey({ identity }) === sqlObjectKey({ identity: dependency }))) continue;\n const state = await inspectSqlObject({ executor, dialect, identity: dependency });\n if (state.state !== \"present\") states.push({ identity: dependency, ownership: \"migration\", state: \"unavailable\", reason: \"dependency-unavailable\", differences: [] });\n }\n const expected = object.expected ?? params.previous?.definitions.find((entry) => sqlObjectKey({ identity: entry.identity }) === sqlObjectKey({ identity: object.identity }));\n const live = await inspectSqlObject({ executor, dialect, identity: object.identity });\n if (expected === undefined) states.push({ identity: object.identity, ownership: \"migration\", state: \"unavailable\", differences: [], reason: \"independent-definition-required\" });\n else if (live.state === \"missing\") {\n states.push({ identity: object.identity, ownership: \"migration\", state: \"missing\", differences: [] });\n creates.push(...object.create);\n } else {\n const report = await verifyMigrationState({ executor, dialect, expected: { schema: { ...schema, models: [], migrationObjects: [object] }, definitions: [expected] } });\n states.push(...report.objects);\n }\n }\n for (const object of legacyObjects) {\n if (objects.some((entry) => sqlObjectKey({ identity: entry.identity }) === sqlObjectKey({ identity: object.identity }))) throw new VibeError({ code: \"VIBE_SCHEMA_INVALID\", message: \"Duplicate combined and migration-only ownership\", meta: { identity: object.identity } });\n const expected = object.expected ?? params.previous?.definitions.find((entry) => sqlObjectKey({ identity: entry.identity }) === sqlObjectKey({ identity: object.identity }));\n if (expected === undefined) states.push({ identity: object.identity, ownership: \"migration\", state: \"unavailable\", reason: \"legacy-definition-required\", differences: [] });\n else {\n const live = await inspectSqlObject({ executor, dialect, identity: object.identity });\n if (live.state === \"missing\") states.push({ identity: object.identity, ownership: \"migration\", state: \"missing\", differences: [] });\n else states.push(...(await verifyMigrationState({ executor, dialect, expected: { schema: { ...schema, models: [], migrationObjects: [object] }, definitions: [expected] } })).objects);\n }\n }\n // Removing a migration-only registration does not surrender its former ownership.\n const protectedObjects = [...legacyObjects, ...objects, ...(params.previous?.schema.migrationObjects ?? [])];\n const stripped = preserveMigrationObjects({ from: stripExtensionArtifacts({ schema: physical, artifacts }), to: schema, objects: protectedObjects, namespace });\n const checked = await prepareCheckDiff({ executor, from: stripped, to: schema, dialect, ...(params.probe === undefined ? {} : { probe: params.probe }), ...(params.previous === undefined ? {} : { previous: params.previous }), ...(params.replaceChecks === undefined ? {} : { replaceChecks: params.replaceChecks }) });\n const from = await prepareExclusionDiff({ ...params, from: checked, to: schema });\n const steps = diffSchemas({ from, to: schema, dialect });\n const known = new Set(schemaObjectIdentities({ schema: params.previous?.schema ?? schema, dialect, namespace }).map((identity) => sqlObjectKey({ identity })));\n // Constraint-backed UNIQUEs and ordinary unique indexes are the same authored\n // guarantee. Recover the catalog owner's name only when the independent IR\n // already declares that exact key shape.\n const declaredIndexes = normalizeSchema({ schema: params.previous?.schema ?? schema, dialect });\n const physicalIndexes = normalizeSchema({ schema: physical, dialect });\n for (const [table, model] of physicalIndexes.tables) for (const [key, index] of model.indexes) {\n if (index.constraintName !== undefined && declaredIndexes.tables.get(table)?.indexes.has(key)) known.add(sqlObjectKey({ identity: { kind: \"constraint\", constraintType: \"unique\", table: { namespace, name: table }, name: index.constraintName } }));\n }\n const migrationOwned = new Set(protectedObjects.map((object) => sqlObjectKey({ identity: object.identity })));\n const removals = steps.flatMap((step) => { const identity = removalIdentity({ step, namespace }); return identity === undefined ? [] : [identity]; });\n const droppedTables = new Set(steps.flatMap((step) => step.kind === \"dropTable\" || step.kind === \"dropJoinTable\" ? [step.table] : []));\n const unmanagedRemovals: SqlObjectIdentity[] = [];\n const invalid = dialect === \"sqlite\" ? sqliteInvalidatedTables({ steps, from: physical }) : { rebuilt: new Set<string>(), dropped: new Set<string>() };\n if (dialect === \"sqlite\") await assertSqliteRebuildTableOptions({ executor, tables: invalid.rebuilt });\n for (const object of inventory) {\n const key = sqlObjectKey({ identity: object.identity });\n const normalizedOwner = object.backingConstraint === undefined ? undefined : inventory.find((entry) => entry.identity.kind === \"constraint\" && entry.identity.name === object.backingConstraint && \"table\" in object.identity && entry.identity.table.name === object.identity.table.name);\n const ownership = migrationOwned.has(key) ? \"migration\" : known.has(key) || (normalizedOwner !== undefined && known.has(sqlObjectKey({ identity: normalizedOwner.identity }))) ? \"schema\" : \"unknown\";\n if (object.inspectionUnavailable !== undefined) states.push({ identity: object.identity, ownership, state: \"unavailable\", reason: object.inspectionUnavailable, differences: [] });\n if (object.inspectionUnavailable !== undefined && invalid.rebuilt.has(\"table\" in object.identity ? object.identity.table.name : object.identity.name.name)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"SQLite rebuild cannot discard an unrepresented constraint; declare its independent definition or use a reviewed migration\", meta: { reason: \"sqlite-preservation-unavailable\", identity: object.identity } });\n if (ownership === \"unknown\") states.push({ identity: object.identity, ownership, state: \"unavailable\", reason: \"unmanaged\", differences: [] });\n let collateral = \"table\" in object.identity && object.identity.table.namespace === namespace && droppedTables.has(object.identity.table.name);\n const declared = protectedObjects.find((entry) => sqlObjectKey({ identity: entry.identity }) === key);\n if (declared?.dependsOn.some((dependency) => removals.some((identity) => sqlObjectKey({ identity }) === sqlObjectKey({ identity: dependency })) || (\"table\" in dependency && dependency.table.namespace === namespace && droppedTables.has(dependency.table.name)))) collateral = true;\n if (ownership === \"unknown\" && object.identity.kind === \"function\" && steps.some((step) => step.kind === \"dropTable\" || step.kind === \"dropColumn\" || step.kind === \"dropJoinTable\")) states.push({ identity: object.identity, ownership, state: \"unavailable\", reason: \"dependency-inspection-unavailable\", differences: [] });\n if (dialect === \"postgres\" && steps.some((step) => step.kind === \"dropTable\" || step.kind === \"dropColumn\" || step.kind === \"dropJoinTable\")) {\n const inspected = await inspectSqlObject({ executor, dialect, identity: object.identity });\n if (inspected.state !== \"present\") {\n states.push({ identity: object.identity, ownership, state: \"unavailable\", reason: \"dependency-inspection-unavailable\", differences: [] });\n } else {\n const addresses = inspected.definition.facts.dependencyAddresses;\n if (Array.isArray(addresses)) for (const address of addresses) {\n const value: unknown = JSON.parse(String(address));\n if (!Array.isArray(value) || !Array.isArray(value[2])) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Malformed catalog dependency address\" });\n const names = value[2] as unknown[];\n if (names[0] !== namespace || typeof names[1] !== \"string\") continue;\n if (droppedTables.has(names[1]) || steps.some((step) => step.kind === \"dropColumn\" && step.table === names[1] && step.column === names[2])) collateral = true;\n }\n }\n }\n if (dialect === \"sqlite\" && ownership === \"unknown\" && object.identity.kind === \"generatedColumn\" && invalid.rebuilt.has(object.identity.table.name)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"SQLite generated-column preservation requires an independent ownership declaration\", meta: { reason: \"sqlite-preservation-unavailable\", identity: object.identity } });\n const removed = collateral || removals.some((identity) => sqlObjectKey({ identity }) === key);\n if (removed && ownership === \"migration\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Automatic DDL would remove a migration-owned object\", meta: { reason: \"migration-owned-removal\", identity: object.identity } });\n if (removed && ownership === \"unknown\" && object.backingConstraint === undefined) unmanagedRemovals.push(object.identity);\n }\n const invalidated = new Set([...invalid.rebuilt, ...invalid.dropped]);\n const installed = await probeInstalledExtensionState({ executor, dialect, artifacts });\n const triggers = installed.triggers === undefined ? undefined : new Set(installed.triggers);\n for (const artifact of artifacts) if (artifact.owns.kind === \"trigger\" && invalidated.has(artifact.owns.table)) triggers?.delete(artifact.owns.name);\n const missing = planMissingArtifacts({ introspected: physical, artifacts, installed: { ...installed, ...(triggers === undefined ? {} : { triggers }) } });\n const restore = new Map<string, string[]>();\n const preservedColumns = new Map<string, Map<string, { sql: string; generated: boolean }>>();\n const preservedDefaults = new Map<string, Map<string, string | null>>();\n if (invalid.rebuilt.size > 0) {\n const query = renderSqliteRebuildObjects({ dialect: sqliteDialect });\n const rows = await executor({ text: query.text, values: [] });\n const targetIndexes = normalizeSchema({ schema, dialect });\n for (const row of rows) {\n const table = String(row.tbl_name);\n if (!invalid.rebuilt.has(table) || typeof row.sql !== \"string\") continue;\n if (row.type === \"index\" && (steps.some((step) => step.kind === \"dropIndex\" && step.table === table && step.name === row.name) || [...(targetIndexes.tables.get(table)?.indexes.values() ?? [])].some((index) => index.name === row.name))) continue;\n const statements = restore.get(table) ?? [];\n statements.push(row.sql);\n restore.set(table, statements);\n }\n for (const object of protectedObjects) {\n const identity = object.identity;\n if ((identity.kind !== \"column\" && identity.kind !== \"columnDefault\" && identity.kind !== \"generatedColumn\") || !invalid.rebuilt.has(identity.table.name)) continue;\n const live = await inspectSqlObject({ executor, dialect, identity });\n if (live.state !== \"present\" || (identity.kind !== \"columnDefault\" && typeof live.definition.facts.columnDefinition !== \"string\")) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot read the verified SQLite column definition for preservation\", meta: { reason: \"sqlite-preservation-unavailable\", identity } });\n if (identity.kind === \"columnDefault\") {\n const definition = live.definition.facts.definition;\n if (definition !== null && typeof definition !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot preserve SQLite default\", meta: { identity } });\n const defaults = preservedDefaults.get(identity.table.name) ?? new Map<string, string | null>();\n defaults.set(identity.column, definition);\n preservedDefaults.set(identity.table.name, defaults);\n } else {\n const columns = preservedColumns.get(identity.table.name) ?? new Map<string, { sql: string; generated: boolean }>();\n columns.set(identity.column, { sql: String(live.definition.facts.columnDefinition), generated: Number(live.definition.facts.generated) > 1 });\n preservedColumns.set(identity.table.name, columns);\n }\n }\n }\n const preserved = dialect === \"sqlite\" ? sqlitePreservedSchema({ from: physical, to: schema, objects: protectedObjects }) : schema;\n const target: SchemaIR = { ...preserved, models: preserved.models.map((model) => ({ ...model, fields: model.fields.map((field) => {\n const defaults = preservedDefaults.get(model.dbName ?? model.name);\n const column = field.dbName ?? field.name;\n if (!defaults?.has(column)) return field;\n const { default: ignored, ...rest } = field;\n const expression = defaults.get(column);\n return { ...rest, ...(typeof expression === \"string\" ? { default: { kind: \"dbgenerated\" as const, sql: expression } } : {}) };\n }) })) };\n const core = renderSteps({ steps, dialect, from: dialect === \"sqlite\" ? physical : from, to: dialect === \"mysql\" ? { ...target, migrationObjects: protectedObjects } : target, sqliteRestore: restore, sqliteColumns: preservedColumns });\n const sql = [...artifactCreateSql({ artifacts: missing.filter((artifact) => artifact.owns.kind === \"postgresExtension\") }), ...core,\n ...artifactCreateSql({ artifacts: missing.filter((artifact) => artifact.owns.kind !== \"postgresExtension\" && !(artifact.owns.kind === \"trigger\" && invalid.rebuilt.has(artifact.owns.table))) }), ...creates];\n if (sql.length === 0) {\n const definitions = [...(params.previous?.definitions ?? [])];\n for (const object of objects) if (object.expected !== undefined && !definitions.some((definition) => sqlObjectKey({ identity: definition.identity }) === sqlObjectKey({ identity: object.identity }))) definitions.push(object.expected);\n const report = await verifyMigrationState({ executor, dialect, expected: { schema, definitions }, ...(params.probe === undefined ? {} : { probe: params.probe }) });\n states.push(...report.objects);\n }\n const blocked = states.some((state) => state.reason === \"dependency-inspection-unavailable\" || (state.ownership !== \"unknown\" && state.reason !== \"legacy-definition-required\" && (state.state === \"unavailable\" || state.state === \"changed\" || state.state === \"missing\" && sql.length === 0)));\n return { physical, from, namespace, steps, objects: states, unmanagedRemovals, blocked, sql: blocked ? [] : sql };\n}\n\n",
|
|
62
|
+
"/** Live schema push through the shared planner, with independent DDL authorizations. */\nimport { VibeError, assertValidSchemaIR, providerToDialect, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR, SqlObjectIdentity, VibeExtension } from \"@vibeorm/schema\";\nimport { DIALECT_CAPABILITIES } from \"@vibeorm/sql\";\nimport { cleanupSelfManagedFailure, executeStatement, usesSelfManagedTransactions } from \"./execute.ts\";\nimport { introspectPostgres } from \"./introspect/postgres.ts\";\nimport { introspectSqlite } from \"./introspect/sqlite.ts\";\nimport { introspectMysql } from \"./introspect/mysql.ts\";\nimport { describeStep } from \"./types.ts\";\nimport { assertSecurityAcknowledgement, securityChangesOf } from \"./ddl/rls.ts\";\nimport type { PushResult, SqlExecutor } from \"./types.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { createDesiredState } from \"./desired-state.ts\";\nimport { assertRemovalAuthorization } from \"./object-ownership.ts\";\nimport { assertMigrationState, verifyMigrationState } from \"./inspect-objects.ts\";\nimport { planSchemaMigration } from \"./planner.ts\";\n\n/** Plan and apply a schema. Row loss, integrity loss and unmanaged removal require separate decisions. */\nexport async function push(params: {\n executor: SqlExecutor;\n schema: SchemaIR;\n acceptDataLoss?: boolean;\n acceptIntegrityLoss?: boolean;\n removeUnmanaged?: readonly SqlObjectIdentity[];\n previousState?: DesiredState;\n probe?: \"none\" | \"rollback\" | \"temporary\";\n replaceChecks?: readonly SqlObjectIdentity[];\n acceptSecurityChanges?: boolean;\n previousSchema?: SchemaIR;\n dryRun?: boolean;\n extensions?: readonly VibeExtension[];\n}): Promise<PushResult> {\n assertValidSchemaIR({ schema: params.schema });\n const dialect = providerToDialect({ provider: params.schema.datasource.provider });\n if (dialect !== \"postgres\") return pushChanges({ ...params, dialect });\n await params.executor({ text: \"BEGIN\" });\n let committed = false;\n try {\n const result = await pushChanges({ ...params, dialect });\n if (params.dryRun !== true) {\n await params.executor({ text: \"COMMIT\" });\n committed = true;\n }\n return result;\n } finally {\n if (!committed) await params.executor({ text: \"ROLLBACK\" });\n }\n}\n\nasync function pushChanges(params: Parameters<typeof push>[0] & { dialect: Dialect }): Promise<PushResult> {\n const { executor, schema, dialect } = params;\n // Native RLS verification keeps its existing lock and transaction lifetime.\n const physical = dialect === \"postgres\" ? await introspectPostgres({ executor, rlsSchema: params.previousSchema ?? schema, inTransaction: true, requireInstalledRls: params.previousSchema !== undefined }) : undefined;\n const plan = await planSchemaMigration({ executor, schema, dialect,\n ...(physical === undefined ? {} : { physical }),\n ...(params.previousState === undefined ? {} : { previous: params.previousState }),\n ...(params.extensions === undefined ? {} : { extensions: params.extensions }),\n ...(params.probe === undefined ? {} : { probe: params.probe }),\n ...(params.replaceChecks === undefined ? {} : { replaceChecks: params.replaceChecks }),\n });\n const { steps, sql } = plan;\n const securityChanges = securityChangesOf({ steps });\n if (params.dryRun === true) return { steps, applied: [], planned: sql, securityChanges, objects: plan.objects, blocked: plan.blocked, unmanagedRemovals: plan.unmanagedRemovals };\n if (plan.blocked) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Schema push is blocked by unverified object definitions\", meta: { reason: \"migration-state-unverified\", objects: plan.objects } });\n assertSecurityAcknowledgement({ securityChanges, ...(params.acceptSecurityChanges === undefined ? {} : { acceptSecurityChanges: params.acceptSecurityChanges }) });\n const destructive = steps.filter((step) => step.destructive);\n if (destructive.length > 0 && params.acceptDataLoss !== true) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `push refused: ${destructive.length} destructive step(s) would lose data; pass acceptDataLoss: true: ${destructive.map((step) => describeStep({ step })).join(\"; \")}`, meta: { destructive: destructive.map((step) => describeStep({ step })) } });\n assertRemovalAuthorization({ steps, dialect, namespace: plan.namespace,\n ...(params.previousState === undefined ? {} : { previous: params.previousState }),\n ...(params.acceptIntegrityLoss === undefined ? {} : { acceptIntegrityLoss: params.acceptIntegrityLoss }),\n ...(params.removeUnmanaged === undefined ? {} : { removeUnmanaged: params.removeUnmanaged }),\n });\n const approved = new Set((params.removeUnmanaged ?? []).map((identity) => sqlObjectKey({ identity })));\n const unapproved = plan.unmanagedRemovals.filter((identity) => !approved.has(sqlObjectKey({ identity })));\n if (unapproved.length > 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"DDL would remove unmanaged dependent objects; approve their exact identities\", meta: { reason: \"unmanaged-removal-required\", objects: unapproved } });\n const wrap = dialect !== \"postgres\" && DIALECT_CAPABILITIES[dialect].transactionalDdl && !usesSelfManagedTransactions({ sql });\n if (wrap) await executor({ text: \"BEGIN\" });\n try {\n for (const statement of sql) await executeStatement({ executor, statement, dialect });\n if ((schema.migrationObjects?.length ?? 0) > 0) assertMigrationState({ report: await verifyMigrationState({ executor, dialect, expected: createDesiredState({ schema: { ...schema, models: [] }, dialect }) }) });\n if (wrap) await executor({ text: \"COMMIT\" });\n } catch (error) {\n if (wrap) {\n try { await executor({ text: \"ROLLBACK\" }); } catch { /* Preserve the original execution failure. */ }\n } else if (dialect === \"sqlite\") await cleanupSelfManagedFailure({ executor });\n throw new VibeError({ code: \"VIBE_MIGRATION\", message: `push failed while applying schema changes: ${error instanceof Error ? error.message : String(error)}`, meta: { statements: sql }, cause: error });\n }\n return { steps, applied: sql, securityChanges, objects: plan.objects, desiredState: createDesiredState({ schema: plan.to, dialect }) };\n}\n\n/** Introspect the live database; PostgreSQL refuses lossy native policy export. */\nexport async function pull(params: { executor: SqlExecutor; dialect?: Dialect }): Promise<SchemaIR> {\n switch (params.dialect ?? \"postgres\") {\n case \"postgres\": return introspectPostgres({ executor: params.executor });\n case \"sqlite\": return introspectSqlite({ executor: params.executor });\n case \"mysql\": return introspectMysql({ executor: params.executor });\n }\n}\n",
|
|
47
63
|
"import { VibeError } from \"@vibeorm/schema\";\nimport { canonicalMigrationJson } from \"./desired-state.ts\";\nimport { moduleMigrationFiles } from \"./module-bundle.ts\";\nimport type { ModuleMigrationBundle } from \"./module-bundle.ts\";\n\n/** Emit separate data-only migration and startup-readiness entries for a package build. */\nexport function emitModuleMigrationExport(params: { bundle: ModuleMigrationBundle; contract: string }): readonly { name: string; content: string }[] {\n moduleMigrationFiles({ bundle: params.bundle, prefix: \"export\" });\n const origin = params.bundle.migrations.at(-1)!.moduleOrigin!;\n if (!origin.contracts.includes(params.contract)) throw new VibeError({ code: \"VIBE_CONFIG\", message: \"The package runtime contract is not supported by its migration head\", meta: { reason: \"module-contract-mismatch\", moduleId: origin.moduleId } });\n const expectation = { moduleId: origin.moduleId, revision: origin.revision, artifactChecksum: origin.artifactChecksum, contract: params.contract };\n return [\n { name: \"migrations.js\", content: `// Generated immutable migration data; no driver, filesystem or runner import.\\nexport const moduleMigrations = JSON.parse(${JSON.stringify(canonicalMigrationJson({ value: params.bundle }))});\\n` },\n { name: \"migrations.d.ts\", content: 'import type { ModuleMigrationBundle } from \"@vibeorm/migrate\";\\nexport declare const moduleMigrations: ModuleMigrationBundle;\\n' },\n { name: \"readiness.js\", content: `// Startup expectations are data, not a claim of completed deployment.\\nexport const moduleReadiness = Object.freeze(${JSON.stringify(expectation)});\\n` },\n { name: \"readiness.d.ts\", content: 'export declare const moduleReadiness: { readonly moduleId: string; readonly revision: string; readonly artifactChecksum: string; readonly contract: string };\\n' },\n ];\n}\n",
|
|
48
64
|
"import { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect, SqlObjectIdentity } from \"@vibeorm/schema\";\nimport { canonicalMigrationJson } from \"./desired-state.ts\";\nimport { assertModuleOrigin, createModuleOrigin, restoreModuleMigration } from \"./module-origin.ts\";\nimport type { ModuleMigrationSource } from \"./module-origin.ts\";\nimport { validateMigrationReplay } from \"./runner.ts\";\nimport type { MigrationFile } from \"./types.ts\";\n\n/** Data-only package export, with ordered immutable source snapshots. */\nexport type ModuleMigrationBundle = {\n readonly moduleId: string;\n readonly dialect: Dialect;\n readonly migrations: readonly MigrationFile[];\n};\n\n/** Author an append-only upgrade chain; this never opens a database or executes SQL. */\nexport function defineModuleMigrations(params: {\n moduleId: string;\n dialect: Dialect;\n steps: readonly {\n readonly revision: string;\n readonly previousRevision: string | null;\n readonly contracts: readonly string[];\n readonly owned: readonly SqlObjectIdentity[];\n readonly migration: ModuleMigrationSource;\n }[];\n}): ModuleMigrationBundle {\n if (!Array.isArray(params.steps) || params.steps.length === 0) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"A module upgrade bundle must contain its initial revision\", meta: { reason: \"module-chain-invalid\", moduleId: params.moduleId } });\n const migrations: MigrationFile[] = [];\n const revisions = new Set<string>();\n let previous: string | null = null;\n for (const step of params.steps) {\n if (step.previousRevision !== previous || revisions.has(step.revision)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: `Module ${params.moduleId} has a duplicate revision or broken predecessor chain`, meta: { reason: \"module-chain-invalid\", moduleId: params.moduleId, revision: step.revision } });\n const origin = createModuleOrigin({ moduleId: params.moduleId, dialect: params.dialect, revision: step.revision, previousRevision: step.previousRevision, contracts: step.contracts, owned: step.owned, source: step.migration });\n const predecessor = migrations.at(-1)?.moduleOrigin;\n if (predecessor !== undefined && canonicalMigrationJson({ value: predecessor.source.desiredState!.to }) !== canonicalMigrationJson({ value: origin.source.desiredState!.from })) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Module source state differs from its predecessor\", meta: { reason: \"module-predecessor-state\", moduleId: params.moduleId } });\n validateMigrationReplay({ migrations: [origin.source], dialect: params.dialect, acceptSecurityChanges: true, acceptIntegrityLoss: true, removeUnmanaged: origin.source.desiredState?.unmanagedRemovals ?? [] });\n migrations.push(Object.freeze({ ...origin.source, moduleOrigin: origin }));\n revisions.add(step.revision);\n previous = step.revision;\n }\n return Object.freeze({ moduleId: params.moduleId, dialect: params.dialect, migrations: Object.freeze(migrations) });\n}\n\n/** Materialize ordered local units without reinterpreting or concatenating package SQL. */\nexport function moduleMigrationFiles(params: { bundle: ModuleMigrationBundle; prefix: string }): readonly MigrationFile[] {\n if (params.bundle === null || typeof params.bundle !== \"object\" || !Array.isArray(params.bundle.migrations)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Module bundle must contain an immutable migration chain\", meta: { reason: \"module-chain-invalid\" } });\n if (!/^[A-Za-z0-9_-]+$/.test(params.prefix)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Module migration prefix must be a safe local directory name\", meta: { reason: \"module-prefix-invalid\" } });\n // Revalidate data-only exports too: a package consumer need not call the author factory at runtime.\n const bundle = defineModuleMigrations({ moduleId: params.bundle.moduleId, dialect: params.bundle.dialect, steps: params.bundle.migrations.map((migration) => {\n const origin = migration?.moduleOrigin;\n if (origin === undefined || origin.moduleId !== params.bundle.moduleId || origin.dialect !== params.bundle.dialect) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Module bundle lacks matching immutable origin metadata\", meta: { reason: \"module-origin-invalid\" } });\n assertModuleOrigin({ value: origin });\n restoreModuleMigration({ migration, origin });\n return { revision: origin.revision, previousRevision: origin.previousRevision, contracts: origin.contracts, owned: origin.owned, migration: origin.source };\n }) });\n return Object.freeze(bundle.migrations.map((migration, index) => Object.freeze({ ...migration, name: `${params.prefix}_${String(index + 1).padStart(4, \"0\")}` })));\n}\n",
|
|
49
|
-
"import { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { SchemaIR } from \"@vibeorm/schema\";\nimport { canonicalMigrationJson, createDesiredState } from \"./desired-state.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { moduleMigrationFiles } from \"./module-bundle.ts\";\nimport type { ModuleMigrationBundle } from \"./module-bundle.ts\";\nimport { assertModuleOwnership, moduleNamespace, moduleOwnedObjects } from \"./module-ownership.ts\";\nimport { assertModuleUpgradeHistory } from \"./module-history.ts\";\nimport type { MigrationFile } from \"./types.ts\";\n\nfunction refusal(params: { reason: string; moduleId?: string }): VibeError {\n return new VibeError({ code: \"VIBE_MIGRATION\", message: \"Module registration or immutable upgrade history conflicts with the application's declarations; review the registration and deployment sequence\", meta: params });\n}\n\n/** Replace only a module's declared objects; unrelated application declarations remain byte-for-byte data. */\nfunction compose(params: { current: DesiredState; from: DesiredState; to: DesiredState }): DesiredState {\n const { current, from, to } = params;\n const oldTables = new Set(from.schema.models.map((model) => model.dbName ?? model.name));\n const oldEnums = new Set(from.schema.enums.map((entry) => entry.dbName ?? entry.name));\n const oldObjects = new Set((from.schema.migrationObjects ?? []).map((object) => sqlObjectKey({ identity: object.identity })));\n const oldDefinitions = new Set(from.definitions.map((definition) => sqlObjectKey({ identity: definition.identity })));\n const retainedModels = current.schema.models.filter((model) => !oldTables.has(model.dbName ?? model.name));\n const retainedEnums = current.schema.enums.filter((entry) => !oldEnums.has(entry.dbName ?? entry.name));\n if (to.schema.models.some((model) => retainedModels.some((other) => other.name === model.name || (other.dbName ?? other.name) === (model.dbName ?? model.name))) || to.schema.enums.some((entry) => retainedEnums.some((other) => other.name === entry.name || (other.dbName ?? other.name) === (entry.dbName ?? entry.name)))) throw refusal({ reason: \"module-object-collision\" });\n return { ...current, schema: { ...current.schema,\n models: [...retainedModels, ...to.schema.models], enums: [...retainedEnums, ...to.schema.enums],\n migrationObjects: [...(current.schema.migrationObjects ?? []).filter((object) => !oldObjects.has(sqlObjectKey({ identity: object.identity }))), ...(to.schema.migrationObjects ?? [])],\n }, definitions: [...current.definitions.filter((definition) => !oldDefinitions.has(sqlObjectKey({ identity: definition.identity }))), ...to.definitions] };\n}\n\n/** Compose the application target with enabled package heads without copying models into its generated client. */\nexport function composeApplicationModules(params: { application: DesiredState; bundles: readonly ModuleMigrationBundle[] }): DesiredState {\n if (params.bundles.length === 0) return params.application;\n let current = params.application;\n for (const bundle of [...params.bundles].sort((a, b) => a.moduleId.localeCompare(b.moduleId))) {\n const files = moduleMigrationFiles({ bundle, prefix: \"compose\" });\n const state = files.at(-1)!.moduleOrigin!.source.desiredState!;\n if (state.dialect !== params.bundles[0]!.dialect) throw refusal({ reason: \"module-dialect-mismatch\", moduleId: bundle.moduleId });\n const empty = createDesiredState({ schema: { ...state.to.schema, models: [], enums: [], migrationObjects: [] }, dialect: state.dialect });\n current = compose({ current, from: empty, to: state.to });\n }\n return current;\n}\n\n/** Import only new immutable upgrades, in deterministic module/predecessor order. Never infer uninstall SQL. */\nexport function pendingModuleMigrations(params: {\n bundles: readonly ModuleMigrationBundle[];\n existing: readonly MigrationFile[];\n prefix: string;\n application?: SchemaIR;\n}): readonly MigrationFile[] {\n const registered = new Map<string, readonly MigrationFile[]>();\n for (const bundle of params.bundles) {\n if (registered.has(bundle.moduleId)) throw refusal({ reason: \"module-duplicate-registration\", moduleId: bundle.moduleId });\n registered.set(bundle.moduleId, moduleMigrationFiles({ bundle, prefix: params.prefix }));\n }\n const previous = new Map<string, Set<string>>();\n for (const file of params.existing) {\n const origin = file.moduleOrigin;\n if (origin === undefined) continue;\n const sources = registered.get(origin.moduleId);\n if (sources === undefined) throw refusal({ reason: \"module-registration-missing\", moduleId: origin.moduleId });\n const same = sources.find((candidate) => candidate.moduleOrigin!.revision === origin.revision);\n if (same === undefined || canonicalMigrationJson({ value: same.moduleOrigin }) !== canonicalMigrationJson({ value: origin })) throw refusal({ reason: \"module-historical-artifact-changed\", moduleId: origin.moduleId });\n const revisions = previous.get(origin.moduleId) ?? new Set<string>();\n if (revisions.has(origin.revision)) throw refusal({ reason: \"module-chain-invalid\", moduleId: origin.moduleId });\n revisions.add(origin.revision);\n previous.set(origin.moduleId, revisions);\n }\n const all = [...registered].sort(([a], [b]) => a.localeCompare(b)).flatMap(([, files]) => files);\n const initial = all[0]?.moduleOrigin;\n if (initial === undefined) return [];\n if (params.existing.length > 0 && params.existing.at(-1)!.desiredState === undefined) throw refusal({ reason: \"module-application-
|
|
65
|
+
"import { VibeError, sqlObjectKey } from \"@vibeorm/schema\";\nimport type { SchemaIR } from \"@vibeorm/schema\";\nimport { canonicalMigrationJson, createDesiredState } from \"./desired-state.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { moduleMigrationFiles } from \"./module-bundle.ts\";\nimport type { ModuleMigrationBundle } from \"./module-bundle.ts\";\nimport { assertModuleOwnership, moduleNamespace, moduleOwnedObjects } from \"./module-ownership.ts\";\nimport { assertModuleUpgradeHistory } from \"./module-history.ts\";\nimport type { MigrationFile } from \"./types.ts\";\n\nfunction refusal(params: { reason: string; moduleId?: string }): VibeError {\n return new VibeError({ code: \"VIBE_MIGRATION\", message: \"Module registration or immutable upgrade history conflicts with the application's declarations; review the registration and deployment sequence\", meta: params });\n}\n\n/** Replace only a module's declared objects; unrelated application declarations remain byte-for-byte data. */\nfunction compose(params: { current: DesiredState; from: DesiredState; to: DesiredState }): DesiredState {\n const { current, from, to } = params;\n const oldTables = new Set(from.schema.models.map((model) => model.dbName ?? model.name));\n const oldEnums = new Set(from.schema.enums.map((entry) => entry.dbName ?? entry.name));\n const oldObjects = new Set((from.schema.migrationObjects ?? []).map((object) => sqlObjectKey({ identity: object.identity })));\n const oldDefinitions = new Set(from.definitions.map((definition) => sqlObjectKey({ identity: definition.identity })));\n const retainedModels = current.schema.models.filter((model) => !oldTables.has(model.dbName ?? model.name));\n const retainedEnums = current.schema.enums.filter((entry) => !oldEnums.has(entry.dbName ?? entry.name));\n if (to.schema.models.some((model) => retainedModels.some((other) => other.name === model.name || (other.dbName ?? other.name) === (model.dbName ?? model.name))) || to.schema.enums.some((entry) => retainedEnums.some((other) => other.name === entry.name || (other.dbName ?? other.name) === (entry.dbName ?? entry.name)))) throw refusal({ reason: \"module-object-collision\" });\n return { ...current, schema: { ...current.schema,\n models: [...retainedModels, ...to.schema.models], enums: [...retainedEnums, ...to.schema.enums],\n migrationObjects: [...(current.schema.migrationObjects ?? []).filter((object) => !oldObjects.has(sqlObjectKey({ identity: object.identity }))), ...(to.schema.migrationObjects ?? [])],\n }, definitions: [...current.definitions.filter((definition) => !oldDefinitions.has(sqlObjectKey({ identity: definition.identity }))), ...to.definitions] };\n}\n\n/** Compose the application target with enabled package heads without copying models into its generated client. */\nexport function composeApplicationModules(params: { application: DesiredState; bundles: readonly ModuleMigrationBundle[] }): DesiredState {\n if (params.bundles.length === 0) return params.application;\n let current = params.application;\n for (const bundle of [...params.bundles].sort((a, b) => a.moduleId.localeCompare(b.moduleId))) {\n const files = moduleMigrationFiles({ bundle, prefix: \"compose\" });\n const state = files.at(-1)!.moduleOrigin!.source.desiredState!;\n if (state.dialect !== params.bundles[0]!.dialect) throw refusal({ reason: \"module-dialect-mismatch\", moduleId: bundle.moduleId });\n const empty = createDesiredState({ schema: { ...state.to.schema, models: [], enums: [], migrationObjects: [] }, dialect: state.dialect });\n current = compose({ current, from: empty, to: state.to });\n }\n return current;\n}\n\n/** Import only new immutable upgrades, in deterministic module/predecessor order. Never infer uninstall SQL. */\nexport function pendingModuleMigrations(params: {\n bundles: readonly ModuleMigrationBundle[];\n existing: readonly MigrationFile[];\n prefix: string;\n application?: SchemaIR;\n /** Independently replayed complete history, required when importing after a SQL-only application head. */\n replayState?: DesiredState;\n}): readonly MigrationFile[] {\n const registered = new Map<string, readonly MigrationFile[]>();\n for (const bundle of params.bundles) {\n if (registered.has(bundle.moduleId)) throw refusal({ reason: \"module-duplicate-registration\", moduleId: bundle.moduleId });\n registered.set(bundle.moduleId, moduleMigrationFiles({ bundle, prefix: params.prefix }));\n }\n const previous = new Map<string, Set<string>>();\n for (const file of params.existing) {\n const origin = file.moduleOrigin;\n if (origin === undefined) continue;\n const sources = registered.get(origin.moduleId);\n if (sources === undefined) throw refusal({ reason: \"module-registration-missing\", moduleId: origin.moduleId });\n const same = sources.find((candidate) => candidate.moduleOrigin!.revision === origin.revision);\n if (same === undefined || canonicalMigrationJson({ value: same.moduleOrigin }) !== canonicalMigrationJson({ value: origin })) throw refusal({ reason: \"module-historical-artifact-changed\", moduleId: origin.moduleId });\n const revisions = previous.get(origin.moduleId) ?? new Set<string>();\n if (revisions.has(origin.revision)) throw refusal({ reason: \"module-chain-invalid\", moduleId: origin.moduleId });\n revisions.add(origin.revision);\n previous.set(origin.moduleId, revisions);\n }\n const all = [...registered].sort(([a], [b]) => a.localeCompare(b)).flatMap(([, files]) => files);\n const initial = all[0]?.moduleOrigin;\n if (initial === undefined) return [];\n for (const file of all) if (file.moduleOrigin!.dialect !== initial.dialect) throw refusal({ reason: \"module-dialect-mismatch\", moduleId: file.moduleOrigin!.moduleId });\n if (params.application !== undefined) for (const file of all) {\n const origin = file.moduleOrigin!;\n const app = createDesiredState({ schema: params.application, dialect: origin.dialect });\n const keys = new Set(moduleOwnedObjects({ desiredState: { version: 1, dialect: origin.dialect, from: app, to: app }, namespace: moduleNamespace({ origin }) }).map((identity) => sqlObjectKey({ identity })));\n if (origin.owned.some((identity) => keys.has(sqlObjectKey({ identity })))) throw refusal({ reason: \"module-object-collision\", moduleId: origin.moduleId });\n }\n const upgrades = all.filter((file) => !previous.get(file.moduleOrigin!.moduleId)?.has(file.moduleOrigin!.revision));\n if (upgrades.length === 0) {\n assertModuleUpgradeHistory({ migrations: params.existing, records: new Map() });\n return [];\n }\n if (params.existing.length > 0 && params.existing.at(-1)!.desiredState === undefined && params.replayState === undefined) throw refusal({ reason: \"module-application-replay-required\" });\n let current = params.replayState ?? params.existing.at(-1)?.desiredState?.to ?? createDesiredState({ schema: { ...initial.source.desiredState!.from.schema, models: [], enums: [], migrationObjects: [] }, dialect: initial.dialect });\n if (params.replayState !== undefined) {\n // Replay is physical evidence. Restore immutable authored module portions so\n // catalog spelling does not rewrite their ownership/provenance contracts.\n const heads = new Map<string, MigrationFile>();\n for (const file of params.existing) if (file.moduleOrigin !== undefined) heads.set(file.moduleOrigin.moduleId, file);\n for (const file of heads.values()) {\n const origin = file.moduleOrigin!;\n const head = origin.source.desiredState!.to;\n const owned = new Set(origin.owned.map((identity) => sqlObjectKey({ identity })));\n current = compose({ current: { ...current, definitions: current.definitions.filter((definition) => !owned.has(sqlObjectKey({ identity: definition.identity }))) }, from: head, to: head });\n }\n }\n const result: MigrationFile[] = [];\n for (const file of all) {\n const origin = file.moduleOrigin!;\n if (previous.get(origin.moduleId)?.has(origin.revision)) continue;\n const state = origin.source.desiredState!;\n const to = compose({ current, from: state.from, to: state.to });\n const migration: MigrationFile = { ...file, name: `${params.prefix}_${String(params.existing.length + result.length + 1).padStart(4, \"0\")}`, desiredState: { ...state, from: current, to, ...(state.down === undefined ? {} : { down: compose({ current, from: state.from, to: state.down }) }) } };\n assertModuleOwnership({ origin, desiredState: migration.desiredState });\n result.push(Object.freeze(migration));\n current = to;\n }\n assertModuleUpgradeHistory({ migrations: [...params.existing, ...result], records: new Map() });\n return Object.freeze(result);\n}\n",
|
|
50
66
|
"import { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect } from \"@vibeorm/schema\";\nimport { readModuleJournal } from \"./module-journal.ts\";\nimport { moduleHistoryHeads } from \"./module-history.ts\";\nimport { assertLiveModuleOwnership } from \"./module-ownership.ts\";\nimport { verifyMigrationTransition } from \"./inspect-objects.ts\";\nimport type { MigrationStateReport } from \"./inspect-objects.ts\";\nimport type { SqlExecutor } from \"./types.ts\";\n\n/** The immutable schema artifact expected by a runtime, never an npm version. */\nexport type ModuleReadinessExpectation = { readonly moduleId: string; readonly revision: string; readonly artifactChecksum: string; readonly contract: string };\nexport type ModuleReadinessResult = {\n readonly moduleId: string;\n readonly installedRevision?: string;\n readonly revision: \"matching\" | \"compatible\" | \"missing\" | \"incompatible\" | \"incomplete\";\n readonly structural: { readonly status: \"not-checked\" | \"matching\" | \"drifted\"; readonly report?: MigrationStateReport };\n};\nexport type ModuleReadinessReport = { readonly ready: boolean; readonly modules: readonly ModuleReadinessResult[] };\n\n/** Read completed history once; optionally inspect live objects. No journal creation, DDL or repair. */\nexport async function inspectModuleReadiness(params: {\n executor: SqlExecutor;\n dialect: Dialect;\n modules: readonly ModuleReadinessExpectation[];\n compatibility?: \"exact\" | \"contract\";\n deep?: boolean;\n}): Promise<ModuleReadinessReport> {\n const ids = new Set<string>();\n for (const expected of params.modules) {\n if (ids.has(expected.moduleId) || !expected.moduleId || !expected.revision || !expected.contract || !/^[a-f0-9]{64}$/.test(expected.artifactChecksum)) throw new VibeError({ code: \"VIBE_CONFIG\", message: \"Module readiness needs a unique module id, revision, contract and immutable artifact checksum\", meta: { reason: \"module-readiness-expectation\", moduleId: expected.moduleId } });\n ids.add(expected.moduleId);\n }\n if (params.compatibility !== undefined && params.compatibility !== \"exact\" && params.compatibility !== \"contract\") throw new VibeError({ code: \"VIBE_CONFIG\", message: \"Unknown module compatibility mode\", meta: { reason: \"module-readiness-expectation\" } });\n const records = await readModuleJournal(params);\n const heads = moduleHistoryHeads({ records });\n const unresolved = [...records.values()].some(({ row, entry }) => row.error !== undefined || row.statementIndex < 0 || entry !== undefined && (!entry.complete || row.statementIndex !== entry.migration.sql.length));\n const modules: ModuleReadinessResult[] = [];\n for (const expected of params.modules) {\n const head = heads.get(expected.moduleId);\n const origin = head?.entry?.migration.moduleOrigin;\n let revision: ModuleReadinessResult[\"revision\"] = \"missing\";\n let structural: ModuleReadinessResult[\"structural\"] = { status: \"not-checked\" };\n if (unresolved) revision = \"incomplete\";\n else if (origin !== undefined) {\n if (origin.revision === expected.revision && origin.artifactChecksum === expected.artifactChecksum && origin.contracts.includes(expected.contract)) revision = \"matching\";\n else if (params.compatibility === \"contract\" && origin.contracts.includes(expected.contract) && [...records.values()].some((record) => {\n const previous = record.entry?.migration.moduleOrigin;\n return previous?.moduleId === expected.moduleId && previous.revision === expected.revision && previous.artifactChecksum === expected.artifactChecksum && previous.contracts.includes(expected.contract);\n })) revision = \"compatible\";\n else revision = \"incompatible\";\n }\n if (params.deep === true && origin !== undefined && (revision === \"matching\" || revision === \"compatible\")) {\n await assertLiveModuleOwnership({ executor: params.executor, origin, resume: true });\n const state = origin.source.desiredState!;\n const report = await verifyMigrationTransition({ executor: params.executor, dialect: params.dialect, from: state.from, to: state.to, removals: state.unmanagedRemovals });\n structural = { status: report.inSync ? \"matching\" : \"drifted\", report };\n }\n modules.push({ moduleId: expected.moduleId, ...(origin === undefined ? {} : { installedRevision: origin.revision }), revision, structural });\n }\n return { ready: !unresolved && modules.every((module) => (module.revision === \"matching\" || module.revision === \"compatible\") && module.structural.status !== \"drifted\"), modules };\n}\n",
|
|
51
|
-
"import { VibeError
|
|
52
|
-
"import { deparseExclusion } from \"./exclusions.ts\";\nimport { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect, SchemaIR, SqlObjectDefinition } from \"@vibeorm/schema\";\nimport { renderExclusionSetup, getSqlDialect, renderMigrationServerVersion } from \"@vibeorm/sql\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { createDesiredState } from \"./desired-state.ts\";\nimport { deparsePostgresCheckDefinition } from \"./inspect-objects.ts\";\nimport { renderSteps } from \"./ddl/render.ts\";\nimport type { MigrationStep, SqlExecutor } from \"./types.ts\";\n\n/** Compile authored PostgreSQL CHECKs including newly created tables under an explicit rollback probe. */\nexport async function compileDesiredState(params: {\n executor: SqlExecutor;\n schema: SchemaIR;\n dialect: Dialect;\n steps: readonly MigrationStep[];\n probe: \"rollback\";\n}): Promise<DesiredState> {\n if (params.dialect !== \"postgres\") throw new VibeError({ code: \"VIBE_UNSUPPORTED_CAPABILITY\", message: \"Rollback declaration compilation requires PostgreSQL\", meta: { feature: \"desiredStateCompilation\", dialect: params.dialect } });\n if (params.steps.some((step) => step.kind === \"alterColumn\" || step.kind === \"addColumn\" || step.kind === \"addEnumValue\")) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"CHECK compilation after column or enum changes requires an independently built reference with the new type context\", meta: { reason: \"reference-required\" } });\n const definitions: SqlObjectDefinition[] = (params.schema.migrationObjects ?? []).flatMap((object) => object.expected === undefined ? [] : [object.expected]);\n await params.executor({ text: \"SAVEPOINT vibeorm_desired_state\" });\n try {\n // Only render new empty table/type definitions. Never run arbitrary extension SQL,\n // data statements, destructive operations or scripts supplied by the application.\n const newObjects = params.steps.filter((step) => step.kind === \"createTable\" || step.kind === \"createEnum\" || step.kind === \"addEnumValue\");\n for (const text of renderSteps({ steps: newObjects, dialect: \"postgres\" })) await params.executor({ text });\n const models = [];\n for (const model of params.schema.models) {\n const table = { namespace: \"public\", name: model.dbName ?? model.name };\n const exclusions = [];\n for (const exclusion of model.exclusions ?? []) {\n for (const text of renderExclusionSetup({ dialect: getSqlDialect({ dialect: \"postgres\" }), exclusion })) await params.executor({ text });\n exclusions.push({ ...exclusion, normalizationSource: exclusion.definition, normalizedDefinition: await deparseExclusion({ executor: params.executor, table: table.name, definition: exclusion.definition }) });\n }\n models.push({ ...model, ...(exclusions.length ? { exclusions } : {}) });\n for (const check of model.checks ?? []) definitions.push(await deparsePostgresCheckDefinition({ executor: params.executor, table, expression: check.expression, constraint: check.name, probe: \"rollback\" }));\n }\n const query = renderMigrationServerVersion({ dialect: getSqlDialect({ dialect: params.dialect }) });\n const version = (await params.executor({ text: query.text, values: [] }))[0]?.version;\n if (typeof version !== \"string\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Cannot determine definition normalization version\" });\n return { ...createDesiredState({ schema: { ...params.schema, models }, dialect: params.dialect, definitions }), normalization: { format: \"catalog-v1\", dialect: params.dialect, serverVersion: version } };\n } finally {\n await params.executor({ text: \"ROLLBACK TO SAVEPOINT vibeorm_desired_state\" });\n await params.executor({ text: \"RELEASE SAVEPOINT vibeorm_desired_state\" });\n }\n}\n",
|
|
53
|
-
"import type { Dialect } from \"@vibeorm/schema\";\nimport { getSqlDialect, renderModuleJournal, renderMigrationHistoryQuery } from \"@vibeorm/sql\";\nimport { MIGRATIONS_TABLE_NAME } from \"./journal-table.ts\";\nimport { classifyJournal } from \"./runner.ts\";\nimport { migrationNamespace } from \"./inspect-objects.ts\";\nimport { readJournalRows } from \"./journal-read.ts\";\nimport type { MigrationFile, RecordedMigration, SqlExecutor } from \"./types.ts\";\n\n/** Read-only history separates a missing journal from an unreadable or partial one. */\nexport type MigrationHistory = { readonly tablePresent: boolean; readonly recorded: readonly RecordedMigration[] };\n\n/** Never creates a table, acquires an advisory lock or executes native-RLS probes. */\nexport async function readMigrationHistory(params: { executor: SqlExecutor; migrations: readonly MigrationFile[]; dialect: Dialect }): Promise<MigrationHistory> {\n const namespace = await migrationNamespace({ executor: params.executor, dialect: params.dialect });\n const query = params.migrations.some((migration) => migration.moduleOrigin !== undefined)\n ? renderModuleJournal({ dialect: getSqlDialect({ dialect: params.dialect }), table: MIGRATIONS_TABLE_NAME, operation: { kind: \"read\" } })\n : renderMigrationHistoryQuery({ dialect: getSqlDialect({ dialect: params.dialect }), namespace });\n const recorded = await readJournalRows({ executor: params.executor, dialect: params.dialect, query });\n if (recorded === undefined) return { tablePresent: false, recorded: [] };\n return { tablePresent: true, recorded: classifyJournal({ dialect: params.dialect, migrations: params.migrations, recorded }) };\n}\n",
|
|
54
|
-
"import { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect } from \"@vibeorm/schema\";\nimport type { MigrationFile, RecordedMigration, SqlExecutor } from \"./types.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { assertMigrationState, verifyMigrationState } from \"./inspect-objects.ts\";\n\n/** Verify an independently supplied reference and return a new metadata-only migration. */\nexport async function adoptMigration(params: { executor: SqlExecutor; reference: DesiredState; name: string; dialect: Dialect }): Promise<MigrationFile> {\n const report = await verifyMigrationState({ executor: params.executor, expected: params.reference, dialect: params.dialect });\n assertMigrationState({ report });\n return { name: params.name, sql: [], downSql: [], destructive: false,\n desiredState: { version: 1, dialect: params.dialect, from: params.reference, to: params.reference } };\n}\n\n/** Only complete checksum-verified history can establish deployed desired state. */\nexport function deployedDesiredState(params: { migrations: readonly MigrationFile[]; recorded: readonly RecordedMigration[] }): DesiredState | undefined {\n for (const row of params.recorded) {\n if (row.state !== \"applied\" || row.checksum === \"\") throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Desired state requires complete, checksum-verified migration history\", meta: { reason: \"desired-state-history-unverified\", migration: row.name, state: row.state } });\n }\n const applied = new Set(params.recorded.map((row) => row.name));\n if (params.migrations.some((migration) => applied.has(migration.name) && migration.desiredStatePending === true)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Applied unfinalized metadata cannot establish desired state\", meta: { reason: \"desired-state-history-unverified\" } });\n const last = [...params.migrations].reverse().find((migration) => applied.has(migration.name));\n if (last !== undefined && last.desiredState === undefined && params.migrations.some((migration) => applied.has(migration.name) && migration.desiredState !== undefined)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"A later metadata-free migration invalidates the earlier desired-state baseline; adopt an independent current reference\", meta: { reason: \"desired-state-history-unverified\", migration: last.name } });\n return last?.desiredState?.to;\n}\n"
|
|
67
|
+
"import { VibeError } from \"@vibeorm/schema\";\nimport type { Dialect } from \"@vibeorm/schema\";\nimport type { MigrationFile, RecordedMigration, SqlExecutor } from \"./types.ts\";\nimport type { DesiredState } from \"./desired-state.ts\";\nimport { assertMigrationState, verifyMigrationState } from \"./inspect-objects.ts\";\nimport { migrationChecksum } from \"./migration-checksum.ts\";\n\n/** Verify an independently supplied reference and return a new metadata-only migration. */\nexport async function adoptMigration(params: { executor: SqlExecutor; reference: DesiredState; name: string; dialect: Dialect }): Promise<MigrationFile> {\n const report = await verifyMigrationState({ executor: params.executor, expected: params.reference, dialect: params.dialect });\n assertMigrationState({ report });\n return { name: params.name, sql: [], downSql: [], destructive: false,\n desiredState: { version: 1, dialect: params.dialect, from: params.reference, to: params.reference } };\n}\n\n/** Only complete checksum-verified history can establish deployed desired state. */\nexport function deployedDesiredState(params: { migrations: readonly MigrationFile[]; recorded: readonly RecordedMigration[] }): DesiredState | undefined {\n for (const [index, row] of params.recorded.entries()) {\n const file = params.migrations[index];\n if (row.state !== \"applied\" || row.checksum === \"\" || file?.name !== row.name || migrationChecksum(file) !== row.checksum) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Desired state requires complete, checksum-verified migration history\", meta: { reason: \"desired-state-history-unverified\", migration: row.name, state: row.state } });\n }\n const applied = new Set(params.recorded.map((row) => row.name));\n if (params.migrations.some((migration) => applied.has(migration.name) && migration.desiredStatePending === true)) throw new VibeError({ code: \"VIBE_MIGRATION\", message: \"Applied unfinalized metadata cannot establish desired state\", meta: { reason: \"desired-state-history-unverified\" } });\n const last = [...params.migrations].reverse().find((migration) => applied.has(migration.name));\n // An ordinary SQL successor has no snapshot. Never present an earlier one as current.\n return last?.desiredState?.to;\n}\n"
|
|
55
68
|
],
|
|
56
|
-
"mappings": ";;AA2SO,SAAS,YAAY,CAAC,QAAyC;AAAA,EACpE,QAAQ,SAAS;AAAA,EACjB,QAAQ,KAAK;AAAA,SACN;AAAA,MAAgB,OAAO,kBAAkB,KAAK,UAAU,aAAa,KAAK;AAAA,SAC1E;AAAA,MAAiB,OAAO,mBAAmB,KAAK,UAAU,aAAa,KAAK;AAAA,SAC5E;AAAA,MAAa,OAAO,yBAAyB,KAAK;AAAA,SAClD;AAAA,MAAY,OAAO,wBAAwB,KAAK;AAAA,SAChD;AAAA,MAAc,OAAO,0BAA0B,KAAK;AAAA,SACpD;AAAA,MAAc,OAAO,gCAAgC,KAAK;AAAA,SAC1D;AAAA,MAAgB,OAAO,gCAAgC,KAAK;AAAA,SAC5D;AAAA,MAAc,OAAO,8BAA8B,KAAK;AAAA,SACxD;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