@warlock.js/cascade 4.0.132 → 4.0.134
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/cjs/contracts/migration-driver.contract.d.ts +82 -1
- package/cjs/contracts/migration-driver.contract.d.ts.map +1 -1
- package/cjs/drivers/mongodb/mongodb-driver.d.ts +12 -0
- package/cjs/drivers/mongodb/mongodb-driver.d.ts.map +1 -1
- package/cjs/drivers/mongodb/mongodb-driver.js +26 -4
- package/cjs/drivers/mongodb/mongodb-driver.js.map +1 -1
- package/cjs/drivers/mongodb/mongodb-migration-driver.d.ts +48 -1
- package/cjs/drivers/mongodb/mongodb-migration-driver.d.ts.map +1 -1
- package/cjs/drivers/mongodb/mongodb-migration-driver.js +79 -0
- package/cjs/drivers/mongodb/mongodb-migration-driver.js.map +1 -1
- package/cjs/drivers/postgres/postgres-migration-driver.d.ts +60 -1
- package/cjs/drivers/postgres/postgres-migration-driver.d.ts.map +1 -1
- package/cjs/drivers/postgres/postgres-migration-driver.js +257 -27
- package/cjs/drivers/postgres/postgres-migration-driver.js.map +1 -1
- package/cjs/migration/column-builder.d.ts +227 -6
- package/cjs/migration/column-builder.d.ts.map +1 -1
- package/cjs/migration/column-builder.js +325 -4
- package/cjs/migration/column-builder.js.map +1 -1
- package/cjs/migration/foreign-key-builder.d.ts +10 -17
- package/cjs/migration/foreign-key-builder.d.ts.map +1 -1
- package/cjs/migration/foreign-key-builder.js +11 -19
- package/cjs/migration/foreign-key-builder.js.map +1 -1
- package/cjs/migration/migration.d.ts +274 -16
- package/cjs/migration/migration.d.ts.map +1 -1
- package/cjs/migration/migration.js +329 -32
- package/cjs/migration/migration.js.map +1 -1
- package/cjs/test-migrations/test-enhanced-features.migration.d.ts +15 -0
- package/cjs/test-migrations/test-enhanced-features.migration.d.ts.map +1 -0
- package/esm/contracts/migration-driver.contract.d.ts +82 -1
- package/esm/contracts/migration-driver.contract.d.ts.map +1 -1
- package/esm/drivers/mongodb/mongodb-driver.d.ts +12 -0
- package/esm/drivers/mongodb/mongodb-driver.d.ts.map +1 -1
- package/esm/drivers/mongodb/mongodb-driver.js +26 -4
- package/esm/drivers/mongodb/mongodb-driver.js.map +1 -1
- package/esm/drivers/mongodb/mongodb-migration-driver.d.ts +48 -1
- package/esm/drivers/mongodb/mongodb-migration-driver.d.ts.map +1 -1
- package/esm/drivers/mongodb/mongodb-migration-driver.js +79 -0
- package/esm/drivers/mongodb/mongodb-migration-driver.js.map +1 -1
- package/esm/drivers/postgres/postgres-migration-driver.d.ts +60 -1
- package/esm/drivers/postgres/postgres-migration-driver.d.ts.map +1 -1
- package/esm/drivers/postgres/postgres-migration-driver.js +257 -27
- package/esm/drivers/postgres/postgres-migration-driver.js.map +1 -1
- package/esm/migration/column-builder.d.ts +227 -6
- package/esm/migration/column-builder.d.ts.map +1 -1
- package/esm/migration/column-builder.js +325 -4
- package/esm/migration/column-builder.js.map +1 -1
- package/esm/migration/foreign-key-builder.d.ts +10 -17
- package/esm/migration/foreign-key-builder.d.ts.map +1 -1
- package/esm/migration/foreign-key-builder.js +11 -19
- package/esm/migration/foreign-key-builder.js.map +1 -1
- package/esm/migration/migration.d.ts +274 -16
- package/esm/migration/migration.d.ts.map +1 -1
- package/esm/migration/migration.js +329 -32
- package/esm/migration/migration.js.map +1 -1
- package/esm/test-migrations/test-enhanced-features.migration.d.ts +15 -0
- package/esm/test-migrations/test-enhanced-features.migration.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ColumnDefinition, ColumnType } from "../contracts/migration-driver.contract";
|
|
1
|
+
import type { ColumnDefinition, ColumnType, ForeignKeyDefinition } from "../contracts/migration-driver.contract";
|
|
2
2
|
/**
|
|
3
3
|
* Reference to the Migration type to avoid circular imports.
|
|
4
4
|
* The actual type is injected at runtime.
|
|
@@ -8,6 +8,7 @@ type MigrationLike = {
|
|
|
8
8
|
columns: string[];
|
|
9
9
|
unique?: boolean;
|
|
10
10
|
}): void;
|
|
11
|
+
addForeignKeyOperation(fk: ForeignKeyDefinition): void;
|
|
11
12
|
};
|
|
12
13
|
/**
|
|
13
14
|
* Fluent builder for defining column properties.
|
|
@@ -35,6 +36,10 @@ export declare class ColumnBuilder {
|
|
|
35
36
|
private readonly migration;
|
|
36
37
|
/** Mutable column definition being accumulated */
|
|
37
38
|
private readonly definition;
|
|
39
|
+
/** Mutable foreign key definition, set when .references() is called */
|
|
40
|
+
private fkDefinition?;
|
|
41
|
+
/** Temporary storage for generated expression before .stored() or .virtual() is called */
|
|
42
|
+
private generatedExpression?;
|
|
38
43
|
/**
|
|
39
44
|
* Create a new column builder.
|
|
40
45
|
*
|
|
@@ -64,18 +69,65 @@ export declare class ColumnBuilder {
|
|
|
64
69
|
*/
|
|
65
70
|
notNullable(): this;
|
|
66
71
|
/**
|
|
67
|
-
* Set default value for the column.
|
|
72
|
+
* Set default value for the column as a raw SQL expression.
|
|
73
|
+
*
|
|
74
|
+
* The value will be used as-is in the SQL statement without escaping.
|
|
75
|
+
* Use this for database functions and expressions.
|
|
76
|
+
*
|
|
77
|
+
* @param value - Default value (SQL expression, number, or boolean)
|
|
78
|
+
* @returns This builder for chaining
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* this.uuid("id").default("gen_random_uuid()");
|
|
83
|
+
* this.timestamp("created_at").default("NOW()");
|
|
84
|
+
* this.integer("version").default(1);
|
|
85
|
+
* this.boolean("is_active").default(true);
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
default(value: string | number | boolean): this;
|
|
89
|
+
/**
|
|
90
|
+
* Set default value for the column as a literal string.
|
|
91
|
+
*
|
|
92
|
+
* The value will be properly escaped and quoted in the SQL statement.
|
|
93
|
+
* Use this for literal string values, not SQL expressions.
|
|
94
|
+
*
|
|
95
|
+
* @param value - Default string value (will be escaped)
|
|
96
|
+
* @returns This builder for chaining
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* this.text("status").defaultString("active");
|
|
101
|
+
* this.text("greeting").defaultString("Hello, World!");
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
defaultString(value: string): this;
|
|
105
|
+
/**
|
|
106
|
+
* Set default value to the current timestamp.
|
|
107
|
+
*
|
|
108
|
+
* Database-agnostic. Generates NOW() / CURRENT_TIMESTAMP / GETDATE() based on driver.
|
|
109
|
+
*
|
|
110
|
+
* @returns This builder for chaining
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* this.timestamp("created_at").useCurrent();
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
useCurrent(): this;
|
|
118
|
+
/**
|
|
119
|
+
* Set column to update to current timestamp on row update.
|
|
120
|
+
*
|
|
121
|
+
* MySQL only. Other databases ignore this.
|
|
68
122
|
*
|
|
69
|
-
* @param value - Default value (can be a literal or expression)
|
|
70
123
|
* @returns This builder for chaining
|
|
71
124
|
*
|
|
72
125
|
* @example
|
|
73
126
|
* ```typescript
|
|
74
|
-
* this.
|
|
75
|
-
* this.dateTime("createdAt").default("NOW()");
|
|
127
|
+
* this.timestamp("updated_at").useCurrent().useCurrentOnUpdate();
|
|
76
128
|
* ```
|
|
77
129
|
*/
|
|
78
|
-
|
|
130
|
+
useCurrentOnUpdate(): this;
|
|
79
131
|
/**
|
|
80
132
|
* Add unique constraint/index on this column.
|
|
81
133
|
*
|
|
@@ -154,6 +206,175 @@ export declare class ColumnBuilder {
|
|
|
154
206
|
* ```
|
|
155
207
|
*/
|
|
156
208
|
comment(text: string): this;
|
|
209
|
+
/**
|
|
210
|
+
* Add a CHECK constraint scoped to this column.
|
|
211
|
+
*
|
|
212
|
+
* @param expression - SQL CHECK expression (can reference the column by name)
|
|
213
|
+
* @param name - Constraint name (defaults to `check_<column>`)
|
|
214
|
+
* @returns This builder for chaining
|
|
215
|
+
*/
|
|
216
|
+
check(expression: string, name?: string): this;
|
|
217
|
+
/**
|
|
218
|
+
* Position this column after another column.
|
|
219
|
+
*
|
|
220
|
+
* MySQL/MariaDB only. Ignored by PostgreSQL and NoSQL drivers.
|
|
221
|
+
*
|
|
222
|
+
* @param columnName - Column to position after
|
|
223
|
+
* @returns This builder for chaining
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* this.string("middle_name").after("first_name");
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
after(columnName: string): this;
|
|
231
|
+
/**
|
|
232
|
+
* Position this column as the first column in the table.
|
|
233
|
+
*
|
|
234
|
+
* MySQL/MariaDB only. Ignored by PostgreSQL and NoSQL drivers.
|
|
235
|
+
*
|
|
236
|
+
* @returns This builder for chaining
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ```typescript
|
|
240
|
+
* this.integer("id").primary().first();
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
first(): this;
|
|
244
|
+
/**
|
|
245
|
+
* Declare a foreign key constraint on this column.
|
|
246
|
+
*
|
|
247
|
+
* Pushes an `addForeignKey` operation immediately using a mutable reference —
|
|
248
|
+
* subsequent `.on()`, `.onDelete()`, `.onUpdate()` calls mutate the same
|
|
249
|
+
* definition that is already queued, so no `.add()` terminator is needed.
|
|
250
|
+
*
|
|
251
|
+
* Referenced column defaults to `"id"` — use `.on()` to override.
|
|
252
|
+
*
|
|
253
|
+
* @param table - Referenced table name
|
|
254
|
+
* @returns This builder for chaining
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```typescript
|
|
258
|
+
* this.integer("user_id").references("users");
|
|
259
|
+
* this.integer("user_id").references("users").on("custom_id").onDelete("cascade");
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
references(table: string): this;
|
|
263
|
+
/**
|
|
264
|
+
* Set the referenced column for the foreign key.
|
|
265
|
+
*
|
|
266
|
+
* Only meaningful after `.references()`. Defaults to `"id"` if omitted.
|
|
267
|
+
*
|
|
268
|
+
* @param column - Referenced column name
|
|
269
|
+
* @returns This builder for chaining
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```typescript
|
|
273
|
+
* this.integer("user_id").references("users").on("custom_id");
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
on(column: string): this;
|
|
277
|
+
/**
|
|
278
|
+
* Set the ON DELETE action for the foreign key.
|
|
279
|
+
*
|
|
280
|
+
* Only meaningful after `.references()`.
|
|
281
|
+
*
|
|
282
|
+
* @param action - Action when the referenced row is deleted
|
|
283
|
+
* @returns This builder for chaining
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```typescript
|
|
287
|
+
* this.integer("user_id").references("users").onDelete("cascade");
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
onDelete(action: ForeignKeyDefinition["onDelete"]): this;
|
|
291
|
+
/**
|
|
292
|
+
* Set the ON UPDATE action for the foreign key.
|
|
293
|
+
*
|
|
294
|
+
* Only meaningful after `.references()`.
|
|
295
|
+
*
|
|
296
|
+
* @param action - Action when the referenced row's key is updated
|
|
297
|
+
* @returns This builder for chaining
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```typescript
|
|
301
|
+
* this.integer("user_id").references("users").onUpdate("cascade");
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
onUpdate(action: ForeignKeyDefinition["onUpdate"]): this;
|
|
305
|
+
/**
|
|
306
|
+
* Shorthand for `.onDelete("cascade").onUpdate("cascade")`.
|
|
307
|
+
*
|
|
308
|
+
* Only meaningful after `.references()`.
|
|
309
|
+
*
|
|
310
|
+
* @returns This builder for chaining
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```typescript
|
|
314
|
+
* this.integer("user_id").references("users").cascadeAll();
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
cascadeAll(): this;
|
|
318
|
+
/**
|
|
319
|
+
* Mark this column definition as a modification of an existing column.
|
|
320
|
+
*
|
|
321
|
+
* Pushes a `modifyColumn` operation instead of `addColumn`.
|
|
322
|
+
* This method breaks the builder chain and returns the parent migration.
|
|
323
|
+
*
|
|
324
|
+
* @returns The parent migration instance (breaks builder chain)
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```typescript
|
|
328
|
+
* // Make email nullable
|
|
329
|
+
* this.string("email").nullable().change();
|
|
330
|
+
*
|
|
331
|
+
* // Increase length
|
|
332
|
+
* this.string("name", 255).change();
|
|
333
|
+
*
|
|
334
|
+
* // Change type
|
|
335
|
+
* this.text("description").change();
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
change(): unknown;
|
|
339
|
+
/**
|
|
340
|
+
* Mark this column as a generated column with the given SQL expression.
|
|
341
|
+
*
|
|
342
|
+
* Must be followed by `.stored()` or `.virtual()` to specify storage type.
|
|
343
|
+
*
|
|
344
|
+
* PostgreSQL: GENERATED ALWAYS AS (...) STORED
|
|
345
|
+
* MySQL: GENERATED ALWAYS AS (...) STORED | VIRTUAL
|
|
346
|
+
*
|
|
347
|
+
* @param expression - SQL expression to compute the value
|
|
348
|
+
* @returns This builder for chaining
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```typescript
|
|
352
|
+
* this.string("full_name")
|
|
353
|
+
* .generatedAs("CONCAT(first_name, ' ', last_name)")
|
|
354
|
+
* .stored();
|
|
355
|
+
*
|
|
356
|
+
* this.decimal("price_with_tax")
|
|
357
|
+
* .generatedAs("price * 1.2")
|
|
358
|
+
* .virtual();
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
generatedAs(expression: string): this;
|
|
362
|
+
/**
|
|
363
|
+
* Mark the generated column as stored (computed and persisted to disk).
|
|
364
|
+
*
|
|
365
|
+
* Must be called after `.generatedAs()`.
|
|
366
|
+
*
|
|
367
|
+
* @returns This builder for chaining
|
|
368
|
+
*/
|
|
369
|
+
stored(): this;
|
|
370
|
+
/**
|
|
371
|
+
* Mark the generated column as virtual (computed on read, not stored).
|
|
372
|
+
*
|
|
373
|
+
* Must be called after `.generatedAs()`. Not supported by PostgreSQL.
|
|
374
|
+
*
|
|
375
|
+
* @returns This builder for chaining
|
|
376
|
+
*/
|
|
377
|
+
virtual(): this;
|
|
157
378
|
/**
|
|
158
379
|
* Get the built column definition.
|
|
159
380
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column-builder.d.ts","sourceRoot":"","sources":["../../src/migration/column-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"column-builder.d.ts","sourceRoot":"","sources":["../../src/migration/column-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,UAAU,EACV,oBAAoB,EACrB,MAAM,wCAAwC,CAAC;AAEhD;;;GAGG;AACH,KAAK,aAAa,GAAG;IACnB,eAAe,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACtE,sBAAsB,CAAC,EAAE,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACxD,CAAC;AAcF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,aAAa;IAmBtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAlB5B,kDAAkD;IAClD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmB;IAE9C,uEAAuE;IACvE,OAAO,CAAC,YAAY,CAAC,CAA8B;IAEnD,0FAA0F;IAC1F,OAAO,CAAC,mBAAmB,CAAC,CAAS;IAErC;;;;;;;OAOG;gBAEgB,SAAS,EAAE,aAAa,EACzC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,UAAU,EAChB,OAAO,GAAE,OAAO,CACd,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,WAAW,GAAG,OAAO,GAAG,YA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B,CAAC,UAAU,CAAC,GAAG,IAAI;IAO/D;;;;;;;;;;;OAWG;IACI,UAAU,IAAI,IAAI;IAYzB;;;;;;;;;;;;;;;;;;;OAmBG;IACI,MAAM,IAAI,OAAO;IAsBxB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACI,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAK5C;;;;;;OAMG;IACI,MAAM,IAAI,IAAI;IAUrB;;;;;;OAMG;IACI,OAAO,IAAI,IAAI;IActB;;;;;;OAMG;IACI,aAAa,IAAI,gBAAgB;CAGzC"}
|
|
@@ -24,6 +24,10 @@ class ColumnBuilder {
|
|
|
24
24
|
migration;
|
|
25
25
|
/** Mutable column definition being accumulated */
|
|
26
26
|
definition;
|
|
27
|
+
/** Mutable foreign key definition, set when .references() is called */
|
|
28
|
+
fkDefinition;
|
|
29
|
+
/** Temporary storage for generated expression before .stored() or .virtual() is called */
|
|
30
|
+
generatedExpression;
|
|
27
31
|
/**
|
|
28
32
|
* Create a new column builder.
|
|
29
33
|
*
|
|
@@ -73,19 +77,77 @@ class ColumnBuilder {
|
|
|
73
77
|
// DEFAULT VALUES
|
|
74
78
|
// ============================================================================
|
|
75
79
|
/**
|
|
76
|
-
* Set default value for the column.
|
|
80
|
+
* Set default value for the column as a raw SQL expression.
|
|
77
81
|
*
|
|
78
|
-
*
|
|
82
|
+
* The value will be used as-is in the SQL statement without escaping.
|
|
83
|
+
* Use this for database functions and expressions.
|
|
84
|
+
*
|
|
85
|
+
* @param value - Default value (SQL expression, number, or boolean)
|
|
79
86
|
* @returns This builder for chaining
|
|
80
87
|
*
|
|
81
88
|
* @example
|
|
82
89
|
* ```typescript
|
|
83
|
-
* this.
|
|
84
|
-
* this.
|
|
90
|
+
* this.uuid("id").default("gen_random_uuid()");
|
|
91
|
+
* this.timestamp("created_at").default("NOW()");
|
|
92
|
+
* this.integer("version").default(1);
|
|
93
|
+
* this.boolean("is_active").default(true);
|
|
85
94
|
* ```
|
|
86
95
|
*/
|
|
87
96
|
default(value) {
|
|
88
97
|
this.definition.defaultValue = value;
|
|
98
|
+
this.definition.isRawDefault = true;
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Set default value for the column as a literal string.
|
|
103
|
+
*
|
|
104
|
+
* The value will be properly escaped and quoted in the SQL statement.
|
|
105
|
+
* Use this for literal string values, not SQL expressions.
|
|
106
|
+
*
|
|
107
|
+
* @param value - Default string value (will be escaped)
|
|
108
|
+
* @returns This builder for chaining
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* this.text("status").defaultString("active");
|
|
113
|
+
* this.text("greeting").defaultString("Hello, World!");
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
defaultString(value) {
|
|
117
|
+
this.definition.defaultValue = value;
|
|
118
|
+
this.definition.isRawDefault = false;
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Set default value to the current timestamp.
|
|
123
|
+
*
|
|
124
|
+
* Database-agnostic. Generates NOW() / CURRENT_TIMESTAMP / GETDATE() based on driver.
|
|
125
|
+
*
|
|
126
|
+
* @returns This builder for chaining
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* this.timestamp("created_at").useCurrent();
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
useCurrent() {
|
|
134
|
+
this.definition.defaultValue = { __type: "CURRENT_TIMESTAMP" };
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Set column to update to current timestamp on row update.
|
|
139
|
+
*
|
|
140
|
+
* MySQL only. Other databases ignore this.
|
|
141
|
+
*
|
|
142
|
+
* @returns This builder for chaining
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* this.timestamp("updated_at").useCurrent().useCurrentOnUpdate();
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
useCurrentOnUpdate() {
|
|
150
|
+
this.definition.onUpdateCurrent = true;
|
|
89
151
|
return this;
|
|
90
152
|
}
|
|
91
153
|
// ============================================================================
|
|
@@ -202,6 +264,265 @@ class ColumnBuilder {
|
|
|
202
264
|
return this;
|
|
203
265
|
}
|
|
204
266
|
// ============================================================================
|
|
267
|
+
// CONSTRAINTS
|
|
268
|
+
// ============================================================================
|
|
269
|
+
/**
|
|
270
|
+
* Add a CHECK constraint scoped to this column.
|
|
271
|
+
*
|
|
272
|
+
* @param expression - SQL CHECK expression (can reference the column by name)
|
|
273
|
+
* @param name - Constraint name (defaults to `check_<column>`)
|
|
274
|
+
* @returns This builder for chaining
|
|
275
|
+
*/
|
|
276
|
+
check(expression, name) {
|
|
277
|
+
this.definition.checkConstraint = {
|
|
278
|
+
expression,
|
|
279
|
+
name: name ?? `check_${this.definition.name}`,
|
|
280
|
+
};
|
|
281
|
+
return this;
|
|
282
|
+
}
|
|
283
|
+
// ============================================================================
|
|
284
|
+
// COLUMN POSITIONING (MySQL/MariaDB only)
|
|
285
|
+
// ============================================================================
|
|
286
|
+
/**
|
|
287
|
+
* Position this column after another column.
|
|
288
|
+
*
|
|
289
|
+
* MySQL/MariaDB only. Ignored by PostgreSQL and NoSQL drivers.
|
|
290
|
+
*
|
|
291
|
+
* @param columnName - Column to position after
|
|
292
|
+
* @returns This builder for chaining
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```typescript
|
|
296
|
+
* this.string("middle_name").after("first_name");
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
after(columnName) {
|
|
300
|
+
this.definition.after = columnName;
|
|
301
|
+
return this;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Position this column as the first column in the table.
|
|
305
|
+
*
|
|
306
|
+
* MySQL/MariaDB only. Ignored by PostgreSQL and NoSQL drivers.
|
|
307
|
+
*
|
|
308
|
+
* @returns This builder for chaining
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```typescript
|
|
312
|
+
* this.integer("id").primary().first();
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
first() {
|
|
316
|
+
this.definition.first = true;
|
|
317
|
+
return this;
|
|
318
|
+
}
|
|
319
|
+
// ============================================================================
|
|
320
|
+
// FOREIGN KEY
|
|
321
|
+
// ============================================================================
|
|
322
|
+
/**
|
|
323
|
+
* Declare a foreign key constraint on this column.
|
|
324
|
+
*
|
|
325
|
+
* Pushes an `addForeignKey` operation immediately using a mutable reference —
|
|
326
|
+
* subsequent `.on()`, `.onDelete()`, `.onUpdate()` calls mutate the same
|
|
327
|
+
* definition that is already queued, so no `.add()` terminator is needed.
|
|
328
|
+
*
|
|
329
|
+
* Referenced column defaults to `"id"` — use `.on()` to override.
|
|
330
|
+
*
|
|
331
|
+
* @param table - Referenced table name
|
|
332
|
+
* @returns This builder for chaining
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* ```typescript
|
|
336
|
+
* this.integer("user_id").references("users");
|
|
337
|
+
* this.integer("user_id").references("users").on("custom_id").onDelete("cascade");
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
references(table) {
|
|
341
|
+
this.fkDefinition = {
|
|
342
|
+
column: this.definition.name,
|
|
343
|
+
referencesTable: table,
|
|
344
|
+
referencesColumn: "id",
|
|
345
|
+
onDelete: "restrict",
|
|
346
|
+
onUpdate: "restrict",
|
|
347
|
+
};
|
|
348
|
+
this.migration.addForeignKeyOperation(this.fkDefinition);
|
|
349
|
+
return this;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Set the referenced column for the foreign key.
|
|
353
|
+
*
|
|
354
|
+
* Only meaningful after `.references()`. Defaults to `"id"` if omitted.
|
|
355
|
+
*
|
|
356
|
+
* @param column - Referenced column name
|
|
357
|
+
* @returns This builder for chaining
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```typescript
|
|
361
|
+
* this.integer("user_id").references("users").on("custom_id");
|
|
362
|
+
* ```
|
|
363
|
+
*/
|
|
364
|
+
on(column) {
|
|
365
|
+
if (this.fkDefinition) {
|
|
366
|
+
this.fkDefinition.referencesColumn = column;
|
|
367
|
+
}
|
|
368
|
+
return this;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Set the ON DELETE action for the foreign key.
|
|
372
|
+
*
|
|
373
|
+
* Only meaningful after `.references()`.
|
|
374
|
+
*
|
|
375
|
+
* @param action - Action when the referenced row is deleted
|
|
376
|
+
* @returns This builder for chaining
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```typescript
|
|
380
|
+
* this.integer("user_id").references("users").onDelete("cascade");
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
onDelete(action) {
|
|
384
|
+
if (this.fkDefinition) {
|
|
385
|
+
this.fkDefinition.onDelete = action;
|
|
386
|
+
}
|
|
387
|
+
return this;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Set the ON UPDATE action for the foreign key.
|
|
391
|
+
*
|
|
392
|
+
* Only meaningful after `.references()`.
|
|
393
|
+
*
|
|
394
|
+
* @param action - Action when the referenced row's key is updated
|
|
395
|
+
* @returns This builder for chaining
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* ```typescript
|
|
399
|
+
* this.integer("user_id").references("users").onUpdate("cascade");
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
402
|
+
onUpdate(action) {
|
|
403
|
+
if (this.fkDefinition) {
|
|
404
|
+
this.fkDefinition.onUpdate = action;
|
|
405
|
+
}
|
|
406
|
+
return this;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Shorthand for `.onDelete("cascade").onUpdate("cascade")`.
|
|
410
|
+
*
|
|
411
|
+
* Only meaningful after `.references()`.
|
|
412
|
+
*
|
|
413
|
+
* @returns This builder for chaining
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```typescript
|
|
417
|
+
* this.integer("user_id").references("users").cascadeAll();
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
cascadeAll() {
|
|
421
|
+
if (this.fkDefinition) {
|
|
422
|
+
this.fkDefinition.onDelete = "cascade";
|
|
423
|
+
this.fkDefinition.onUpdate = "cascade";
|
|
424
|
+
}
|
|
425
|
+
return this;
|
|
426
|
+
}
|
|
427
|
+
// ============================================================================
|
|
428
|
+
// COLUMN MODIFICATION
|
|
429
|
+
// ============================================================================
|
|
430
|
+
/**
|
|
431
|
+
* Mark this column definition as a modification of an existing column.
|
|
432
|
+
*
|
|
433
|
+
* Pushes a `modifyColumn` operation instead of `addColumn`.
|
|
434
|
+
* This method breaks the builder chain and returns the parent migration.
|
|
435
|
+
*
|
|
436
|
+
* @returns The parent migration instance (breaks builder chain)
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* ```typescript
|
|
440
|
+
* // Make email nullable
|
|
441
|
+
* this.string("email").nullable().change();
|
|
442
|
+
*
|
|
443
|
+
* // Increase length
|
|
444
|
+
* this.string("name", 255).change();
|
|
445
|
+
*
|
|
446
|
+
* // Change type
|
|
447
|
+
* this.text("description").change();
|
|
448
|
+
* ```
|
|
449
|
+
*/
|
|
450
|
+
change() {
|
|
451
|
+
// Remove the existing addColumn operation that was pushed in the constructor
|
|
452
|
+
const operations = this.migration.pendingOperations;
|
|
453
|
+
const lastOp = operations[operations.length - 1];
|
|
454
|
+
if (lastOp?.type === "addColumn" && lastOp.payload === this.definition) {
|
|
455
|
+
operations.pop();
|
|
456
|
+
}
|
|
457
|
+
// Push modifyColumn instead
|
|
458
|
+
this.migration.pendingOperations.push({
|
|
459
|
+
type: "modifyColumn",
|
|
460
|
+
payload: this.definition,
|
|
461
|
+
});
|
|
462
|
+
return this.migration;
|
|
463
|
+
}
|
|
464
|
+
// ============================================================================
|
|
465
|
+
// GENERATED COLUMNS
|
|
466
|
+
// ============================================================================
|
|
467
|
+
/**
|
|
468
|
+
* Mark this column as a generated column with the given SQL expression.
|
|
469
|
+
*
|
|
470
|
+
* Must be followed by `.stored()` or `.virtual()` to specify storage type.
|
|
471
|
+
*
|
|
472
|
+
* PostgreSQL: GENERATED ALWAYS AS (...) STORED
|
|
473
|
+
* MySQL: GENERATED ALWAYS AS (...) STORED | VIRTUAL
|
|
474
|
+
*
|
|
475
|
+
* @param expression - SQL expression to compute the value
|
|
476
|
+
* @returns This builder for chaining
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* ```typescript
|
|
480
|
+
* this.string("full_name")
|
|
481
|
+
* .generatedAs("CONCAT(first_name, ' ', last_name)")
|
|
482
|
+
* .stored();
|
|
483
|
+
*
|
|
484
|
+
* this.decimal("price_with_tax")
|
|
485
|
+
* .generatedAs("price * 1.2")
|
|
486
|
+
* .virtual();
|
|
487
|
+
* ```
|
|
488
|
+
*/
|
|
489
|
+
generatedAs(expression) {
|
|
490
|
+
this.generatedExpression = expression;
|
|
491
|
+
return this;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Mark the generated column as stored (computed and persisted to disk).
|
|
495
|
+
*
|
|
496
|
+
* Must be called after `.generatedAs()`.
|
|
497
|
+
*
|
|
498
|
+
* @returns This builder for chaining
|
|
499
|
+
*/
|
|
500
|
+
stored() {
|
|
501
|
+
if (this.generatedExpression) {
|
|
502
|
+
this.definition.generated = {
|
|
503
|
+
expression: this.generatedExpression,
|
|
504
|
+
stored: true,
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
return this;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Mark the generated column as virtual (computed on read, not stored).
|
|
511
|
+
*
|
|
512
|
+
* Must be called after `.generatedAs()`. Not supported by PostgreSQL.
|
|
513
|
+
*
|
|
514
|
+
* @returns This builder for chaining
|
|
515
|
+
*/
|
|
516
|
+
virtual() {
|
|
517
|
+
if (this.generatedExpression) {
|
|
518
|
+
this.definition.generated = {
|
|
519
|
+
expression: this.generatedExpression,
|
|
520
|
+
stored: false,
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
return this;
|
|
524
|
+
}
|
|
525
|
+
// ============================================================================
|
|
205
526
|
// ACCESSOR
|
|
206
527
|
// ============================================================================
|
|
207
528
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column-builder.js","sources":["../../src/migration/column-builder.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"column-builder.js","sources":["../../src/migration/column-builder.ts"],"sourcesContent":[null],"names":[],"mappings":"AA2BA;;;;;;;;;;;;;;;;;;;;;AAqBG;MACU,aAAa,CAAA;AAmBL,IAAA,SAAA,CAAA;;AAjBF,IAAA,UAAU,CAAmB;;AAGtC,IAAA,YAAY,CAA+B;;AAG3C,IAAA,mBAAmB,CAAU;AAErC;;;;;;;AAOG;AACH,IAAA,WAAA,CACmB,SAAwB,EACzC,IAAY,EACZ,IAAgB,EAChB,UAEI,EAAE,EAAA;QALW,IAAS,CAAA,SAAA,GAAT,SAAS,CAAe;QAOzC,IAAI,CAAC,UAAU,GAAG;YAChB,IAAI;YACJ,IAAI;AACJ,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,GAAG,OAAO;SACX,CAAC;KACH;;;;AAMD;;;;;;;;;AASG;IACI,QAAQ,GAAA;AACb,QAAA,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC;AAChC,QAAA,OAAO,IAAI,CAAC;KACb;AAED;;;;;;AAMG;IACI,WAAW,GAAA;AAChB,QAAA,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC;AACjC,QAAA,OAAO,IAAI,CAAC;KACb;;;;AAMD;;;;;;;;;;;;;;;;AAgBG;AACI,IAAA,OAAO,CAAC,KAAgC,EAAA;AAC7C,QAAA,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,KAAK,CAAC;AACrC,QAAA,IAAI,CAAC,UAAU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