@vibeorm/migrate 2.0.0-alpha.9 → 2.0.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.
Files changed (47) hide show
  1. package/README.md +2 -2
  2. package/dist/ddl/mysql.d.ts.map +1 -1
  3. package/dist/ddl/postgres.d.ts.map +1 -1
  4. package/dist/ddl/rls.d.ts +40 -0
  5. package/dist/ddl/rls.d.ts.map +1 -0
  6. package/dist/ddl/sqlite.d.ts +18 -1
  7. package/dist/ddl/sqlite.d.ts.map +1 -1
  8. package/dist/differ.d.ts +8 -0
  9. package/dist/differ.d.ts.map +1 -1
  10. package/dist/down.d.ts +2 -0
  11. package/dist/down.d.ts.map +1 -1
  12. package/dist/enum-values.d.ts +14 -1
  13. package/dist/enum-values.d.ts.map +1 -1
  14. package/dist/execute.d.ts +62 -4
  15. package/dist/execute.d.ts.map +1 -1
  16. package/dist/execution.d.ts +168 -0
  17. package/dist/execution.d.ts.map +1 -0
  18. package/dist/index.d.ts +8 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +3631 -1960
  21. package/dist/index.js.map +28 -22
  22. package/dist/introspect/mysql.d.ts.map +1 -1
  23. package/dist/introspect/postgres-rls.d.ts +41 -0
  24. package/dist/introspect/postgres-rls.d.ts.map +1 -0
  25. package/dist/introspect/postgres.d.ts +5 -0
  26. package/dist/introspect/postgres.d.ts.map +1 -1
  27. package/dist/introspect/sqlite.d.ts.map +1 -1
  28. package/dist/journal-table.d.ts +15 -0
  29. package/dist/journal-table.d.ts.map +1 -0
  30. package/dist/mysql-types.d.ts.map +1 -1
  31. package/dist/normalize.d.ts +24 -4
  32. package/dist/normalize.d.ts.map +1 -1
  33. package/dist/postgres-types.d.ts.map +1 -1
  34. package/dist/push.d.ts +6 -0
  35. package/dist/push.d.ts.map +1 -1
  36. package/dist/recovery.d.ts +41 -0
  37. package/dist/recovery.d.ts.map +1 -0
  38. package/dist/relations.d.ts +2 -2
  39. package/dist/relations.d.ts.map +1 -1
  40. package/dist/renames.d.ts +58 -0
  41. package/dist/renames.d.ts.map +1 -0
  42. package/dist/runner.d.ts +39 -4
  43. package/dist/runner.d.ts.map +1 -1
  44. package/dist/sqlite-types.d.ts.map +1 -1
  45. package/dist/types.d.ts +98 -2
  46. package/dist/types.d.ts.map +1 -1
  47. package/package.json +3 -3
package/README.md CHANGED
@@ -5,10 +5,10 @@
5
5
  The migration engine: it diffs two schema IRs into dialect-neutral steps, renders those steps as per-dialect DDL, applies them with bookkeeping, and introspects a live database back into IR. It is its own package so that the CLI and tests can run schema changes without pulling in the query runtime, and so every SQL-text decision stays in one reviewable place.
6
6
 
7
7
  ```bash
8
- bun add @vibeorm/migrate@alpha
8
+ bun add @vibeorm/migrate
9
9
  ```
10
10
 
11
- > **Pre-release.** `2.0.0-alpha.x`, published under the `alpha` dist-tag. `npm i vibeorm` still resolves to the stable v1 line.
11
+ > **Stable.** `2.0.0`, published under the `latest` dist-tag. The v1 line stays installable as `vibeorm@1`.
12
12
 
