@vibeorm/migrate 2.1.1 → 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/ddl/mysql.d.ts.map +1 -1
- package/dist/ddl/postgres.d.ts +2 -1
- package/dist/ddl/postgres.d.ts.map +1 -1
- package/dist/ddl/sqlite.d.ts +6 -1
- package/dist/ddl/sqlite.d.ts.map +1 -1
- package/dist/desired-state.d.ts +7 -0
- package/dist/desired-state.d.ts.map +1 -1
- package/dist/down.d.ts.map +1 -1
- package/dist/fs.d.ts +2 -0
- package/dist/fs.d.ts.map +1 -1
- package/dist/fs.js +6165 -4900
- package/dist/fs.js.map +41 -30
- package/dist/history.d.ts.map +1 -1
- package/dist/index.d.ts +22 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7735 -5291
- package/dist/index.js.map +59 -34
- package/dist/inspect-objects.d.ts +10 -1
- package/dist/inspect-objects.d.ts.map +1 -1
- package/dist/introspect/mysql.d.ts.map +1 -1
- package/dist/introspect/postgres.d.ts.map +1 -1
- package/dist/introspect/shared.d.ts +7 -8
- package/dist/introspect/shared.d.ts.map +1 -1
- package/dist/introspect/sqlite.d.ts +4 -0
- package/dist/introspect/sqlite.d.ts.map +1 -1
- package/dist/journal-read.d.ts +24 -0
- package/dist/journal-read.d.ts.map +1 -0
- package/dist/migration-checksum.d.ts +14 -0
- package/dist/migration-checksum.d.ts.map +1 -0
- package/dist/module-bundle.d.ts +27 -0
- package/dist/module-bundle.d.ts.map +1 -0
- package/dist/module-export.d.ts +10 -0
- package/dist/module-export.d.ts.map +1 -0
- package/dist/module-history.d.ts +18 -0
- package/dist/module-history.d.ts.map +1 -0
- package/dist/module-journal.d.ts +49 -0
- package/dist/module-journal.d.ts.map +1 -0
- package/dist/module-origin.d.ts +47 -0
- package/dist/module-origin.d.ts.map +1 -0
- package/dist/module-ownership.d.ts +33 -0
- package/dist/module-ownership.d.ts.map +1 -0
- package/dist/module-pending.d.ts +19 -0
- package/dist/module-pending.d.ts.map +1 -0
- package/dist/module-readiness.d.ts +32 -0
- package/dist/module-readiness.d.ts.map +1 -0
- package/dist/mysql-catalog-visibility.d.ts +5 -0
- package/dist/mysql-catalog-visibility.d.ts.map +1 -0
- package/dist/mysql-types.d.ts.map +1 -1
- package/dist/normalize.d.ts +4 -15
- package/dist/normalize.d.ts.map +1 -1
- package/dist/object-ownership.d.ts.map +1 -1
- package/dist/planner.d.ts +5 -0
- package/dist/planner.d.ts.map +1 -1
- package/dist/postgres-default-equivalence.d.ts +11 -0
- package/dist/postgres-default-equivalence.d.ts.map +1 -0
- 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/recovery.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 +45 -30
- 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/sql-statements.d.ts +2 -0
- package/dist/sql-statements.d.ts.map +1 -1
- package/dist/sqlite-types.d.ts.map +1 -1
- package/dist/types.d.ts +27 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/verify-history.d.ts +35 -0
- package/dist/verify-history.d.ts.map +1 -0
- package/package.json +3 -3
package/dist/postgres-types.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* on them so `diff(introspect(push(X)), X) = []` holds by construction.
|
|
9
9
|
*/
|
|
10
10
|
import type { CascadeAction, FieldIR, ScalarType } from "@vibeorm/schema";
|
|
11
|
+
import type { PostgresTypeName } from "@vibeorm/sql";
|
|
11
12
|
/** IR scalar → canonical postgres column type. */
|
|
12
13
|
export declare const SCALAR_TO_PG: Readonly<Record<ScalarType, string>>;
|
|
13
14
|
/**
|
|
@@ -18,6 +19,10 @@ export declare const SCALAR_TO_PG: Readonly<Record<ScalarType, string>>;
|
|
|
18
19
|
export declare function normalizeNativeType(params: {
|
|
19
20
|
raw: string;
|
|
20
21
|
}): string;
|
|
22
|
+
/** Parse unsupported types without folding quoted identifier or literal bytes. */
|
|
23
|
+
export declare function parseUnsupportedPostgresType(params: {
|
|
24
|
+
raw: string;
|
|
25
|
+
}): PostgresTypeName | undefined;
|
|
21
26
|
/**
|
|
22
27
|
* Comparison key for a column's type. Two columns with equal keys need no
|
|
23
28
|
* ALTER. A native type equal to the scalar's canonical mapping is dropped, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-types.d.ts","sourceRoot":"","sources":["../src/postgres-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"postgres-types.d.ts","sourceRoot":"","sources":["../src/postgres-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;A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,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG,OAAO,CAGrE;AAID;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAM7E,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAMtE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE;IACtC,QAAQ,EAAE,aAAa,GAAG,SAAS,CAAC;IACpC,QAAQ,EAAE,OAAO,CAAC;CACnB,GAAG,aAAa,CAGhB;AAED,iEAAiE;AACjE,wBAAgB,eAAe,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,aAAa,GAAG,SAAS,CAAA;CAAE,GAAG,aAAa,CAE9F;AAID,gFAAgF;AAChF,wBAAgB,aAAa,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE/D"}
|
package/dist/recovery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recovery.d.ts","sourceRoot":"","sources":["../src/recovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAS/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"recovery.d.ts","sourceRoot":"","sources":["../src/recovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAS/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAc9C,kEAAkE;AAClE,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,CAAC;AA6BtD;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,EAAE;IACpD,QAAQ,EAAE,WAAW,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,kBAAkB,CAAC;CAC/B,GAAG,OAAO,CAAC,cAAc,CAAC,CAmG1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference-state.d.ts","sourceRoot":"","sources":["../src/reference-state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"reference-state.d.ts","sourceRoot":"","sources":["../src/reference-state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;GAIG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE;IACtD,iBAAiB,EAAE,WAAW,CAAC;IAC/B,MAAM,EAAE,QAAQ,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAAC,YAAY,CAAC,CAyBxB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SchemaIR } from "@vibeorm/schema";
|
|
2
|
+
import type { ReplayReference } from "./shadow-types.ts";
|
|
3
|
+
import type { SqlExecutor } from "./types.ts";
|
|
4
|
+
/** Compile authored custom bodies on scratch; reject lost transactions and failed rollback. */
|
|
5
|
+
export declare function compareReplayMigrationObjects(params: {
|
|
6
|
+
executor: SqlExecutor;
|
|
7
|
+
reference: ReplayReference;
|
|
8
|
+
schema: SchemaIR;
|
|
9
|
+
}): Promise<SchemaIR>;
|
|
10
|
+
//# sourceMappingURL=replay-objects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay-objects.d.ts","sourceRoot":"","sources":["../src/replay-objects.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAuB,MAAM,iBAAiB,CAAC;AAQrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgC9C,+FAA+F;AAC/F,wBAAsB,6BAA6B,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAA;CAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CA2DtJ"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { SchemaIR, SqlObjectIdentity, VibeExtension } from "@vibeorm/schema";
|
|
2
|
+
import type { SchemaMigrationPlan } from "./planner.ts";
|
|
3
|
+
import type { ReplayReference } from "./shadow-types.ts";
|
|
4
|
+
import type { MigrationFile, SqlExecutor } from "./types.ts";
|
|
5
|
+
/** Replay-specific plan; all drop candidates remain visible until individually authorized. */
|
|
6
|
+
export type ReplayMigrationPlan = SchemaMigrationPlan & {
|
|
7
|
+
readonly requiredRemovals: readonly SqlObjectIdentity[];
|
|
8
|
+
readonly retainedObjects: readonly SqlObjectIdentity[];
|
|
9
|
+
readonly securityChanges: readonly string[];
|
|
10
|
+
/** Legacy replay may need approvals for removals that are already absent now. */
|
|
11
|
+
readonly replayRemovals: readonly SqlObjectIdentity[];
|
|
12
|
+
};
|
|
13
|
+
/** Plan only on an independently replayed scratch session, without changing legacy live-planner defaults. */
|
|
14
|
+
export declare function planReplayMigration(params: {
|
|
15
|
+
executor: SqlExecutor;
|
|
16
|
+
reference: ReplayReference;
|
|
17
|
+
schema: SchemaIR;
|
|
18
|
+
migrations: readonly MigrationFile[];
|
|
19
|
+
extensions?: readonly VibeExtension[];
|
|
20
|
+
replaceChecks?: readonly SqlObjectIdentity[];
|
|
21
|
+
}): Promise<ReplayMigrationPlan>;
|
|
22
|
+
/** Publication authorization is separate from preview and applies even to represented historical objects. */
|
|
23
|
+
export declare function assertReplayRemovals(params: {
|
|
24
|
+
plan: ReplayMigrationPlan;
|
|
25
|
+
approved: readonly SqlObjectIdentity[];
|
|
26
|
+
acceptIntegrityLoss?: boolean;
|
|
27
|
+
}): void;
|
|
28
|
+
//# sourceMappingURL=replay-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay-plan.d.ts","sourceRoot":"","sources":["../src/replay-plan.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKlF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE7D,8FAA8F;AAC9F,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,GAAG;IACtD,QAAQ,CAAC,gBAAgB,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACxD,QAAQ,CAAC,eAAe,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACvD,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,iFAAiF;IACjF,QAAQ,CAAC,cAAc,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACvD,CAAC;AAEF,6GAA6G;AAC7G,wBAAsB,mBAAmB,CAAC,MAAM,EAAE;IAChD,QAAQ,EAAE,WAAW,CAAC;IACtB,SAAS,EAAE,eAAe,CAAC;IAC3B,MAAM,EAAE,QAAQ,CAAC;IACjB,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;IACrC,UAAU,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IACtC,aAAa,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC9C,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAwC/B;AAED,6GAA6G;AAC7G,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAOvJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Dialect } from "@vibeorm/schema";
|
|
2
|
+
import type { MigrationFile, SqlExecutor } from "./types.ts";
|
|
3
|
+
import type { ReplayReference } from "./shadow-types.ts";
|
|
4
|
+
/** Input binding separate from immutable journal checksum compatibility. */
|
|
5
|
+
export declare function replayFingerprint(params: {
|
|
6
|
+
value: unknown;
|
|
7
|
+
}): string;
|
|
8
|
+
/** Capture actual replay results, including custom objects absent from declarations. */
|
|
9
|
+
export declare function captureReplayReference(params: {
|
|
10
|
+
executor: SqlExecutor;
|
|
11
|
+
dialect: Dialect;
|
|
12
|
+
migrations: readonly MigrationFile[];
|
|
13
|
+
/** Only a marker already verified by the owning lifecycle may be hidden. */
|
|
14
|
+
privateTable?: string;
|
|
15
|
+
/** Only the dedicated lifecycle may exempt its PostgreSQL marker namespace. */
|
|
16
|
+
privateNamespace?: string;
|
|
17
|
+
}): Promise<ReplayReference>;
|
|
18
|
+
//# sourceMappingURL=replay-reference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay-reference.d.ts","sourceRoot":"","sources":["../src/replay-reference.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAqB,MAAM,iBAAiB,CAAC;AAUlE,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAEpE;AAED,wFAAwF;AACxF,wBAAsB,sBAAsB,CAAC,MAAM,EAAE;IACnD,QAAQ,EAAE,WAAW,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;IACrC,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,OAAO,CAAC,eAAe,CAAC,CA2D3B"}
|
package/dist/runner.d.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* Concurrency: `applyMigrations` and `rollbackMigration` take an advisory lock
|
|
6
6
|
* for the whole run — `pg_advisory_lock(1447645253)` on postgres ("VIBE" in
|
|
7
7
|
* ASCII, blocking, released in a finally), `GET_LOCK('vibeorm_migrate', 60)`
|
|
8
|
-
* on mysql (throws VIBE_MIGRATION on timeout).
|
|
9
|
-
*
|
|
8
|
+
* on mysql (throws VIBE_MIGRATION on timeout). SQLite serializes individual
|
|
9
|
+
* transactions only; callers must exclude concurrent whole-run operations.
|
|
10
|
+
* Locks are session-scoped — the
|
|
10
11
|
* SqlExecutor contract (types.ts) requires one session for the whole
|
|
11
12
|
* operation.
|
|
12
13
|
*
|
|
@@ -14,11 +15,8 @@
|
|
|
14
15
|
* after. Two concurrent first-time runs against a fresh postgres database
|
|
15
16
|
* would otherwise both issue `CREATE TABLE IF NOT EXISTS _vibe_migrations`,
|
|
16
17
|
* which is a catalog race on postgres (a duplicate-key error on
|
|
17
|
-
* `pg_type_typname_nsp_index`, not a no-op).
|
|
18
|
-
*
|
|
19
|
-
* migration lock would make `status` block behind a running migrate — so two
|
|
20
|
-
* concurrent FIRST-EVER `status`/`resolve` calls on a fresh database can still
|
|
21
|
-
* hit that race; retrying either is enough, since the table then exists.
|
|
18
|
+
* `pg_type_typname_nsp_index`, not a no-op). Repair uses the same lock.
|
|
19
|
+
* Status deliberately stays nonblocking and never creates the journal.
|
|
22
20
|
*
|
|
23
21
|
* Execution strategy per dialect (`DIALECT_CAPABILITIES[dialect]`) AND per
|
|
24
22
|
* script:
|
|
@@ -54,9 +52,10 @@
|
|
|
54
52
|
* a silent divergence.
|
|
55
53
|
*/
|
|
56
54
|
import type { Dialect, SchemaIR, SqlObjectIdentity, VibeExtension } from "@vibeorm/schema";
|
|
55
|
+
import type { JournalRow } from "./journal-read.ts";
|
|
57
56
|
import type { MigrationExecution } from "./execution.ts";
|
|
58
57
|
import type { RenameIntent } from "./renames.ts";
|
|
59
|
-
import type { AppliedResult, MigrationFile, MigrationStatus, RecordedMigration, SqlExecutor } from "./types.ts";
|
|
58
|
+
import type { AppliedResult, MigrationFile, MigrationHistoryMode, MigrationReplayOptions, MigrationStatus, RecordedMigration, RollbackResult, SqlExecutor } from "./types.ts";
|
|
60
59
|
export { MIGRATIONS_TABLE_NAME } from "./journal-table.ts";
|
|
61
60
|
/** Create the bookkeeping table when missing. */
|
|
62
61
|
export declare function ensureMigrationsTable(params: {
|
|
@@ -72,14 +71,7 @@ export declare function ensureMigrationsTable(params: {
|
|
|
72
71
|
* or absent block contributes NOTHING, which is what keeps every migration
|
|
73
72
|
* written before this feature — and every journal row recording one — valid.
|
|
74
73
|
*/
|
|
75
|
-
export
|
|
76
|
-
sql: readonly string[];
|
|
77
|
-
execution?: MigrationExecution;
|
|
78
|
-
desiredState?: MigrationDesiredState;
|
|
79
|
-
downSql?: readonly string[];
|
|
80
|
-
downExecution?: MigrationExecution;
|
|
81
|
-
desiredStatePending?: boolean;
|
|
82
|
-
}): string;
|
|
74
|
+
export { migrationChecksum } from "./migration-checksum.ts";
|
|
83
75
|
import type { MigrationDesiredState } from "./desired-state.ts";
|
|
84
76
|
/**
|
|
85
77
|
* Diff two IRs and render a named migration for a dialect (postgres if
|
|
@@ -101,18 +93,24 @@ export declare function generateMigration(params: {
|
|
|
101
93
|
/** Independent authored baseline; required by live generation on an existing database. */
|
|
102
94
|
desiredState?: MigrationDesiredState;
|
|
103
95
|
}): MigrationFile;
|
|
96
|
+
/** Run one operation on a dedicated session under the existing migration lock. */
|
|
97
|
+
export declare function withMigrationLock<T>(params: {
|
|
98
|
+
executor: SqlExecutor;
|
|
99
|
+
dialect: Dialect;
|
|
100
|
+
run: (executor: SqlExecutor) => Promise<T>;
|
|
101
|
+
}): Promise<T>;
|
|
102
|
+
/** Validate replay declarations and approvals without reading or writing a database. */
|
|
103
|
+
export declare function validateMigrationReplay(params: MigrationReplayOptions): void;
|
|
104
104
|
/**
|
|
105
|
-
* Apply
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* corruption, not drift to paper over). Where progress is recorded per
|
|
109
|
-
* statement (mysql, and self-managed sqlite scripts), a partially-applied
|
|
110
|
-
* migration RESUMES from its recorded statement_index. Records created by
|
|
111
|
-
* `resolveMigration` (empty checksum) skip verification.
|
|
105
|
+
* Apply under the migration lock after preflight, preserving recorded progress.
|
|
106
|
+
* Complete mode requires a full ordered chain; subset mode remains the default.
|
|
107
|
+
* Empty-checksum resolve records deliberately skip content verification.
|
|
112
108
|
*/
|
|
113
109
|
export declare function applyMigrations(params: {
|
|
114
110
|
executor: SqlExecutor;
|
|
115
111
|
migrations: readonly MigrationFile[];
|
|
112
|
+
/** Complete requires the recorded journal to be a prefix of this ordered chain. */
|
|
113
|
+
history?: MigrationHistoryMode;
|
|
116
114
|
acceptSecurityChanges?: boolean;
|
|
117
115
|
acceptIntegrityLoss?: boolean;
|
|
118
116
|
removeUnmanaged?: readonly SqlObjectIdentity[];
|
|
@@ -133,10 +131,8 @@ export declare function migrationStatus(params: {
|
|
|
133
131
|
/**
|
|
134
132
|
* The bookkeeping journal itself, in the order rows were written — i.e. the
|
|
135
133
|
* order migrations were actually applied, which is what a rollback must walk
|
|
136
|
-
* backwards. Every row is returned
|
|
137
|
-
*
|
|
138
|
-
* and a record whose file is gone all still occupy a position in history, and
|
|
139
|
-
* a caller that skips them rolls back the WRONG migration (F28).
|
|
134
|
+
* backwards. Every row is returned with its checksum, cursor and classification;
|
|
135
|
+
* mismatched, partial and fileless rows still occupy their position in history.
|
|
140
136
|
*
|
|
141
137
|
* Takes no lock, exactly like `migrationStatus`.
|
|
142
138
|
*/
|
|
@@ -147,6 +143,12 @@ export declare function recordedMigrations(params: {
|
|
|
147
143
|
/** Bookkeeping dialect; postgres if omitted. */
|
|
148
144
|
dialect?: Dialect;
|
|
149
145
|
}): Promise<RecordedMigration[]>;
|
|
146
|
+
/** Shared journal classification; history imports this, never the reverse. */
|
|
147
|
+
export declare function classifyJournal(params: {
|
|
148
|
+
dialect: Dialect;
|
|
149
|
+
migrations: readonly MigrationFile[];
|
|
150
|
+
recorded: ReadonlyMap<string, JournalRow>;
|
|
151
|
+
}): RecordedMigration[];
|
|
150
152
|
/**
|
|
151
153
|
* Repair the bookkeeping table without running SQL: mark a migration as
|
|
152
154
|
* `"applied"` (upsert its record; pass `checksum` to also pin its content —
|
|
@@ -182,13 +184,26 @@ export declare function resolveMigration(params: {
|
|
|
182
184
|
* partially APPLIED migration cannot be rolled back — its down mirrors the
|
|
183
185
|
* full up; finish applying (apply resumes) or repair with `resolveMigration`.
|
|
184
186
|
*/
|
|
185
|
-
|
|
187
|
+
type RollbackOptions = {
|
|
186
188
|
executor: SqlExecutor;
|
|
187
|
-
migration: MigrationFile;
|
|
188
189
|
acceptSecurityChanges?: boolean;
|
|
189
190
|
acceptIntegrityLoss?: boolean;
|
|
190
191
|
probe?: "none" | "rollback" | "temporary";
|
|
191
|
-
/** Execution dialect; postgres if omitted. */
|
|
192
192
|
dialect?: Dialect;
|
|
193
|
+
};
|
|
194
|
+
/** Reverse one file only if it is still newest when the lock is acquired. */
|
|
195
|
+
export declare function rollbackMigration(params: RollbackOptions & {
|
|
196
|
+
migration: MigrationFile;
|
|
193
197
|
}): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Select from the current journal under one lock. With to, retain that applied
|
|
200
|
+
* migration and reverse every newer row; without it, reverse only the newest.
|
|
201
|
+
* All selected declarations/approvals/progress are checked before any reversal.
|
|
202
|
+
* A later SQL failure can still leave a successfully reversed prefix on disk.
|
|
203
|
+
* SQLite cross-connection ownership remains the caller's responsibility.
|
|
204
|
+
*/
|
|
205
|
+
export declare function rollbackMigrations(params: RollbackOptions & {
|
|
206
|
+
migrations: readonly MigrationFile[];
|
|
207
|
+
to?: string;
|
|
208
|
+
}): Promise<RollbackResult>;
|
|
194
209
|
//# sourceMappingURL=runner.d.ts.map
|
package/dist/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AASH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAG3F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAUpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAqBjD,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,WAAW,EACZ,M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Q,EAAE,WAAW,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,SAAS,GAAG,aAAa,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhB;AAmCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,WAAW,CAAC;IACtB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,CAAC;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,6EAA6E;AAC7E,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG;IAAE,SAAS,EAAE,aAAa,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAY7G;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG;IACjE,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;IACrC,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,GAAG,OAAO,CAAC,cAAc,CAAC,CAgC1B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MigrationReferenceOptions, ShadowDatabaseOptions } from "./shadow-types.ts";
|
|
2
|
+
import type { SqlExecutor } from "./types.ts";
|
|
3
|
+
type DedicatedOptions = Extract<ShadowDatabaseOptions, {
|
|
4
|
+
readonly mode: "dedicated";
|
|
5
|
+
}>;
|
|
6
|
+
/** @internal Dedicated mode is a reset lease, never database deletion authority. */
|
|
7
|
+
export declare function withDedicatedShadow<T>(params: MigrationReferenceOptions<T> & {
|
|
8
|
+
readonly shadow: DedicatedOptions;
|
|
9
|
+
readonly runReference: (executor: SqlExecutor, privateTable?: string) => Promise<T>;
|
|
10
|
+
}): Promise<T>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=shadow-dedicated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadow-dedicated.d.ts","sourceRoot":"","sources":["../src/shadow-dedicated.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,KAAK,gBAAgB,GAAG,OAAO,CAAC,qBAAqB,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC,CAAC;AAkFvF,oFAAoF;AACpF,wBAAsB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,yBAAyB,CAAC,CAAC,CAAC,GAAG;IAClF,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;CACrF,GAAG,OAAO,CAAC,CAAC,CAAC,CAuFb"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Dialect } from "@vibeorm/schema";
|
|
2
|
+
import type { SqlExecutor } from "./types.ts";
|
|
3
|
+
/** Refuse application migration writes to databases claimed for disposable replay. */
|
|
4
|
+
export declare function assertDatabaseNotShadow(params: {
|
|
5
|
+
executor: SqlExecutor;
|
|
6
|
+
dialect: Dialect;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
/** @internal Permit only the already pinned session during lifecycle-owned replay. */
|
|
9
|
+
export declare function runShadowReplay<T>(params: {
|
|
10
|
+
executor: SqlExecutor;
|
|
11
|
+
run: () => Promise<T>;
|
|
12
|
+
}): Promise<T>;
|
|
13
|
+
//# sourceMappingURL=shadow-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadow-guard.d.ts","sourceRoot":"","sources":["../src/shadow-guard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAI9C,sFAAsF;AACtF,wBAAsB,uBAAuB,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAKhH;AAED,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE;IAAE,QAAQ,EAAE,WAAW,CAAC;IAAC,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAGvG"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Dialect, Provider } from "@vibeorm/schema";
|
|
2
|
+
import type { DesiredState } from "./desired-state.ts";
|
|
3
|
+
import type { CatalogObject } from "./inventory.ts";
|
|
4
|
+
import type { MigrationObjectState } from "./inspect-objects.ts";
|
|
5
|
+
import type { MigrationFile, MigrationReplayOptions, SqlExecutor } from "./types.ts";
|
|
6
|
+
/** Explicit scratch selection; automatic mode never accepts a deployment target. */
|
|
7
|
+
export type ShadowDatabaseOptions = {
|
|
8
|
+
readonly mode: "automatic";
|
|
9
|
+
readonly provider: "postgresql" | "mysql";
|
|
10
|
+
readonly adminUrl: string;
|
|
11
|
+
} | {
|
|
12
|
+
readonly mode: "dedicated";
|
|
13
|
+
readonly provider: "postgresql" | "mysql";
|
|
14
|
+
readonly databaseUrl: string;
|
|
15
|
+
readonly targetUrl: string;
|
|
16
|
+
readonly ownerKey: string;
|
|
17
|
+
} | {
|
|
18
|
+
readonly mode: "automatic";
|
|
19
|
+
readonly provider: "pglite" | "sqlite";
|
|
20
|
+
};
|
|
21
|
+
/** Driver-independent connection; the factory must provide session affinity. */
|
|
22
|
+
export type ShadowConnection = {
|
|
23
|
+
readonly executor: SqlExecutor;
|
|
24
|
+
readonly close: () => Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
/** CLI supplies its existing adapter factory without coupling migrate to drivers. */
|
|
27
|
+
export type ShadowConnectionFactory = (params: {
|
|
28
|
+
readonly provider: Provider;
|
|
29
|
+
readonly url: string;
|
|
30
|
+
}) => Promise<ShadowConnection>;
|
|
31
|
+
/** Ephemeral evidence reconstructed from exactly one reviewed migration chain. */
|
|
32
|
+
export type ReplayReference = {
|
|
33
|
+
readonly dialect: Dialect;
|
|
34
|
+
readonly namespace: string;
|
|
35
|
+
readonly state: DesiredState;
|
|
36
|
+
readonly inventory: readonly CatalogObject[];
|
|
37
|
+
readonly unavailable: readonly MigrationObjectState[];
|
|
38
|
+
readonly chainFingerprint: string;
|
|
39
|
+
readonly contextFingerprint: string;
|
|
40
|
+
};
|
|
41
|
+
/** One lifecycle shared by generate, baseline and explicit history verification. */
|
|
42
|
+
export type MigrationReferenceOptions<T> = {
|
|
43
|
+
readonly shadow: ShadowDatabaseOptions;
|
|
44
|
+
readonly openConnection: ShadowConnectionFactory;
|
|
45
|
+
readonly migrations: readonly MigrationFile[];
|
|
46
|
+
readonly replay?: Omit<MigrationReplayOptions, "migrations" | "dialect">;
|
|
47
|
+
readonly run: (params: {
|
|
48
|
+
readonly executor: SqlExecutor;
|
|
49
|
+
readonly reference: ReplayReference;
|
|
50
|
+
}) => Promise<T>;
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=shadow-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadow-types.d.ts","sourceRoot":"","sources":["../src/shadow-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,o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CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,SAAS,aAAa,EAAE,CAAC;IAC7C,QAAQ,CAAC,WAAW,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACtD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;CACrC,CAAC;AAEF,oFAAoF;AACpF,MAAM,MAAM,yBAAyB,CAAC,CAAC,IAAI;IACzC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,cAAc,EAAE,uBAAuB,CAAC;IACjD,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,YAAY,GAAG,SAAS,CAAC,CAAC;IACzE,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAA;KAAE,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;CAC/G,CAAC"}
|
package/dist/shadow.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MigrationReferenceOptions, ShadowConnection } from "./shadow-types.ts";
|
|
2
|
+
import type { SqlExecutor } from "./types.ts";
|
|
3
|
+
/** @internal Cleanup always runs; preserve a primary failure when cleanup also fails. */
|
|
4
|
+
export declare function finishShadowWork<T>(params: {
|
|
5
|
+
run: () => Promise<T>;
|
|
6
|
+
cleanup: () => Promise<void>;
|
|
7
|
+
artifact: string;
|
|
8
|
+
}): Promise<T>;
|
|
9
|
+
/** @internal Keep a pinned session for every identity, lease, reset and replay query. */
|
|
10
|
+
export declare function withShadowConnection<T>(params: {
|
|
11
|
+
connection: ShadowConnection;
|
|
12
|
+
run: (executor: SqlExecutor) => Promise<T>;
|
|
13
|
+
artifact: string;
|
|
14
|
+
}): Promise<T>;
|
|
15
|
+
/** Build an independent reference and own its entire lifetime; never connect to an implicit target. */
|
|
16
|
+
export declare function withMigrationReference<T>(params: MigrationReferenceOptions<T>): Promise<T>;
|
|
17
|
+
//# sourceMappingURL=shadow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadow.d.ts","sourceRoot":"","sources":["../src/shadow.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAcjI;AAED,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE;IAAE,UAAU,EAAE,gBAAgB,CAAC;IAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAO1J;AAED,uGAAuG;AACvG,wBAAsB,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,yBAAyB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CA6ChG"}
|
package/dist/sql-statements.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { Dialect } from "@vibeorm/schema";
|
|
1
2
|
/** Split statements without splitting quoted strings or stored-program bodies. */
|
|
2
3
|
export declare function splitSqlStatements(params: {
|
|
3
4
|
sql: string;
|
|
5
|
+
dialect?: Dialect;
|
|
4
6
|
}): string[];
|
|
5
7
|
/** Render the historical semicolon-terminated migration-file representation. */
|
|
6
8
|
export declare function joinSqlStatements(params: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql-statements.d.ts","sourceRoot":"","sources":["../src/sql-statements.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sql-statements.d.ts","sourceRoot":"","sources":["../src/sql-statements.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAO/C,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,EAAE,CAiHvF;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAAG,MAAM,CAE5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-types.d.ts","sourceRoot":"","sources":["../src/sqlite-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"sqlite-types.d.ts","sourceRoot":"","sources":["../src/sqlite-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAI9C,wCAAwC;AACxC,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CA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C,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,gBAAgB,EAAE,CAgCvF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,eAAe,EAAE,CAYrF"}
|
package/dist/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* produced exclusively by the per-dialect renderers (ddl-postgres.ts), so every
|
|
7
7
|
* SQL-text decision stays reviewable in one place (constitution rule 3/4).
|
|
8
8
|
*/
|
|
9
|
-
import type { CascadeAction, CheckIR, EnumIR, FieldIR, SchemaIR } from "@vibeorm/schema";
|
|
9
|
+
import type { CascadeAction, CheckIR, Dialect, EnumIR, FieldIR, SchemaIR } from "@vibeorm/schema";
|
|
10
10
|
import type { ExclusionIR } from "@vibeorm/schema";
|
|
11
11
|
import type { MigrationExecution } from "./execution.ts";
|
|
12
12
|
import type { DesiredState, MigrationDesiredState } from "./desired-state.ts";
|
|
@@ -25,10 +25,15 @@ import type { SqlObjectIdentity } from "@vibeorm/schema";
|
|
|
25
25
|
* construction; pool-backed executors must pin one connection for the whole
|
|
26
26
|
* migrate operation.
|
|
27
27
|
*/
|
|
28
|
-
export type SqlExecutor = (params: {
|
|
28
|
+
export type SqlExecutor = ((params: {
|
|
29
29
|
text: string;
|
|
30
30
|
values?: unknown[];
|
|
31
|
-
}) => Promise<Record<string, unknown>[]
|
|
31
|
+
}) => Promise<Record<string, unknown>[]>) & {
|
|
32
|
+
/** Reserve one session before lock acquisition; its callback receives a pinned executor. */
|
|
33
|
+
readonly withSession?: <T>(params: {
|
|
34
|
+
run: (executor: SqlExecutor) => Promise<T>;
|
|
35
|
+
}) => Promise<T>;
|
|
36
|
+
};
|
|
32
37
|
/** Which aspects of a column an `alterColumn` step changes. */
|
|
33
38
|
export type AlterColumnAspect = "type" | "nullability" | "default" | "collation";
|
|
34
39
|
/** One column of an index, with its sort direction. */
|
|
@@ -263,6 +268,8 @@ export declare function describeStep(params: {
|
|
|
263
268
|
}): string;
|
|
264
269
|
/** A named migration: ordered SQL statements plus its aggregate destructiveness. */
|
|
265
270
|
export type MigrationFile = {
|
|
271
|
+
/** Immutable package origin; absent preserves historical checksum rules. */
|
|
272
|
+
readonly moduleOrigin?: import("./module-origin.ts").ModuleMigrationOrigin;
|
|
266
273
|
/** Reviewed desired state, checksum-bound for new migrations only. */
|
|
267
274
|
readonly desiredState?: MigrationDesiredState;
|
|
268
275
|
/** Offline --empty shell: cannot execute or establish trusted desired state until finalized. */
|
|
@@ -296,6 +303,21 @@ export type MigrationFile = {
|
|
|
296
303
|
/** Execution semantics of `downSql`; absent means the dialect's existing behaviour. */
|
|
297
304
|
readonly downExecution?: MigrationExecution;
|
|
298
305
|
};
|
|
306
|
+
/** Subset preserves programmatic calls; complete requires an ordered full chain. */
|
|
307
|
+
export type MigrationHistoryMode = "subset" | "complete";
|
|
308
|
+
/** Pure replay validation before an operation such as reset destroys the database. */
|
|
309
|
+
export type MigrationReplayOptions = {
|
|
310
|
+
readonly migrations: readonly MigrationFile[];
|
|
311
|
+
readonly dialect?: Dialect;
|
|
312
|
+
readonly acceptSecurityChanges?: boolean;
|
|
313
|
+
readonly acceptIntegrityLoss?: boolean;
|
|
314
|
+
readonly removeUnmanaged?: readonly SqlObjectIdentity[];
|
|
315
|
+
readonly probe?: "none" | "rollback" | "temporary";
|
|
316
|
+
};
|
|
317
|
+
/** Result of a lock-held rollback selection and execution. */
|
|
318
|
+
export type RollbackResult = {
|
|
319
|
+
readonly rolledBack: readonly string[];
|
|
320
|
+
};
|
|
299
321
|
/** Result of `applyMigrations`. */
|
|
300
322
|
export type AppliedResult = {
|
|
301
323
|
/** Migrations executed by this call, in order. */
|
|
@@ -305,6 +327,8 @@ export type AppliedResult = {
|
|
|
305
327
|
};
|
|
306
328
|
/** Result of `migrationStatus`. */
|
|
307
329
|
export type MigrationStatus = {
|
|
330
|
+
/** Journal rows with no supplied file; omitted when empty for compatibility. */
|
|
331
|
+
readonly unknownFiles?: readonly string[];
|
|
308
332
|
/** Recorded migrations whose checksum matches. */
|
|
309
333
|
readonly applied: readonly string[];
|
|
310
334
|
/** Migrations with no record yet. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAClG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIzD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC;CACpB,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG;IAC1C,4FAA4F;IAC5F,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE;QAAE,GAAG,E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AC;IAChC,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;CACxC,CAAC;AAEF,wBAAwB;AACxB,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACnD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC1D,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Dialect } from "@vibeorm/schema";
|
|
2
|
+
import type { MigrationObjectState } from "./inspect-objects.ts";
|
|
3
|
+
import type { CatalogObject } from "./inventory.ts";
|
|
4
|
+
import type { ReplayReference } from "./shadow-types.ts";
|
|
5
|
+
import type { MigrationFile, RecordedMigration, SqlExecutor } from "./types.ts";
|
|
6
|
+
/** Select only the exact checksum-bound applied prefix returned by readMigrationHistory. */
|
|
7
|
+
export declare function selectMigrationVerificationPrefix(params: {
|
|
8
|
+
readonly migrations: readonly MigrationFile[];
|
|
9
|
+
readonly recorded: readonly RecordedMigration[];
|
|
10
|
+
}): readonly MigrationFile[];
|
|
11
|
+
/** Coverage is limited to represented objects in the migration namespace, not all database infrastructure. */
|
|
12
|
+
export type MigrationVerificationReport = {
|
|
13
|
+
readonly inSync: boolean;
|
|
14
|
+
readonly scope: "migration-namespace";
|
|
15
|
+
readonly namespace: string;
|
|
16
|
+
readonly objects: readonly MigrationObjectState[];
|
|
17
|
+
readonly unavailable: readonly MigrationObjectState[];
|
|
18
|
+
readonly unmanaged: readonly CatalogObject[];
|
|
19
|
+
};
|
|
20
|
+
/** Compare independently replayed evidence using catalog reads only, never target normalization probes. */
|
|
21
|
+
export declare function verifyMigrationReference(params: {
|
|
22
|
+
readonly executor: SqlExecutor;
|
|
23
|
+
readonly dialect: Dialect;
|
|
24
|
+
readonly reference: ReplayReference;
|
|
25
|
+
/** Live independent replay connection; required when its schema declares native RLS. */
|
|
26
|
+
readonly referenceExecutor?: SqlExecutor;
|
|
27
|
+
}): Promise<MigrationVerificationReport>;
|
|
28
|
+
/** Comparison-only evidence: rebasing must not forge a new replay/context fingerprint. */
|
|
29
|
+
export type MigrationComparisonReference = Pick<ReplayReference, "namespace" | "state" | "inventory" | "unavailable">;
|
|
30
|
+
/** Rebase structured MySQL catalog identities and FK namespace fields, never SQL text. */
|
|
31
|
+
export declare function rebaseMysqlVerificationReference(params: {
|
|
32
|
+
readonly reference: ReplayReference;
|
|
33
|
+
readonly namespace: string;
|
|
34
|
+
}): Promise<MigrationComparisonReference>;
|
|
35
|
+
//# sourceMappingURL=verify-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-history.d.ts","sourceRoot":"","sources":["../src/verify-history.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAA4E,MAAM,iBAAiB,CAAC;AAOzH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEhF,4FAA4F;AAC5F,wBAAgB,iCAAiC,CAAC,MAAM,EAAE;IACxD,QAAQ,CA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2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Migration engine for VibeORM v2 — IR differ, per-dialect DDL, migration runner, introspection",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"orm",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"bun": ">=1.2.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@vibeorm/schema": "2.
|
|
52
|
-
"@vibeorm/sql": "2.
|
|
51
|
+
"@vibeorm/schema": "2.3.0",
|
|
52
|
+
"@vibeorm/sql": "2.3.0"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|