@vibeorm/migrate 2.0.0-alpha.1 → 2.0.0-alpha.3
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/index.js +68 -23
- package/dist/index.js.map +6 -6
- package/dist/introspect/postgres.d.ts.map +1 -1
- package/dist/introspect/shared.d.ts +6 -1
- package/dist/introspect/shared.d.ts.map +1 -1
- package/dist/postgres-types.d.ts +8 -1
- package/dist/postgres-types.d.ts.map +1 -1
- package/dist/relations.d.ts +14 -4
- package/dist/relations.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/introspect/postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAQV,QAAQ,EACT,MAAM,iBAAiB,CAAC;AASzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/introspect/postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAQV,QAAQ,EACT,MAAM,iBAAiB,CAAC;AASzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAsK/C,gFAAgF;AAChF,wBAAsB,kBAAkB,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,WAAW,CAAA;CAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAwK7F"}
|
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
* consumer). Every dialect introspector produces the same representation:
|
|
6
6
|
*
|
|
7
7
|
* - FKs become an UNNAMED `manyToOne` on the owning model plus an UNNAMED
|
|
8
|
-
* `oneToMany` list side on the target
|
|
8
|
+
* `oneToMany` list side on the target — EXCEPT when the model pair carries
|
|
9
|
+
* more than one unnamed relation pair (mutual FKs, twin FKs to one target,
|
|
10
|
+
* an FK alongside a default-named join table): those FK pairs get a
|
|
11
|
+
* synthesized `@relation` name so `db pull` output re-parses (the parser
|
|
12
|
+
* rejects the unnamed shape as `ambiguous-relation`) and implicit-M2M
|
|
13
|
+
* detection keeps its name keys unique.
|
|
9
14
|
* - A table matching the implicit join-table shape (name `_X`, exactly columns
|
|
10
15
|
* "A" and "B", two single-column FKs, a unique index on (A, B)) is NOT a
|
|
11
16
|
* model: it becomes two unnamed `oneToMany` list sides on the joined models,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/introspect/shared.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/introspect/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAc,MAAM,iBAAiB,CAAC;AAI1E,sEAAsE;AACtE,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,qEAAqE;AACrE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC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normalizeNativeType(params: {
|
|
|
21
21
|
/**
|
|
22
22
|
* Comparison key for a column's type. Two columns with equal keys need no
|
|
23
23
|
* ALTER. A native type equal to the scalar's canonical mapping is dropped, so
|
|
24
|
-
* `DateTime` and `DateTime @db.Timestamptz
|
|
24
|
+
* `DateTime` and `DateTime @db.Timestamptz` compare equal — and so do the
|
|
25
|
+
* mapping's `CANONICAL_EQUIVALENTS` (`@db.Timestamptz(6)`, the same type
|
|
26
|
+
* spelled explicitly, and `@db.Timestamptz(3)`, what the 2.0 alphas created).
|
|
27
|
+
* Any other precision stays distinct and still diffs.
|
|
25
28
|
*/
|
|
26
29
|
export declare function columnTypeKey(params: {
|
|
27
30
|
field: FieldIR;
|
|
@@ -62,6 +65,10 @@ export declare function defaultFingerprint(params: {
|
|
|
62
65
|
export declare function defaultSql(params: {
|
|
63
66
|
field: FieldIR;
|
|
64
67
|
}): string | undefined;
|
|
68
|
+
/** True for scalars whose defaults postgres reports back as numeric literals. */
|
|
69
|
+
export declare function isNumericScalar(params: {
|
|
70
|
+
type: ScalarType;
|
|
71
|
+
}): boolean;
|
|
65
72
|
/**
|
|
66
73
|
* `pg_constraint.confdeltype` / `confupdtype` single-char codes → IR actions
|
|
67
74
|
* (used by the introspector).
|
|
@@ -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;AAK1E,kDAAkD;AAClD,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAU7D,CAAC;AA+
|
|
1
|
+
{"version":3,"file":"postgres-types.d.ts","sourceRoot":"","sources":["../src/postgres-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,OAA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B,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/relations.d.ts
CHANGED
|
@@ -5,10 +5,20 @@
|
|
|
5
5
|
* `findImplicitM2MCounterpart` (see LEARNINGS): two relation fields form an
|
|
6
6
|
* implicit M:N **iff** both are lists that declare no FK columns, they are
|
|
7
7
|
* distinct fields (self-exclusion — a 1:N self-relation must never pair with
|
|
8
|
-
* itself),
|
|
9
|
-
* the same name)
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* itself), their relation names match symmetrically (both unnamed, or both
|
|
9
|
+
* the same name), and each side is the OTHER'S SOLE counterpart under that
|
|
10
|
+
* name key. Detection never reads `relation.type`, because an introspected
|
|
11
|
+
* schema represents a real join table as two unnamed `oneToMany` list sides —
|
|
12
|
+
* trusting the type would break round-trip stability.
|
|
13
|
+
*
|
|
14
|
+
* The sole-counterpart requirement is the phantom-join-table fix, round two:
|
|
15
|
+
* two models holding foreign keys INTO EACH OTHER introspect as an unnamed
|
|
16
|
+
* fieldless list on each side (every FK synthesizes one on its target), and
|
|
17
|
+
* name-matching alone would marry those lists into a join table that exists
|
|
18
|
+
* nowhere. Counting EVERY relation under the name key — FK-owning sides
|
|
19
|
+
* included — disambiguates: the parser rejects the same shape as
|
|
20
|
+
* `ambiguous-relation` at parse time, so parsed and introspected schemas
|
|
21
|
+
* resolve identically.
|
|
12
22
|
*
|
|
13
23
|
* The join-table naming itself comes from the ONE shared convention in
|
|
14
24
|
* `@vibeorm/schema` (`implicitJoinTable`) — never re-derived here.
|
package/dist/relations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relations.d.ts","sourceRoot":"","sources":["../src/relations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"relations.d.ts","sourceRoot":"","sources":["../src/relations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,KAAK,EAAuB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAErE,iFAAiF;AACjF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,2DAA2D;AAC3D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,QAAQ,CAAA;CAAE,GAAG,eAAe,EAAE,CAwCtF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibeorm/migrate",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.3",
|
|
4
4
|
"description": "Migration engine for VibeORM v2 — IR differ, per-dialect DDL, migration runner, introspection",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"orm",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"bun": ">=1.2.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@vibeorm/schema": "2.0.0-alpha.
|
|
47
|
-
"@vibeorm/sql": "2.0.0-alpha.
|
|
46
|
+
"@vibeorm/schema": "2.0.0-alpha.2",
|
|
47
|
+
"@vibeorm/sql": "2.0.0-alpha.2"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|