13
13
  Most users never install this directly — it ships as a dependency of [`vibeorm`](https://www.npmjs.com/package/vibeorm) and of the generated client. Reach for it when you are writing an adapter or tooling against the runtime.
14
14
 
@@ -1 +1 @@
1
- {"version":3,"file":"mysql.d.ts","sourceRoot":"","sources":["../../src/ddl/mysql.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,KAAK,EAAmB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAMjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,EAAE,CAAC,EAAE,QAAQ,CAAC;CACf,GAAG,MAAM,EAAE,CAwBX"}
1
+ {"version":3,"file":"mysql.d.ts","sourceRoot":"","sources":["../../src/ddl/mysql.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,KAAK,EAAmB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAMjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,EAAE,CAAC,EAAE,QAAQ,CAAC;CACf,GAAG,MAAM,EAAE,CA0CX"}
@@ -1 +1 @@
1
- {"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/ddl/postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAYH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,GAAG,MAAM,EAAE,CAEzF"}
1
+ {"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/ddl/postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAYH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,GAAG,MAAM,EAAE,CAGzF"}
@@ -0,0 +1,40 @@
1
+ import type { Dialect, ModelIR, SchemaIR } from "@vibeorm/schema";
2
+ import type { MigrationStep } from "../types.ts";
3
+ /** Whether a model requires ENABLE + FORCE and a managed policy. */
4
+ export declare function isRlsProtected(params: {
5
+ model: ModelIR;
6
+ }): boolean;
7
+ /** Parent policies before through children; callers validate acyclic IR first. */
8
+ export declare function orderedRlsModels(params: {
9
+ schema: SchemaIR;
10
+ }): ModelIR[];
11
+ /** RLS declarations refuse on unsupported dialects even when the physical diff is empty. */
12
+ export declare function assertRlsDialect(params: {
13
+ schema: SchemaIR;
14
+ dialect: Dialect;
15
+ }): void;
16
+ /** Compose child-first policy drops, physical DDL, parent-first installations, then explicit removals. */
17
+ export declare function withRlsSteps(params: {
18
+ from: SchemaIR;
19
+ to: SchemaIR;
20
+ steps: readonly MigrationStep[];
21
+ }): MigrationStep[];
22
+ /** Structural step discriminator shared by all three migration renderers. */
23
+ export declare function isRlsStep(params: {
24
+ step: MigrationStep;
25
+ }): boolean;
26
+ /** Dispatch only: absence of a SQL-layer migration renderer is a loud refusal, never synthesized SQL. */
27
+ export declare function renderRlsStep(params: {
28
+ step: MigrationStep;
29
+ dialect: Dialect;
30
+ }): string[];
31
+ /** Human preview of security changes, deliberately separate from destructive data steps. */
32
+ export declare function securityChangesOf(params: {
33
+ steps: readonly MigrationStep[];
34
+ }): string[];
35
+ /** Shared push/apply/rollback refusal. Data-loss flags are intentionally not accepted here. */
36
+ export declare function assertSecurityAcknowledgement(params: {
37
+ securityChanges: readonly string[];
38
+ acceptSecurityChanges?: boolean;
39
+ }): void;
40
+ //# sourceMappingURL=rls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rls.d.ts","sourceRoot":"","sources":["../../src/ddl/rls.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAElE;AAED,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,QAAQ,CAAA;CAAE,GAAG,OAAO,EAAE,CAgBxE;AAED,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAMrF;AAED,0GAA0G;AAC1G,wBAAgB,YAAY,CAAC,MAAM,EAAE;IACnC,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,QAAQ,CAAC;IACb,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;CACjC,GAAG,aAAa,EAAE,CAuDlB;AAED,6EAA6E;AAC7E,wBAAgB,SAAS,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,GAAG,OAAO,CAElE;AAED,yGAAyG;AACzG,wBAAgB,aAAa,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,EAAE,CAmBzF;AAED,4FAA4F;AAC5F,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,GAAG,MAAM,EAAE,CAEvF;AAED,+FAA+F;AAC/F,wBAAgB,6BAA6B,CAAC,MAAM,EAAE;IAAE,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAOnI"}
@@ -20,7 +20,10 @@
20
20
  * no-op inside one), callers must NOT wrap scripts containing it — push and
21
21
  * the runner detect this via `usesSelfManagedTransactions` (execute.ts).
22
22
  * Rebuild blocks are emitted AFTER all other statements so a rebuilt table's
23
- * new FKs can reference tables created earlier in the same script.
23
+ * new FKs can reference tables created earlier in the same script — EXCEPT a
24
+ * rebuild that removes an FK to a table this migration drops, which is hoisted
25
+ * ahead of the drops: sqlite's DROP TABLE cascades into surviving child rows
26
+ * while the FK is still installed (F27).
24
27
  *
25
28
  * Cheap paths are preferred wherever sqlite's plain ALTER suffices:
26
29
  * `ADD COLUMN` (unless the column is required without a literal default, or
@@ -59,4 +62,18 @@ export declare function renderSqliteSteps(params: {
59
62
  from?: SchemaIR;
60
63
  to?: SchemaIR;
61
64
  }): string[];
65
+ /**
66
+ * Tables whose sqlite DDL will DROP and re-create them (the rebuild recipe) or
67
+ * drop them outright — i.e. every table that loses its attached objects.
68
+ * SQLite's `DROP TABLE` takes the table's triggers with it, and the rebuild
69
+ * restores only the core indexes, so callers holding extension artifacts (FTS
70
+ * synchronization triggers) must re-create theirs afterwards (F31).
71
+ */
72
+ export declare function sqliteInvalidatedTables(params: {
73
+ steps: readonly MigrationStep[];
74
+ from?: SchemaIR;
75
+ }): {
76
+ rebuilt: Set<string>;
77
+ dropped: Set<string>;
78
+ };
62
79
  //# sourceMappingURL=sqlite.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/ddl/sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAGH,OAAO,KAAK,EAAmB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAajE,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,aAAa,CAAC;AAI9D;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,EAAE,CAAC,EAAE,QAAQ,CAAC;CACf,GAAG,MAAM,EAAE,CA0LX"}
1
+ {"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/ddl/sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAGH,OAAO,KAAK,EAAmB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAajE,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,aAAa,CAAC;AAK9D;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,EAAE,CAAC,EAAE,QAAQ,CAAC;CACf,GAAG,MAAM,EAAE,CA0NX;AAgED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAC9C,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB,GAAG;IAAE,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAUjD"}
package/dist/differ.d.ts CHANGED
@@ -13,6 +13,7 @@
13
13
  * manual type rebuild, and silence would be dialect dishonesty.
14
14
  */
15
15
  import type { Dialect, SchemaIR } from "@vibeorm/schema";
16
+ import type { RenameIntent } from "./renames.ts";
16
17
  import type { MigrationStep } from "./types.ts";
17
18
  /**
18
19
  * Diff two Schema IRs into an ordered list of dialect-neutral migration steps
@@ -29,5 +30,12 @@ export declare function diffSchemas(params: {
29
30
  from: SchemaIR;
30
31
  to: SchemaIR;
31
32
  dialect?: Dialect;
33
+ /**
34
+ * EXPLICIT physical renames, written down by whoever wants them (renames.ts).
35
+ * Applied to the source schema before the diff runs, so a renamed table or
36
+ * column produces a rename step instead of the drop/create pair the differ
37
+ * would otherwise — correctly — derive. Nothing here is ever inferred.
38
+ */
39
+ renames?: readonly RenameIntent[];
32
40
  }): MigrationStep[];
33
41
  //# sourceMappingURL=differ.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"differ.d.ts","sourceRoot":"","sources":["../src/differ.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAU,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAKjE,OAAO,KAAK,EAAqB,aAAa,EAAE,MAAM,YAAY,CAAC;AAoCnE;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,QAAQ,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,aAAa,EAAE,CA0DlB"}
1
+ {"version":3,"file":"differ.d.ts","sourceRoot":"","sources":["../src/differ.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAU,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAOjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAqB,aAAa,EAAE,MAAM,YAAY,CAAC;AAoCnE;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,QAAQ,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;CACnC,GAAG,aAAa,EAAE,CAmElB"}
package/dist/down.d.ts CHANGED
@@ -29,6 +29,8 @@ export type DownMigrationFile = {
29
29
  readonly sql: readonly string[];
30
30
  /** True when any reverse step can lose data (e.g. dropping an up-added column). */
31
31
  readonly destructive: boolean;
32
+ /** Separate review category: never covered by acceptDataLoss. */
33
+ readonly securityChanges?: readonly string[];
32
34
  /**
33
35
  * Human descriptions of up-changes this down migration cannot reverse
34
36
  * (added enum values, installed postgres extensions). Empty = full reverse.
@@ -1 +1 @@
1
- {"version":3,"file":"down.d.ts","sourceRoot":"","sources":["../src/down.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAU,QAAQ,EAAE,aA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AqB,CAAC,MAAM,EAAE;IAC5C,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,QAAQ,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CACvC,GAAG,iBAAiB,CAwDpB"}
@@ -6,7 +6,7 @@
6
6
  * VALUES do. Column comparison keys and DDL rendering therefore resolve a
7
7
  * field's enum reference to its value list; the name is presentation only.
8
8
  */
9
- import type { EnumIR } from "@vibeorm/schema";
9
+ import type { Dialect, EnumIR, FieldIR } from "@vibeorm/schema";
10
10
  /**
11
11
  * Resolve an enum name to its values. The map is keyed by db name
12
12
  * (`dbName ?? name`, the normalize.ts convention); a schema-side reference by
@@ -16,4 +16,17 @@ export declare function resolveEnumValues(params: {
16
16
  name: string;
17
17
  enums: ReadonlyMap<string, EnumIR>;
18
18
  }): readonly string[] | undefined;
19
+ /** Storage transitions are detected on physical fields, after normalization. */
20
+ export declare function isEnumStringTransition(params: {
21
+ from: FieldIR;
22
+ to: FieldIR;
23
+ }): boolean;
24
+ /** Shared differ/renderer backstop for storage casts that are not yet lossless. */
25
+ export declare function assertEnumStringTransition(params: {
26
+ from: FieldIR;
27
+ to: FieldIR;
28
+ dialect: Dialect;
29
+ table: string;
30
+ column: string;
31
+ }): void;
19
32
  //# sourceMappingURL=enum-values.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"enum-values.d.ts","sourceRoot":"","sources":["../src/enum-values.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAQhC"}
1
+ {"version":3,"file":"enum-values.d.ts","sourceRoot":"","sources":["../src/enum-values.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEhE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAQhC;AAED,gFAAgF;AAChF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAGtF;AAED,mFAAmF;AACnF,wBAAgB,0BAA0B,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAaxI"}
package/dist/execute.d.ts CHANGED
@@ -37,15 +37,73 @@ export declare function usesSelfManagedTransactions(params: {
37
37
  *
38
38
  * This rewinds `start` to the nearest preceding `PRAGMA foreign_keys=OFF` that
39
39
  * is not already closed by a `PRAGMA foreign_keys=ON`. Replaying from a
40
- * block's start is safe: the block is transactional (nothing of it survived a
41
- * crash) and re-running a COMPLETED block is the idempotence the recipe
42
- * already relies on. Scripts with no marker before `start` are returned
43
- * unchanged.
40
+ * block's start is safe only for an uncommitted block: the runner checkpoints
41
+ * past COMMIT inside the transaction, so a committed block is never replayed.
42
+ * Legacy journals pointing AT COMMIT are ambiguous and refused by the runner.
43
+ * Scripts with no marker before `start` are returned unchanged.
44
44
  */
45
45
  export declare function selfManagedResumeStart(params: {
46
46
  sql: readonly string[];
47
47
  start: number;
48
48
  }): number;
49
+ /** True when a supported block must checkpoint BEFORE committing its transaction. */
50
+ export declare function isSelfManagedCommit(params: {
51
+ statement: string;
52
+ }): boolean;
53
+ /**
54
+ * An old writer could persist an index AT COMMIT after the block committed.
55
+ * The new writer checkpoints past it atomically and cannot produce this state.
56
+ * Keep historical uncertainty visible until an operator establishes the result.
57
+ */
58
+ export declare function assertSelfManagedResumeSafe(params: {
59
+ sql: readonly string[];
60
+ start: number;
61
+ migration: string;
62
+ direction: "up" | "down";
63
+ }): void;
64
+ /**
65
+ * Can this statement of a self-managed sqlite script commit together with its
66
+ * own journal checkpoint?
67
+ *
68
+ * True for a statement that sits OUTSIDE every rebuild block and that sqlite
69
+ * allows inside a transaction. Wrapping such a statement with its checkpoint in
70
+ * one `BEGIN`/`COMMIT` closes the crash window entirely: either both landed or
71
+ * neither did, so a resume never has to guess whether it already ran.
72
+ *
73
+ * Block membership is decided by {@link selfManagedResumeStart}, the SAME
74
+ * backward scan the resume path uses — the two can never disagree about where a
75
+ * block starts. Inside a block no wrapping is possible or needed: the block
76
+ * carries its own transaction, so nothing of it survives a crash and
77
+ * `selfManagedResumeStart` rewinds to its opening pragma.
78
+ */
79
+ export declare function canCheckpointAtomically(params: {
80
+ sql: readonly string[];
81
+ index: number;
82
+ }): boolean;
83
+ /**
84
+ * Refuse a self-managed sqlite script whose control flow the resume path
85
+ * cannot honour, BEFORE any statement of it runs.
86
+ *
87
+ * The generated rebuild recipe (ddl/sqlite.ts) always emits
88
+ * `PRAGMA foreign_keys=OFF;` immediately followed by `BEGIN;`, and `COMMIT;`
89
+ * immediately followed by `PRAGMA foreign_keys=ON;`. Recovery relies on that
90
+ * adjacency: it is what makes "inside a foreign-keys-off region" and "inside a
91
+ * transaction" the same statement set, so rewinding to the region's pragma can
92
+ * never replay anything that already committed.
93
+ *
94
+ * A hand-authored script that deviates breaks the equivalence silently. An
95
+ * unclosed pragma, or a statement between `COMMIT;` and the restore, commits on
96
+ * its own while still counting as region-internal, so a crash replays it. That
97
+ * is a data defect with no error attached, so the script is refused up front
98
+ * instead. `resolveMigration` and `migrationStatus` are deliberately not
99
+ * gated by this: an operator must still be able to read and repair the journal
100
+ * row of a migration that is refused.
101
+ */
102
+ export declare function assertSupportedSelfManagedScript(params: {
103
+ sql: readonly string[];
104
+ migration: string;
105
+ direction: "up" | "down";
106
+ }): void;
49
107
  /**
50
108
  * Execute one migration statement. On sqlite, `PRAGMA foreign_key_check` is
51
109
  * executed row-returning and its violations become a VIBE_MIGRATION error.
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../src/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAU9C,2EAA2E;AAC3E,wBAAgB,2BAA2B,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAAG,OAAO,CAEvF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC7C,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,CAST;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE;IAC7C,QAAQ,EAAE,WAAW,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBhB;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,WAAW,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhG"}
1
+ {"version":3,"file":"execute.d.ts","sourceR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AAM,EAAE;IAC7C,QAAQ,EAAE,WAAW,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBhB;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,WAAW,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhG"}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Explicit execution semantics for a migration file: which transaction regime
3
+ * it runs in, which session limits it scopes to its own work, and what each of
4
+ * its statements is DECLARED to do.
5
+ *
6
+ * Why declarations and not SQL parsing: a nontransactional migration can die
7
+ * between a statement committing and the journal recording it. Recovery then
8
+ * has to establish what actually happened, and the only honest way to do that
9
+ * is to compare the live catalog against a declared postcondition. Guessing an
10
+ * operation out of SQL text is exactly the class of bug F29/F33 came from.
11
+ *
12
+ * CHECKSUM COMPATIBILITY — the rule this module exists to protect. A migration
13
+ * with no execution block, or one that asks for nothing beyond today's
14
+ * behaviour, hashes byte-for-byte as before ({@link isDefaultExecution} is
15
+ * true ⇒ {@link executionChecksumSuffix} is empty). Every migration file
16
+ * written before this feature existed therefore keeps its historical checksum
17
+ * and no journal row starts looking corrupt. Only an explicitly non-default
18
+ * block folds a canonical description into the hash, so editing execution
19
+ * semantics after a migration was applied surfaces as the existing
20
+ * checksum-mismatch refusal instead of silently changing how it runs.
21
+ */
22
+ import type { Dialect } from "@vibeorm/schema";
23
+ import type { MigrationStep } from "./types.ts";
24
+ /**
25
+ * How the runner wraps a migration's statements.
26
+ *
27
+ * - `"default"` — the dialect's own regime, unchanged: one transaction per
28
+ * migration on postgres/sqlite, per-statement bookkeeping on mysql.
29
+ * - `"none"` — the migration runs OUTSIDE any transaction the runner opens,
30
+ * with per-statement journal progress. Required for statements PostgreSQL
31
+ * refuses inside a transaction block, `CREATE INDEX CONCURRENTLY` first
32
+ * among them.
33
+ */
34
+ export type MigrationTransactionMode = "default" | "none";
35
+ /**
36
+ * What one statement of a nontransactional migration is declared to do — the
37
+ * postcondition recovery checks against the live catalog. Declared by whoever
38
+ * wrote the migration; never inferred from the SQL text.
39
+ */
40
+ export type MigrationOperation = {
41
+ readonly kind: "createIndexConcurrently";
42
+ readonly index: string;
43
+ readonly table: string;
44
+ readonly unique: boolean;
45
+ /** Access method as PostgreSQL names it (`btree`, `gin`, …). */
46
+ readonly method: string;
47
+ /** Key columns in index order, as PostgreSQL deparses them. */
48
+ readonly columns: readonly string[];
49
+ /** Partial-index predicate, when the index has one. */
50
+ readonly where?: string;
51
+ } | {
52
+ readonly kind: "dropIndexConcurrently";
53
+ readonly index: string;
54
+ } | {
55
+ readonly kind: "addConstraintNotValid";
56
+ readonly table: string;
57
+ readonly constraint: string;
58
+ } | {
59
+ readonly kind: "validateConstraint";
60
+ readonly table: string;
61
+ readonly constraint: string;
62
+ } | {
63
+ readonly kind: "renameTable";
64
+ readonly from: string;
65
+ readonly to: string;
66
+ } | {
67
+ readonly kind: "renameColumn";
68
+ readonly table: string;
69
+ readonly from: string;
70
+ readonly to: string;
71
+ };
72
+ /** One statement's declared operation, keyed by its index in `MigrationFile.sql`. */
73
+ export type MigrationOperationBinding = {
74
+ /** 0-based index into the migration's statement array. */
75
+ readonly statement: number;
76
+ readonly operation: MigrationOperation;
77
+ };
78
+ /** Explicit execution semantics of one direction (up or down) of a migration. */
79
+ export type MigrationExecution = {
80
+ readonly transaction: MigrationTransactionMode;
81
+ /** Migration-owned `lock_timeout` in milliseconds; 0 = no limit (server default). */
82
+ readonly lockTimeoutMs?: number;
83
+ /** Migration-owned `statement_timeout` in milliseconds; 0 = no limit. */
84
+ readonly statementTimeoutMs?: number;
85
+ readonly operations?: readonly MigrationOperationBinding[];
86
+ };
87
+ /** On-disk sidecar filename beside `migration.sql` / `down.sql`. */
88
+ export declare const EXECUTION_SIDECAR_FILENAME: string;
89
+ /** Sidecar format version — bumped only on an incompatible layout change. */
90
+ export declare const EXECUTION_SIDECAR_VERSION: number;
91
+ /** True when the block asks for nothing beyond the dialect's existing behaviour. */
92
+ export declare function isDefaultExecution(params: {
93
+ execution?: MigrationExecution;
94
+ }): boolean;
95
+ /** Deterministic one-line description of an operation — checksum input and error text. */
96
+ export declare function describeOperation(params: {
97
+ operation: MigrationOperation;
98
+ }): string;
99
+ /**
100
+ * The canonical text folded into the migration checksum — EMPTY for a default
101
+ * block, so historical checksums are untouched (see the module doc). The text
102
+ * is built field by field in a fixed order rather than JSON-stringified, so it
103
+ * cannot drift with object key order.
104
+ */
105
+ export declare function executionChecksumSuffix(params: {
106
+ execution?: MigrationExecution;
107
+ }): string;
108
+ /**
109
+ * Structural checks a declared block must pass before the runner trusts it:
110
+ * every operation binding points at a real statement, no statement carries two
111
+ * operations, and the timeouts are non-negative safe integers.
112
+ */
113
+ export declare function assertValidExecution(params: {
114
+ execution?: MigrationExecution;
115
+ statements: number;
116
+ migration: string;
117
+ }): void;
118
+ /** The operation declared for one statement, if any. */
119
+ export declare function operationFor(params: {
120
+ execution?: MigrationExecution;
121
+ statement: number;
122
+ }): MigrationOperation | undefined;
123
+ /**
124
+ * Serialize the execution sidecar, or `undefined` when both directions are
125
+ * default and no file should be written at all. Keeping the file absent for
126
+ * ordinary migrations is what makes the feature invisible to existing trees.
127
+ */
128
+ export declare function serializeExecutionSidecar(params: {
129
+ execution?: MigrationExecution;
130
+ downExecution?: MigrationExecution;
131
+ }): string | undefined;
132
+ /**
133
+ * Read and validate the sidecar. Nothing here is trusted: an unknown version,
134
+ * a malformed body or an out-of-range operation binding refuses rather than
135
+ * silently degrading to default semantics — a migration that believes it runs
136
+ * outside a transaction and quietly runs inside one is exactly the failure
137
+ * this metadata exists to prevent.
138
+ */
139
+ export declare function parseExecutionSidecar(params: {
140
+ text: string;
141
+ migration: string;
142
+ statements: number;
143
+ downStatements: number;
144
+ }): {
145
+ readonly execution?: MigrationExecution;
146
+ readonly downExecution?: MigrationExecution;
147
+ };
148
+ /** A reviewable risk a planned migration carries, for dry-run output. */
149
+ export type MigrationRisk = {
150
+ readonly kind: "tableRewrite" | "exclusiveLock" | "concurrentIndex" | "validateScan" | "notOnline";
151
+ readonly detail: string;
152
+ readonly table?: string;
153
+ };
154
+ /**
155
+ * Describe the operational risk of a planned migration, for dry-run output.
156
+ *
157
+ * Deliberately conservative and deliberately incomplete: it reports what the
158
+ * step model can prove (a type change that rewrites the table on postgres, an
159
+ * ALTER/DROP that takes ACCESS EXCLUSIVE, a validation scan) and it always
160
+ * appends the `notOnline` note, because nothing here — `lock_timeout`
161
+ * included — makes a migration online. A short lock WAIT is not a short lock
162
+ * HOLD.
163
+ */
164
+ export declare function describeMigrationRisks(params: {
165
+ steps: readonly MigrationStep[];
166
+ dialect: Dialect;
167
+ }): readonly MigrationRisk[];
168
+ //# sourceMappingURL=execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIhD;;;;;;;;;GASG;AACH,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1D;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IACE,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,uDAAuD;IACvD,QAAQ,CAAC,KAAK,CAAC,E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Aa,CAAC,EAAE,kBAAkB,CAAA;CAAE,CA0B3F;AAID,yEAAyE;AACzE,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,eAAe,GAAG,iBAAiB,GAAG,cAAc,GAAG,WAAW,CAAC;IACnG,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC7C,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,SAAS,aAAa,EAAE,CAuD3B"}
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * modules live under src/ddl/ and src/introspect/.
10
10
  */
11
11
  export { describeStep } from "./types.ts";
12
- export type { AlterColumnAspect, AppliedResult, IndexColumn, JoinTableEnd, MigrationFile, MigrationStatus, MigrationStep, PushResult, SqlExecutor, } from "./types.ts";
12
+ export type { AlterColumnAspect, AppliedResult, IndexColumn, JoinTableEnd, MigrationFile, MigrationStatus, MigrationStep, PushResult, RecordedMigration, RecordedMigrationState, SqlExecutor, } from "./types.ts";
13
13
  export { diffSchemas } from "./differ.ts";
14
14
  export { detectImplicitM2MPairs } from "./relations.ts";
15
15
  export type { ImplicitM2MPair } from "./relations.ts";
@@ -17,7 +17,13 @@ export { renderSteps } from "./ddl/render.ts";
17
17
  export { introspectPostgres } from "./introspect/postgres.ts";
18
18
  export { introspectSqlite } from "./introspect/sqlite.ts";
19
19
  export { introspectMysql } from "./introspect/mysql.ts";
20
- export { MIGRATIONS_TABLE_NAME, applyMigrations, ensureMigrationsTable, generateMigration, migrationChecksum, migrationStatus, resolveMigration, rollbackMigration, } from "./runner.ts";
20
+ export { MIGRATIONS_TABLE_NAME, applyMigrations, ensureMigrationsTable, generateMigration, migrationChecksum, migrationStatus, recordedMigrations, resolveMigration, rollbackMigration, } from "./runner.ts";
21
+ export { EXECUTION_SIDECAR_FILENAME, EXECUTION_SIDECAR_VERSION, assertValidExecution, describeMigrationRisks, describeOperation, executionChecksumSuffix, isDefaultExecution, operationFor, parseExecutionSidecar, serializeExecutionSidecar, } from "./execution.ts";
22
+ export type { MigrationExecution, MigrationOperation, MigrationOperationBinding, MigrationRisk, MigrationTransactionMode, } from "./execution.ts";
23
+ export { establishOperationState } from "./recovery.ts";
24
+ export type { OperationState } from "./recovery.ts";
25
+ export { planRenames } from "./renames.ts";
26
+ export type { RenameIntent } from "./renames.ts";
21
27
  export { generateDownMigration } from "./down.ts";
22
28
  export type { DownMigrationFile } from "./down.ts";
23
29
  export { pull, push } from "./push.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,eAAe,EACf,aAAa,EACb,UAAU,EACV,WAAW,GACZ,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAItD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,iBAAiB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