@happyvertical/smrt-core 0.36.8 → 0.37.1
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/child-accessors.d.ts +1 -1
- package/dist/child-accessors.d.ts.map +1 -1
- package/dist/child-accessors.js +1 -1
- package/dist/child-accessors.js.map +1 -1
- package/dist/class.d.ts.map +1 -1
- package/dist/class.js +3 -1
- package/dist/class.js.map +1 -1
- package/dist/collection-cache.d.ts.map +1 -1
- package/dist/collection-cache.js +5 -3
- package/dist/collection-cache.js.map +1 -1
- package/dist/collection.d.ts +39 -16
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +40 -19
- package/dist/collection.js.map +1 -1
- package/dist/consumer-plugin/index.js.map +1 -1
- package/dist/decorators/compatibility.d.ts +1 -1
- package/dist/decorators/compatibility.d.ts.map +1 -1
- package/dist/decorators/compatibility.js.map +1 -1
- package/dist/decorators/index.d.ts +4 -4
- package/dist/decorators/index.d.ts.map +1 -1
- package/dist/decorators/index.js.map +1 -1
- package/dist/hierarchical.d.ts.map +1 -1
- package/dist/hierarchical.js.map +1 -1
- package/dist/junction.d.ts.map +1 -1
- package/dist/junction.js.map +1 -1
- package/dist/manifest/discover-smrt-packages.d.ts +10 -0
- package/dist/manifest/discover-smrt-packages.d.ts.map +1 -1
- package/dist/manifest/discover-smrt-packages.js.map +1 -1
- package/dist/manifest/generator.d.ts.map +1 -1
- package/dist/manifest/generator.js +34 -37
- package/dist/manifest/generator.js.map +1 -1
- package/dist/manifest/index.js +2 -2
- package/dist/manifest/index.js.map +1 -1
- package/dist/manifest/manifest-loader.d.ts +10 -0
- package/dist/manifest/manifest-loader.d.ts.map +1 -1
- package/dist/manifest/manifest-loader.js.map +1 -1
- package/dist/manifest/static-manifest.d.ts.map +1 -1
- package/dist/manifest/static-manifest.js +39 -20
- package/dist/manifest/static-manifest.js.map +1 -1
- package/dist/manifest/store.js +2 -2
- package/dist/manifest/store.js.map +1 -1
- package/dist/manifest/test-manifest-stub.d.ts.map +1 -1
- package/dist/manifest/test-manifest-stub.js +2301 -629
- package/dist/manifest/test-manifest-stub.js.map +1 -1
- package/dist/manifest.json +39 -20
- package/dist/migrations/differ.d.ts +104 -13
- package/dist/migrations/differ.d.ts.map +1 -1
- package/dist/migrations/differ.js +199 -26
- package/dist/migrations/differ.js.map +1 -1
- package/dist/node_modules/.pnpm/{minimatch@10.2.3 → minimatch@10.2.5}/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -1
- package/dist/node_modules/.pnpm/{minimatch@10.2.3 → minimatch@10.2.5}/node_modules/minimatch/dist/esm/ast.js +1 -7
- package/dist/node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/esm/ast.js.map +1 -0
- package/dist/node_modules/.pnpm/{minimatch@10.2.3 → minimatch@10.2.5}/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -1
- package/dist/node_modules/.pnpm/{minimatch@10.2.3 → minimatch@10.2.5}/node_modules/minimatch/dist/esm/escape.js.map +1 -1
- package/dist/node_modules/.pnpm/{minimatch@10.2.3 → minimatch@10.2.5}/node_modules/minimatch/dist/esm/index.js +17 -14
- package/dist/node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/esm/index.js.map +1 -0
- package/dist/node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/esm/unescape.js +10 -0
- package/dist/node_modules/.pnpm/{minimatch@10.2.3 → minimatch@10.2.5}/node_modules/minimatch/dist/esm/unescape.js.map +1 -1
- package/dist/object.d.ts +64 -17
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +76 -30
- package/dist/object.js.map +1 -1
- package/dist/registry/class-registration.d.ts +3 -3
- package/dist/registry/class-registration.d.ts.map +1 -1
- package/dist/registry/class-registration.js +39 -42
- package/dist/registry/class-registration.js.map +1 -1
- package/dist/registry/inheritance-resolver.d.ts +17 -3
- package/dist/registry/inheritance-resolver.d.ts.map +1 -1
- package/dist/registry/inheritance-resolver.js +1 -1
- package/dist/registry/inheritance-resolver.js.map +1 -1
- package/dist/registry/manifest-field-merge.d.ts +17 -3
- package/dist/registry/manifest-field-merge.d.ts.map +1 -1
- package/dist/registry/manifest-field-merge.js +8 -6
- package/dist/registry/manifest-field-merge.js.map +1 -1
- package/dist/registry/schema-builder.d.ts +1 -1
- package/dist/registry/schema-builder.d.ts.map +1 -1
- package/dist/registry/schema-builder.js.map +1 -1
- package/dist/registry/shared-state.d.ts +3 -3
- package/dist/registry/shared-state.d.ts.map +1 -1
- package/dist/registry/shared-state.js.map +1 -1
- package/dist/registry/types.d.ts +78 -19
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry/validator.d.ts +2 -1
- package/dist/registry/validator.d.ts.map +1 -1
- package/dist/registry/validator.js +38 -39
- package/dist/registry/validator.js.map +1 -1
- package/dist/registry.d.ts +84 -57
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +31 -25
- package/dist/registry.js.map +1 -1
- package/dist/scanner/manifest-generator.d.ts.map +1 -1
- package/dist/scanner/manifest-generator.js +22 -20
- package/dist/scanner/manifest-generator.js.map +1 -1
- package/dist/smrt-knowledge.json +8 -7
- package/dist/system-fields.d.ts +1 -1
- package/dist/system-fields.d.ts.map +1 -1
- package/dist/system-fields.js.map +1 -1
- package/dist/vite-plugin/index.js +1 -1
- package/package.json +7 -7
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/ast.js.map +0 -1
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/index.js.map +0 -1
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/unescape.js +0 -10
- /package/dist/node_modules/.pnpm/{minimatch@10.2.3 → minimatch@10.2.5}/node_modules/minimatch/dist/esm/assert-valid-pattern.js +0 -0
- /package/dist/node_modules/.pnpm/{minimatch@10.2.3 → minimatch@10.2.5}/node_modules/minimatch/dist/esm/brace-expressions.js +0 -0
- /package/dist/node_modules/.pnpm/{minimatch@10.2.3 → minimatch@10.2.5}/node_modules/minimatch/dist/esm/escape.js +0 -0
package/dist/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "1.0.0",
|
|
3
|
-
"timestamp":
|
|
3
|
+
"timestamp": 1782792357137,
|
|
4
4
|
"packageName": "@happyvertical/smrt-core",
|
|
5
|
-
"packageVersion": "0.
|
|
5
|
+
"packageVersion": "0.37.1",
|
|
6
6
|
"objects": {
|
|
7
7
|
"@happyvertical/smrt-core:SmrtClass": {
|
|
8
8
|
"name": "smrtclass",
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
"parameters": [
|
|
236
236
|
{
|
|
237
237
|
"name": "filter",
|
|
238
|
-
"type": "string |
|
|
238
|
+
"type": "string | SmrtWhereClause<ModelType>",
|
|
239
239
|
"optional": false
|
|
240
240
|
},
|
|
241
241
|
{
|
|
@@ -268,12 +268,12 @@
|
|
|
268
268
|
"parameters": [
|
|
269
269
|
{
|
|
270
270
|
"name": "data",
|
|
271
|
-
"type": "
|
|
271
|
+
"type": "Record<string>",
|
|
272
272
|
"optional": false
|
|
273
273
|
},
|
|
274
274
|
{
|
|
275
275
|
"name": "defaults",
|
|
276
|
-
"type": "
|
|
276
|
+
"type": "Record<string>",
|
|
277
277
|
"optional": true
|
|
278
278
|
}
|
|
279
279
|
],
|
|
@@ -287,16 +287,16 @@
|
|
|
287
287
|
"parameters": [
|
|
288
288
|
{
|
|
289
289
|
"name": "existing",
|
|
290
|
-
"type": "Record<string
|
|
290
|
+
"type": "SmrtObject | Record<string>",
|
|
291
291
|
"optional": false
|
|
292
292
|
},
|
|
293
293
|
{
|
|
294
294
|
"name": "data",
|
|
295
|
-
"type": "Record<string
|
|
295
|
+
"type": "Record<string>",
|
|
296
296
|
"optional": false
|
|
297
297
|
}
|
|
298
298
|
],
|
|
299
|
-
"returnType": "Promise<Record<string
|
|
299
|
+
"returnType": "Promise<Record<string> | null>",
|
|
300
300
|
"isStatic": false,
|
|
301
301
|
"isPublic": true
|
|
302
302
|
},
|
|
@@ -304,7 +304,7 @@
|
|
|
304
304
|
"name": "getFields",
|
|
305
305
|
"async": true,
|
|
306
306
|
"parameters": [],
|
|
307
|
-
"returnType": "
|
|
307
|
+
"returnType": "Promise<Record<string, CollectionFieldDefinition>>",
|
|
308
308
|
"isStatic": false,
|
|
309
309
|
"isPublic": true
|
|
310
310
|
},
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
"name": "getFieldsSync",
|
|
313
313
|
"async": false,
|
|
314
314
|
"parameters": [],
|
|
315
|
-
"returnType": "Record<string,
|
|
315
|
+
"returnType": "Record<string, CollectionFieldDefinition>",
|
|
316
316
|
"isStatic": false,
|
|
317
317
|
"isPublic": true
|
|
318
318
|
},
|
|
@@ -379,7 +379,7 @@
|
|
|
379
379
|
},
|
|
380
380
|
{
|
|
381
381
|
"name": "params",
|
|
382
|
-
"type": "any
|
|
382
|
+
"type": "any",
|
|
383
383
|
"optional": true
|
|
384
384
|
},
|
|
385
385
|
{
|
|
@@ -416,7 +416,7 @@
|
|
|
416
416
|
"optional": false
|
|
417
417
|
}
|
|
418
418
|
],
|
|
419
|
-
"returnType": "Promise
|
|
419
|
+
"returnType": "Promise",
|
|
420
420
|
"isStatic": false,
|
|
421
421
|
"isPublic": true
|
|
422
422
|
},
|
|
@@ -430,7 +430,7 @@
|
|
|
430
430
|
"optional": true
|
|
431
431
|
}
|
|
432
432
|
],
|
|
433
|
-
"returnType": "Promise<Map<string
|
|
433
|
+
"returnType": "Promise<Map<string>>",
|
|
434
434
|
"isStatic": false,
|
|
435
435
|
"isPublic": true
|
|
436
436
|
},
|
|
@@ -827,7 +827,7 @@
|
|
|
827
827
|
"parameters": [
|
|
828
828
|
{
|
|
829
829
|
"name": "data",
|
|
830
|
-
"type": "
|
|
830
|
+
"type": "Record<string>",
|
|
831
831
|
"optional": false
|
|
832
832
|
}
|
|
833
833
|
],
|
|
@@ -839,7 +839,7 @@
|
|
|
839
839
|
"name": "getFields",
|
|
840
840
|
"async": true,
|
|
841
841
|
"parameters": [],
|
|
842
|
-
"returnType": "any",
|
|
842
|
+
"returnType": "Promise<any>",
|
|
843
843
|
"isStatic": false,
|
|
844
844
|
"isPublic": true
|
|
845
845
|
},
|
|
@@ -948,7 +948,7 @@
|
|
|
948
948
|
},
|
|
949
949
|
{
|
|
950
950
|
"name": "options",
|
|
951
|
-
"type": "
|
|
951
|
+
"type": "AiOperationOptions",
|
|
952
952
|
"optional": true
|
|
953
953
|
}
|
|
954
954
|
],
|
|
@@ -967,7 +967,7 @@
|
|
|
967
967
|
},
|
|
968
968
|
{
|
|
969
969
|
"name": "options",
|
|
970
|
-
"type": "
|
|
970
|
+
"type": "AiOperationOptions",
|
|
971
971
|
"optional": true
|
|
972
972
|
}
|
|
973
973
|
],
|
|
@@ -981,7 +981,7 @@
|
|
|
981
981
|
"parameters": [
|
|
982
982
|
{
|
|
983
983
|
"name": "options",
|
|
984
|
-
"type": "
|
|
984
|
+
"type": "AiOperationOptions",
|
|
985
985
|
"optional": true
|
|
986
986
|
}
|
|
987
987
|
],
|
|
@@ -1011,6 +1011,25 @@
|
|
|
1011
1011
|
"isStatic": false,
|
|
1012
1012
|
"isPublic": true
|
|
1013
1013
|
},
|
|
1014
|
+
"_setLoadedRelationship": {
|
|
1015
|
+
"name": "_setLoadedRelationship",
|
|
1016
|
+
"async": false,
|
|
1017
|
+
"parameters": [
|
|
1018
|
+
{
|
|
1019
|
+
"name": "fieldName",
|
|
1020
|
+
"type": "string",
|
|
1021
|
+
"optional": false
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
"name": "value",
|
|
1025
|
+
"type": "any",
|
|
1026
|
+
"optional": false
|
|
1027
|
+
}
|
|
1028
|
+
],
|
|
1029
|
+
"returnType": "void",
|
|
1030
|
+
"isStatic": false,
|
|
1031
|
+
"isPublic": true
|
|
1032
|
+
},
|
|
1014
1033
|
"loadRelated": {
|
|
1015
1034
|
"name": "loadRelated",
|
|
1016
1035
|
"async": true,
|
|
@@ -1114,7 +1133,7 @@
|
|
|
1114
1133
|
"optional": false
|
|
1115
1134
|
}
|
|
1116
1135
|
],
|
|
1117
|
-
"returnType": "Promise
|
|
1136
|
+
"returnType": "Promise",
|
|
1118
1137
|
"isStatic": false,
|
|
1119
1138
|
"isPublic": true
|
|
1120
1139
|
},
|
|
@@ -1128,7 +1147,7 @@
|
|
|
1128
1147
|
"optional": true
|
|
1129
1148
|
}
|
|
1130
1149
|
],
|
|
1131
|
-
"returnType": "Promise<Map<string
|
|
1150
|
+
"returnType": "Promise<Map<string>>",
|
|
1132
1151
|
"isStatic": false,
|
|
1133
1152
|
"isPublic": true
|
|
1134
1153
|
},
|
|
@@ -29,6 +29,35 @@ export interface DiffOptions {
|
|
|
29
29
|
*/
|
|
30
30
|
engineHint?: string;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Normalize a partial-index `WHERE` predicate so semantically-identical
|
|
34
|
+
* clauses from different sources compare equal (issue #1692).
|
|
35
|
+
*
|
|
36
|
+
* The manifest stores predicates roughly as written (`_meta_type = 'Article'`),
|
|
37
|
+
* SQLite/DuckDB echo the original CREATE INDEX text verbatim, and PostgreSQL
|
|
38
|
+
* re-renders them with type casts and extra parentheses
|
|
39
|
+
* (`((_meta_type)::text = 'Article'::text)`). Normalization:
|
|
40
|
+
*
|
|
41
|
+
* - strips a leading `WHERE` keyword,
|
|
42
|
+
* - removes PostgreSQL `::type` casts (single-word type names — the only kind
|
|
43
|
+
* SMRT-generated partial predicates produce, e.g. `_meta_type::text`),
|
|
44
|
+
* - removes parentheses (SMRT only emits simple `col = 'literal'` predicates,
|
|
45
|
+
* so grouping carries no meaning here),
|
|
46
|
+
* - lowercases everything OUTSIDE single-quoted string literals (SQL keywords
|
|
47
|
+
* and identifiers are case-insensitive; literals such as STI discriminator
|
|
48
|
+
* class names are case-sensitive, so they are preserved verbatim),
|
|
49
|
+
* - collapses whitespace and tightens spacing around comparison operators.
|
|
50
|
+
*
|
|
51
|
+
* Returns '' for an absent/empty predicate (i.e. a non-partial index).
|
|
52
|
+
*/
|
|
53
|
+
export declare function normalizeIndexPredicate(where?: string | null): string;
|
|
54
|
+
/**
|
|
55
|
+
* Extract the normalized partial-index predicate from a `CREATE INDEX`
|
|
56
|
+
* statement — the `WHERE` tail that follows the column-list close paren.
|
|
57
|
+
* Works for both SQLite/DuckDB `sqlite_master.sql` text and PostgreSQL
|
|
58
|
+
* `pg_indexes.indexdef`. Returns '' for a non-partial index.
|
|
59
|
+
*/
|
|
60
|
+
export declare function extractIndexPredicate(createIndexSql: string): string;
|
|
32
61
|
/**
|
|
33
62
|
* SchemaComparer class for comparing manifest schemas to database
|
|
34
63
|
*/
|
|
@@ -55,7 +84,7 @@ export declare class SchemaComparer {
|
|
|
55
84
|
/**
|
|
56
85
|
* Compare indexes between manifest and database
|
|
57
86
|
*
|
|
58
|
-
*
|
|
87
|
+
* Four classes of drift the differ now detects:
|
|
59
88
|
*
|
|
60
89
|
* 1. **Missing index** — manifest has an index neither the DB has by name
|
|
61
90
|
* nor any equivalent-by-signature. Emit `add_index`. (Issue #741: the
|
|
@@ -63,11 +92,13 @@ export declare class SchemaComparer {
|
|
|
63
92
|
* classes register indexes with different name prefixes.)
|
|
64
93
|
*
|
|
65
94
|
* 2. **Same-name shape drift** — DB has an index with the manifest's name,
|
|
66
|
-
* but its columns
|
|
67
|
-
* in issue #1165
|
|
68
|
-
* non-unique
|
|
69
|
-
*
|
|
70
|
-
*
|
|
95
|
+
* but its columns, uniqueness flag, or partial-index `WHERE` predicate
|
|
96
|
+
* differ. This covers the uniqueness flip in issue #1165
|
|
97
|
+
* (`tenants_slug_context_meta_type_idx` materialized non-unique while
|
|
98
|
+
* the manifest declares it unique) and the predicate drift in issue
|
|
99
|
+
* #1692 (a partial index whose `WHERE` clause was added, removed, or
|
|
100
|
+
* altered). Emit `drop_index` + `add_index` so the next migrate cycle
|
|
101
|
+
* recreates it with the correct shape.
|
|
71
102
|
*
|
|
72
103
|
* 3. **Orphan in DB** — DB has an index with no manifest counterpart by
|
|
73
104
|
* name and no signature equivalent. Emit `drop_index` *only* when the
|
|
@@ -75,20 +106,36 @@ export declare class SchemaComparer {
|
|
|
75
106
|
* PostgreSQL implicit indexes (`*_pkey`, `*_key`) — those are owned by
|
|
76
107
|
* table-level constraints and need a separate `DROP CONSTRAINT` path
|
|
77
108
|
* that the differ does not emit yet.
|
|
109
|
+
*
|
|
110
|
+
* 4. **Partial-index predicate drift / collision** — two indexes on the
|
|
111
|
+
* same column(s) and uniqueness that differ only by their `WHERE`
|
|
112
|
+
* predicate (e.g. distinct STI child partial indexes) are no longer
|
|
113
|
+
* collapsed to one signature, so the signature-equivalence path (b)
|
|
114
|
+
* won't claim one for the other.
|
|
115
|
+
*
|
|
116
|
+
* @param dbIndexPredicates - Normalized `WHERE` predicate per DB index
|
|
117
|
+
* name from {@link getDbIndexPredicates}. `null` means predicate
|
|
118
|
+
* introspection was unavailable for this engine/adapter, in which case
|
|
119
|
+
* the comparison falls back to predicate-unaware signatures (the prior
|
|
120
|
+
* behavior) so existing partial indexes are never flagged as false drift.
|
|
78
121
|
*/
|
|
79
122
|
private compareIndexes;
|
|
80
123
|
/**
|
|
81
|
-
* Generate a signature for an index based on its columns and
|
|
82
|
-
* Used for functional equivalence
|
|
124
|
+
* Generate a signature for an index based on its columns, uniqueness, and
|
|
125
|
+
* (normalized) partial-index predicate. Used for functional equivalence
|
|
126
|
+
* checking (Issue #741) and predicate-drift detection (Issue #1692).
|
|
83
127
|
*
|
|
84
128
|
* Note: Column order is preserved because it is semantically significant for
|
|
85
129
|
* composite indexes. An index on (a, b) is NOT equivalent to (b, a) - they
|
|
86
130
|
* have different query performance characteristics.
|
|
87
131
|
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
132
|
+
* The trailing predicate component distinguishes partial indexes that share
|
|
133
|
+
* columns and uniqueness but differ by their `WHERE` clause (e.g. distinct
|
|
134
|
+
* STI child partial indexes). Callers pass the already-normalized predicate
|
|
135
|
+
* so both the manifest (desired) and introspected (DB) sides compare equal
|
|
136
|
+
* for semantically-identical clauses. An empty string means "no predicate"
|
|
137
|
+
* (a non-partial index) and is also used on both sides when predicate
|
|
138
|
+
* introspection is unavailable, preserving the prior behavior.
|
|
92
139
|
*
|
|
93
140
|
* For JSON-path indexes (`@meta({ indexed: true })`) the signature is
|
|
94
141
|
* derived from the JSON path instead of an empty column list, so the
|
|
@@ -96,9 +143,44 @@ export declare class SchemaComparer {
|
|
|
96
143
|
*
|
|
97
144
|
* @param idxOrColumns - Either an IndexDefinition or a column array (legacy)
|
|
98
145
|
* @param uniqueArg - Unique flag (used when first arg is a column array)
|
|
146
|
+
* @param predicateArg - Normalized partial-index predicate (default '')
|
|
99
147
|
* @returns Signature string
|
|
100
148
|
*/
|
|
101
149
|
private getIndexSignature;
|
|
150
|
+
/**
|
|
151
|
+
* Whether the active engine supports partial indexes (`CREATE INDEX … WHERE`).
|
|
152
|
+
*
|
|
153
|
+
* SQLite and PostgreSQL do. DuckDB rejects them outright, and the JSON
|
|
154
|
+
* adapter is DuckDB-backed, so on those engines a "partial" index can only
|
|
155
|
+
* ever exist as a full index. Treating the predicate as significant there
|
|
156
|
+
* would (a) flag existing full indexes as false drift and (b) emit
|
|
157
|
+
* `CREATE INDEX … WHERE` DDL the engine rejects, breaking the migration.
|
|
158
|
+
* Gating on this keeps both the comparison and the generated DDL aligned
|
|
159
|
+
* with what the engine actually accepts (a partial index degrades to a
|
|
160
|
+
* full index), matching the pre-#1692 behavior on those engines.
|
|
161
|
+
*/
|
|
162
|
+
private supportsPartialIndexes;
|
|
163
|
+
/**
|
|
164
|
+
* Introspect partial-index predicates for a table, keyed by index name.
|
|
165
|
+
*
|
|
166
|
+
* `getTableSchema()` (the @happyvertical/sql introspection) returns only
|
|
167
|
+
* name/columns/unique, so the `WHERE` predicate is read directly here:
|
|
168
|
+
*
|
|
169
|
+
* - PostgreSQL: `pg_indexes.indexdef` carries the full CREATE INDEX text.
|
|
170
|
+
* - SQLite: the `sqlite_master.sql` column carries the original CREATE INDEX
|
|
171
|
+
* text.
|
|
172
|
+
*
|
|
173
|
+
* Engines that don't support partial indexes (DuckDB / the DuckDB-backed
|
|
174
|
+
* JSON adapter) short-circuit to `null` so the comparison stays
|
|
175
|
+
* predicate-unaware there — see {@link supportsPartialIndexes}.
|
|
176
|
+
*
|
|
177
|
+
* Non-partial indexes are omitted from the map (callers treat a missing
|
|
178
|
+
* entry as the empty predicate). Returns `null` when the catalog query
|
|
179
|
+
* fails — e.g. an adapter exposing neither catalog — so the index
|
|
180
|
+
* comparison can fall back to predicate-unaware behavior rather than
|
|
181
|
+
* flagging every existing partial index as false drift.
|
|
182
|
+
*/
|
|
183
|
+
private getDbIndexPredicates;
|
|
102
184
|
/**
|
|
103
185
|
* Get list of existing tables from database
|
|
104
186
|
*/
|
|
@@ -152,7 +234,16 @@ export declare class SchemaComparer {
|
|
|
152
234
|
*/
|
|
153
235
|
private generateDropColumnSQL;
|
|
154
236
|
/**
|
|
155
|
-
* Generate SQL for adding an index
|
|
237
|
+
* Generate SQL for adding an index.
|
|
238
|
+
*
|
|
239
|
+
* On engines that support partial indexes (SQLite/PostgreSQL) this mirrors
|
|
240
|
+
* the canonical CREATE INDEX path in the DDL strategies: a partial index
|
|
241
|
+
* appends its `WHERE` predicate so a detected predicate add/alter (issue
|
|
242
|
+
* #1692) recreates the index with the correct partial condition rather than
|
|
243
|
+
* silently widening it to a full index. On DuckDB / the JSON adapter — which
|
|
244
|
+
* reject partial indexes — the predicate is dropped so the emitted DDL stays
|
|
245
|
+
* executable (a partial index degrades to a full index there). The predicate
|
|
246
|
+
* is trimmed and a redundant leading `WHERE` stripped for robustness.
|
|
156
247
|
*/
|
|
157
248
|
private generateAddIndexSQL;
|
|
158
249
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"differ.d.ts","sourceRoot":"","sources":["../../src/migrations/differ.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAGV,YAAY,EACZ,gBAAgB,EAChB,UAAU,EAEX,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,iBAAiB,EAAsB,MAAM,YAAY,CAAC;AA8BxE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iEAAiE;IACjE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,kEAAkE;IAClE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;;;OAOG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iDAAiD;IACjD,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAuBD;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,EAAE,CAAoB;IAC9B,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,WAAW,CAAoC;gBAE3C,EAAE,EAAE,iBAAiB,EAAE,OAAO,GAAE,WAAgB;IAsB5D;;OAEG;IACG,OAAO,CACX,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAChD,OAAO,CAAC,UAAU,CAAC;IA4CtB;;OAEG;IACG,YAAY,CAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,YAAY,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"differ.d.ts","sourceRoot":"","sources":["../../src/migrations/differ.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAGV,YAAY,EACZ,gBAAgB,EAChB,UAAU,EAEX,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,iBAAiB,EAAsB,MAAM,YAAY,CAAC;AA8BxE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1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