drizzle-kit 0.20.7-b11c289 → 0.20.7-c9519c9
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +143 -201
- package/cli/commands/migrate.d.ts +1 -11
- package/cli/commands/utils.d.ts +0 -9
- package/cli/validations/mysql.d.ts +6 -6
- package/cli/validations/pg.d.ts +12 -12
- package/index.d.mts +0 -2
- package/index.d.ts +0 -2
- package/package.json +1 -1
- package/utils.js +48 -78
@@ -256,15 +256,5 @@ export declare const prepareSQL: (prev: CommonSquashedSchema, cur: CommonSquashe
|
|
256
256
|
} | undefined;
|
257
257
|
}>;
|
258
258
|
export declare const BREAKPOINT = "--> statement-breakpoint\n";
|
259
|
-
export declare const writeResult: (
|
260
|
-
cur: CommonSchema;
|
261
|
-
sqlStatements: string[];
|
262
|
-
journal: Journal;
|
263
|
-
_meta?: any;
|
264
|
-
outFolder: string;
|
265
|
-
breakpoints: boolean;
|
266
|
-
bundle?: boolean | undefined;
|
267
|
-
type?: "none" | "custom" | "introspect" | undefined;
|
268
|
-
}) => void;
|
269
|
-
export declare const embeddedMigrations: (journal: Journal) => string;
|
259
|
+
export declare const writeResult: (cur: CommonSchema, sqlStatements: string[], journal: Journal, _meta: any, outFolder: string, breakpoints: boolean, type?: "introspect" | "custom" | "none") => void;
|
270
260
|
export declare const prepareSnapshotFolderName: () => string;
|
package/cli/commands/utils.d.ts
CHANGED
@@ -7,7 +7,6 @@ export type GenerateConfig = {
|
|
7
7
|
out: string;
|
8
8
|
breakpoints: boolean;
|
9
9
|
custom: boolean;
|
10
|
-
bundle: boolean;
|
11
10
|
};
|
12
11
|
export declare const prepareGenerateConfig: (options: {
|
13
12
|
schema?: string | string[];
|
@@ -21,17 +20,14 @@ export declare const assertOutFolder: (it: {
|
|
21
20
|
} | {
|
22
21
|
out: string;
|
23
22
|
}) => Promise<string>;
|
24
|
-
export declare const driver: import("zod").ZodUnion<[import("zod").ZodLiteral<"better-sqlite">, import("zod").ZodLiteral<"turso">, import("zod").ZodLiteral<"libsql">, import("zod").ZodLiteral<"d1">, import("zod").ZodLiteral<"expo">, import("zod").ZodLiteral<"pg">, import("zod").ZodLiteral<"mysql2">]>;
|
25
23
|
export declare const configCommonSchema: import("zod").ZodObject<{
|
26
24
|
schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
|
27
25
|
out: import("zod").ZodOptional<import("zod").ZodString>;
|
28
26
|
breakpoints: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
29
|
-
driver: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodLiteral<"better-sqlite">, import("zod").ZodLiteral<"turso">, import("zod").ZodLiteral<"libsql">, import("zod").ZodLiteral<"d1">, import("zod").ZodLiteral<"expo">, import("zod").ZodLiteral<"pg">, import("zod").ZodLiteral<"mysql2">]>>;
|
30
27
|
tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
|
31
28
|
schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
|
32
29
|
}, "strip", import("zod").ZodTypeAny, {
|
33
30
|
out?: string | undefined;
|
34
|
-
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
35
31
|
tablesFilter?: string | string[] | undefined;
|
36
32
|
schema: string | string[];
|
37
33
|
breakpoints: boolean;
|
@@ -39,7 +35,6 @@ export declare const configCommonSchema: import("zod").ZodObject<{
|
|
39
35
|
}, {
|
40
36
|
out?: string | undefined;
|
41
37
|
breakpoints?: boolean | undefined;
|
42
|
-
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
43
38
|
tablesFilter?: string | string[] | undefined;
|
44
39
|
schemaFilter?: string | string[] | undefined;
|
45
40
|
schema: string | string[];
|
@@ -169,12 +164,10 @@ export declare const mySqlCliConfigSchema: import("zod").ZodIntersection<import(
|
|
169
164
|
schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
|
170
165
|
out: import("zod").ZodOptional<import("zod").ZodString>;
|
171
166
|
breakpoints: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
172
|
-
driver: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodLiteral<"better-sqlite">, import("zod").ZodLiteral<"turso">, import("zod").ZodLiteral<"libsql">, import("zod").ZodLiteral<"d1">, import("zod").ZodLiteral<"expo">, import("zod").ZodLiteral<"pg">, import("zod").ZodLiteral<"mysql2">]>>;
|
173
167
|
tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
|
174
168
|
schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
|
175
169
|
}, "strip", import("zod").ZodTypeAny, {
|
176
170
|
out?: string | undefined;
|
177
|
-
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
178
171
|
tablesFilter?: string | string[] | undefined;
|
179
172
|
schema: string | string[];
|
180
173
|
breakpoints: boolean;
|
@@ -182,7 +175,6 @@ export declare const mySqlCliConfigSchema: import("zod").ZodIntersection<import(
|
|
182
175
|
}, {
|
183
176
|
out?: string | undefined;
|
184
177
|
breakpoints?: boolean | undefined;
|
185
|
-
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
186
178
|
tablesFilter?: string | string[] | undefined;
|
187
179
|
schemaFilter?: string | string[] | undefined;
|
188
180
|
schema: string | string[];
|
@@ -269,6 +261,5 @@ export declare const mySqlIntrospectConfigSchema: import("zod").ZodIntersection<
|
|
269
261
|
}>, import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>]>>;
|
270
262
|
export type MySqlCliConfig = TypeOf<typeof mySqlCliConfigSchema>;
|
271
263
|
export type CliConfig = MySqlCliConfig;
|
272
|
-
export type Driver = TypeOf<typeof driver>;
|
273
264
|
export declare const drizzleConfigFromFile: (configPath?: string) => Promise<CliConfig>;
|
274
265
|
export declare const readDrizzleConfig: (configPath?: string) => Promise<any>;
|
@@ -9,17 +9,17 @@ export declare const mysqlConnectionCli: import("zod").ZodUnion<[import("zod").Z
|
|
9
9
|
}, "strip", import("zod").ZodTypeAny, {
|
10
10
|
port?: number | undefined;
|
11
11
|
password?: string | undefined;
|
12
|
-
driver: "mysql2";
|
13
12
|
host: string;
|
14
13
|
user: string;
|
15
14
|
database: string;
|
15
|
+
driver: "mysql2";
|
16
16
|
}, {
|
17
17
|
port?: number | undefined;
|
18
18
|
user?: string | undefined;
|
19
19
|
password?: string | undefined;
|
20
|
-
driver: "mysql2";
|
21
20
|
host: string;
|
22
21
|
database: string;
|
22
|
+
driver: "mysql2";
|
23
23
|
}>, import("zod").ZodObject<{
|
24
24
|
driver: import("zod").ZodLiteral<"mysql2">;
|
25
25
|
uri: import("zod").ZodString;
|
@@ -217,17 +217,17 @@ export declare const mysqlCliIntrospectParams: import("zod").ZodIntersection<imp
|
|
217
217
|
}, "strip", import("zod").ZodTypeAny, {
|
218
218
|
port?: number | undefined;
|
219
219
|
password?: string | undefined;
|
220
|
-
driver: "mysql2";
|
221
220
|
host: string;
|
222
221
|
user: string;
|
223
222
|
database: string;
|
223
|
+
driver: "mysql2";
|
224
224
|
}, {
|
225
225
|
port?: number | undefined;
|
226
226
|
user?: string | undefined;
|
227
227
|
password?: string | undefined;
|
228
|
-
driver: "mysql2";
|
229
228
|
host: string;
|
230
229
|
database: string;
|
230
|
+
driver: "mysql2";
|
231
231
|
}>, import("zod").ZodObject<{
|
232
232
|
driver: import("zod").ZodLiteral<"mysql2">;
|
233
233
|
uri: import("zod").ZodString;
|
@@ -266,17 +266,17 @@ export declare const mysqlCliPushParams: import("zod").ZodIntersection<import("z
|
|
266
266
|
}, "strip", import("zod").ZodTypeAny, {
|
267
267
|
port?: number | undefined;
|
268
268
|
password?: string | undefined;
|
269
|
-
driver: "mysql2";
|
270
269
|
host: string;
|
271
270
|
user: string;
|
272
271
|
database: string;
|
272
|
+
driver: "mysql2";
|
273
273
|
}, {
|
274
274
|
port?: number | undefined;
|
275
275
|
user?: string | undefined;
|
276
276
|
password?: string | undefined;
|
277
|
-
driver: "mysql2";
|
278
277
|
host: string;
|
279
278
|
database: string;
|
279
|
+
driver: "mysql2";
|
280
280
|
}>, import("zod").ZodObject<{
|
281
281
|
driver: import("zod").ZodLiteral<"mysql2">;
|
282
282
|
uri: import("zod").ZodString;
|
package/cli/validations/pg.d.ts
CHANGED
@@ -13,31 +13,31 @@ export declare const pgConnectionCli: import("zod").ZodUnion<[import("zod").ZodO
|
|
13
13
|
password?: string | undefined;
|
14
14
|
ssl?: boolean | undefined;
|
15
15
|
type: "params";
|
16
|
-
driver: "pg";
|
17
16
|
host: string;
|
18
17
|
user: string;
|
19
18
|
database: string;
|
19
|
+
driver: "pg";
|
20
20
|
}, {
|
21
21
|
type?: "params" | undefined;
|
22
22
|
port?: number | undefined;
|
23
23
|
user?: string | undefined;
|
24
24
|
password?: string | undefined;
|
25
25
|
ssl?: boolean | undefined;
|
26
|
-
driver: "pg";
|
27
26
|
host: string;
|
28
27
|
database: string;
|
28
|
+
driver: "pg";
|
29
29
|
}>, import("zod").ZodObject<{
|
30
30
|
driver: import("zod").ZodLiteral<"pg">;
|
31
31
|
connectionString: import("zod").ZodString;
|
32
32
|
type: import("zod").ZodDefault<import("zod").ZodLiteral<"url">>;
|
33
33
|
}, "strip", import("zod").ZodTypeAny, {
|
34
34
|
type: "url";
|
35
|
-
driver: "pg";
|
36
35
|
connectionString: string;
|
36
|
+
driver: "pg";
|
37
37
|
}, {
|
38
38
|
type?: "url" | undefined;
|
39
|
-
driver: "pg";
|
40
39
|
connectionString: string;
|
40
|
+
driver: "pg";
|
41
41
|
}>]>;
|
42
42
|
export declare const pgConnectionConfig: import("zod").ZodUnion<[import("zod").ZodObject<{
|
43
43
|
driver: import("zod").ZodLiteral<"pg">;
|
@@ -253,31 +253,31 @@ export declare const pgCliIntrospectParams: import("zod").ZodIntersection<import
|
|
253
253
|
password?: string | undefined;
|
254
254
|
ssl?: boolean | undefined;
|
255
255
|
type: "params";
|
256
|
-
driver: "pg";
|
257
256
|
host: string;
|
258
257
|
user: string;
|
259
258
|
database: string;
|
259
|
+
driver: "pg";
|
260
260
|
}, {
|
261
261
|
type?: "params" | undefined;
|
262
262
|
port?: number | undefined;
|
263
263
|
user?: string | undefined;
|
264
264
|
password?: string | undefined;
|
265
265
|
ssl?: boolean | undefined;
|
266
|
-
driver: "pg";
|
267
266
|
host: string;
|
268
267
|
database: string;
|
268
|
+
driver: "pg";
|
269
269
|
}>, import("zod").ZodObject<{
|
270
270
|
driver: import("zod").ZodLiteral<"pg">;
|
271
271
|
connectionString: import("zod").ZodString;
|
272
272
|
type: import("zod").ZodDefault<import("zod").ZodLiteral<"url">>;
|
273
273
|
}, "strip", import("zod").ZodTypeAny, {
|
274
274
|
type: "url";
|
275
|
-
driver: "pg";
|
276
275
|
connectionString: string;
|
276
|
+
driver: "pg";
|
277
277
|
}, {
|
278
278
|
type?: "url" | undefined;
|
279
|
-
driver: "pg";
|
280
279
|
connectionString: string;
|
280
|
+
driver: "pg";
|
281
281
|
}>]>>;
|
282
282
|
export declare const pgCliPushParams: import("zod").ZodIntersection<import("zod").ZodObject<{
|
283
283
|
schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
|
@@ -311,31 +311,31 @@ export declare const pgCliPushParams: import("zod").ZodIntersection<import("zod"
|
|
311
311
|
password?: string | undefined;
|
312
312
|
ssl?: boolean | undefined;
|
313
313
|
type: "params";
|
314
|
-
driver: "pg";
|
315
314
|
host: string;
|
316
315
|
user: string;
|
317
316
|
database: string;
|
317
|
+
driver: "pg";
|
318
318
|
}, {
|
319
319
|
type?: "params" | undefined;
|
320
320
|
port?: number | undefined;
|
321
321
|
user?: string | undefined;
|
322
322
|
password?: string | undefined;
|
323
323
|
ssl?: boolean | undefined;
|
324
|
-
driver: "pg";
|
325
324
|
host: string;
|
326
325
|
database: string;
|
326
|
+
driver: "pg";
|
327
327
|
}>, import("zod").ZodObject<{
|
328
328
|
driver: import("zod").ZodLiteral<"pg">;
|
329
329
|
connectionString: import("zod").ZodString;
|
330
330
|
type: import("zod").ZodDefault<import("zod").ZodLiteral<"url">>;
|
331
331
|
}, "strip", import("zod").ZodTypeAny, {
|
332
332
|
type: "url";
|
333
|
-
driver: "pg";
|
334
333
|
connectionString: string;
|
334
|
+
driver: "pg";
|
335
335
|
}, {
|
336
336
|
type?: "url" | undefined;
|
337
|
-
driver: "pg";
|
338
337
|
connectionString: string;
|
338
|
+
driver: "pg";
|
339
339
|
}>]>>;
|
340
340
|
export declare const pgConfigPushParams: import("zod").ZodIntersection<import("zod").ZodObject<{
|
341
341
|
schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
|
package/index.d.mts
CHANGED
package/index.d.ts
CHANGED
package/package.json
CHANGED
package/utils.js
CHANGED
@@ -11140,7 +11140,7 @@ var require_node2 = __commonJS({
|
|
11140
11140
|
});
|
11141
11141
|
|
11142
11142
|
// src/cli/commands/utils.ts
|
11143
|
-
var import_hanji2, assertES5, safeRegister,
|
11143
|
+
var import_hanji2, assertES5, safeRegister, configCommonSchema, introspectCasing, configIntrospectSchema, configIntrospectCliSchema, configGenerateSchema, configPushSchema, mysqlConnectionSchema, mySqlCliConfigSchema, mySqlIntrospectConfigSchema;
|
11144
11144
|
var init_utils = __esm({
|
11145
11145
|
"src/cli/commands/utils.ts"() {
|
11146
11146
|
init_serializer();
|
@@ -11189,20 +11189,10 @@ var init_utils = __esm({
|
|
11189
11189
|
await assertES5(res.unregister);
|
11190
11190
|
return res;
|
11191
11191
|
};
|
11192
|
-
driver = unionType([
|
11193
|
-
literalType("better-sqlite"),
|
11194
|
-
literalType("turso"),
|
11195
|
-
literalType("libsql"),
|
11196
|
-
literalType("d1"),
|
11197
|
-
literalType("expo"),
|
11198
|
-
literalType("pg"),
|
11199
|
-
literalType("mysql2")
|
11200
|
-
]);
|
11201
11192
|
configCommonSchema = objectType({
|
11202
11193
|
schema: unionType([stringType(), stringType().array()]),
|
11203
11194
|
out: stringType().optional(),
|
11204
11195
|
breakpoints: booleanType().default(true),
|
11205
|
-
driver: driver.optional(),
|
11206
11196
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
11207
11197
|
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"])
|
11208
11198
|
});
|
@@ -11731,9 +11721,9 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
11731
11721
|
}
|
11732
11722
|
try {
|
11733
11723
|
const fks = await db.execute(
|
11734
|
-
`SELECT INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.COLUMN_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_COLUMN_NAME,
|
11724
|
+
`SELECT INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.COLUMN_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_COLUMN_NAME,INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.UPDATE_RULE, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.DELETE_RULE
|
11735
11725
|
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
|
11736
|
-
LEFT JOIN
|
11726
|
+
LEFT JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS on INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.CONSTRAINT_NAME = INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME
|
11737
11727
|
WHERE INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA = ? AND INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME != 'PRIMARY' and INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME is not null;
|
11738
11728
|
`,
|
11739
11729
|
[inputSchema]
|
@@ -14632,7 +14622,6 @@ var init_words = __esm({
|
|
14632
14622
|
var migrate_exports = {};
|
14633
14623
|
__export(migrate_exports, {
|
14634
14624
|
BREAKPOINT: () => BREAKPOINT,
|
14635
|
-
embeddedMigrations: () => embeddedMigrations,
|
14636
14625
|
prepareAndMigrateMySql: () => prepareAndMigrateMySql,
|
14637
14626
|
prepareAndMigratePg: () => prepareAndMigratePg,
|
14638
14627
|
prepareAndMigrateSqlite: () => prepareAndMigrateSqlite,
|
@@ -14643,7 +14632,7 @@ __export(migrate_exports, {
|
|
14643
14632
|
prepareSnapshotFolderName: () => prepareSnapshotFolderName,
|
14644
14633
|
writeResult: () => writeResult
|
14645
14634
|
});
|
14646
|
-
var import_fs3, import_path2, import_hanji3, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, preparePgPush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult,
|
14635
|
+
var import_fs3, import_path2, import_hanji3, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, preparePgPush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult, prepareSnapshotFolderName, two;
|
14647
14636
|
var init_migrate = __esm({
|
14648
14637
|
"src/cli/commands/migrate.ts"() {
|
14649
14638
|
import_fs3 = __toESM(require("fs"));
|
@@ -14672,14 +14661,19 @@ var init_migrate = __esm({
|
|
14672
14661
|
const validatedPrev = pgSchema.parse(prev);
|
14673
14662
|
const validatedCur = pgSchema.parse(cur);
|
14674
14663
|
if (config.custom) {
|
14675
|
-
writeResult(
|
14676
|
-
|
14677
|
-
|
14664
|
+
writeResult(
|
14665
|
+
custom,
|
14666
|
+
[],
|
14678
14667
|
journal,
|
14668
|
+
{
|
14669
|
+
columns: {},
|
14670
|
+
schemas: {},
|
14671
|
+
tables: {}
|
14672
|
+
},
|
14679
14673
|
outFolder,
|
14680
|
-
|
14681
|
-
|
14682
|
-
|
14674
|
+
config.breakpoints,
|
14675
|
+
"custom"
|
14676
|
+
);
|
14683
14677
|
return;
|
14684
14678
|
}
|
14685
14679
|
const squashedPrev = squashPgScheme(validatedPrev);
|
@@ -14691,13 +14685,14 @@ var init_migrate = __esm({
|
|
14691
14685
|
validatedPrev,
|
14692
14686
|
validatedCur
|
14693
14687
|
);
|
14694
|
-
writeResult(
|
14688
|
+
writeResult(
|
14695
14689
|
cur,
|
14696
14690
|
sqlStatements,
|
14697
14691
|
journal,
|
14692
|
+
_meta,
|
14698
14693
|
outFolder,
|
14699
|
-
|
14700
|
-
|
14694
|
+
config.breakpoints
|
14695
|
+
);
|
14701
14696
|
} catch (e) {
|
14702
14697
|
console.error(e);
|
14703
14698
|
}
|
@@ -14791,14 +14786,19 @@ var init_migrate = __esm({
|
|
14791
14786
|
const validatedPrev = mysqlSchema.parse(prev);
|
14792
14787
|
const validatedCur = mysqlSchema.parse(cur);
|
14793
14788
|
if (config.custom) {
|
14794
|
-
writeResult(
|
14795
|
-
|
14796
|
-
|
14789
|
+
writeResult(
|
14790
|
+
custom,
|
14791
|
+
[],
|
14797
14792
|
journal,
|
14793
|
+
{
|
14794
|
+
columns: {},
|
14795
|
+
schemas: {},
|
14796
|
+
tables: {}
|
14797
|
+
},
|
14798
14798
|
outFolder,
|
14799
|
-
|
14800
|
-
|
14801
|
-
|
14799
|
+
config.breakpoints,
|
14800
|
+
"custom"
|
14801
|
+
);
|
14802
14802
|
return;
|
14803
14803
|
}
|
14804
14804
|
const squashedPrev = squashMysqlScheme(validatedPrev);
|
@@ -14810,14 +14810,14 @@ var init_migrate = __esm({
|
|
14810
14810
|
validatedPrev,
|
14811
14811
|
validatedCur
|
14812
14812
|
);
|
14813
|
-
writeResult(
|
14813
|
+
writeResult(
|
14814
14814
|
cur,
|
14815
14815
|
sqlStatements,
|
14816
14816
|
journal,
|
14817
14817
|
_meta,
|
14818
14818
|
outFolder,
|
14819
|
-
|
14820
|
-
|
14819
|
+
config.breakpoints
|
14820
|
+
);
|
14821
14821
|
} catch (e) {
|
14822
14822
|
console.error(e);
|
14823
14823
|
}
|
@@ -14835,15 +14835,19 @@ var init_migrate = __esm({
|
|
14835
14835
|
const validatedPrev = sqliteSchema.parse(prev);
|
14836
14836
|
const validatedCur = sqliteSchema.parse(cur);
|
14837
14837
|
if (config.custom) {
|
14838
|
-
writeResult(
|
14839
|
-
|
14840
|
-
|
14838
|
+
writeResult(
|
14839
|
+
custom,
|
14840
|
+
[],
|
14841
14841
|
journal,
|
14842
|
+
{
|
14843
|
+
columns: {},
|
14844
|
+
schemas: {},
|
14845
|
+
tables: {}
|
14846
|
+
},
|
14842
14847
|
outFolder,
|
14843
|
-
|
14844
|
-
|
14845
|
-
|
14846
|
-
});
|
14848
|
+
config.breakpoints,
|
14849
|
+
"custom"
|
14850
|
+
);
|
14847
14851
|
return;
|
14848
14852
|
}
|
14849
14853
|
const squashedPrev = squashSqliteScheme(validatedPrev);
|
@@ -14853,15 +14857,14 @@ var init_migrate = __esm({
|
|
14853
14857
|
squashedCur,
|
14854
14858
|
"sqlite"
|
14855
14859
|
);
|
14856
|
-
writeResult(
|
14860
|
+
writeResult(
|
14857
14861
|
cur,
|
14858
14862
|
sqlStatements,
|
14859
14863
|
journal,
|
14860
14864
|
_meta,
|
14861
14865
|
outFolder,
|
14862
|
-
|
14863
|
-
|
14864
|
-
});
|
14866
|
+
config.breakpoints
|
14867
|
+
);
|
14865
14868
|
} catch (e) {
|
14866
14869
|
console.error(e);
|
14867
14870
|
}
|
@@ -15049,20 +15052,7 @@ var init_migrate = __esm({
|
|
15049
15052
|
return result;
|
15050
15053
|
};
|
15051
15054
|
BREAKPOINT = "--> statement-breakpoint\n";
|
15052
|
-
writeResult = ({
|
15053
|
-
cur,
|
15054
|
-
sqlStatements,
|
15055
|
-
journal,
|
15056
|
-
_meta = {
|
15057
|
-
columns: {},
|
15058
|
-
schemas: {},
|
15059
|
-
tables: {}
|
15060
|
-
},
|
15061
|
-
outFolder,
|
15062
|
-
breakpoints,
|
15063
|
-
bundle = false,
|
15064
|
-
type = "none"
|
15065
|
-
}) => {
|
15055
|
+
writeResult = (cur, sqlStatements, journal, _meta, outFolder, breakpoints, type = "none") => {
|
15066
15056
|
if (type === "none") {
|
15067
15057
|
console.log(schema(cur));
|
15068
15058
|
if (sqlStatements.length === 0) {
|
@@ -15103,10 +15093,6 @@ ${sql2}
|
|
15103
15093
|
});
|
15104
15094
|
import_fs3.default.writeFileSync(metaJournal, JSON.stringify(journal, null, 2));
|
15105
15095
|
import_fs3.default.writeFileSync(`${outFolder}/${tag}.sql`, sql2);
|
15106
|
-
if (bundle) {
|
15107
|
-
const js = embeddedMigrations(journal);
|
15108
|
-
import_fs3.default.writeFileSync(`${outFolder}/migrations.js`, js);
|
15109
|
-
}
|
15110
15096
|
(0, import_hanji3.render)(
|
15111
15097
|
`[${source_default.green(
|
15112
15098
|
"\u2713"
|
@@ -15115,22 +15101,6 @@ ${sql2}
|
|
15115
15101
|
)} \u{1F680}`
|
15116
15102
|
);
|
15117
15103
|
};
|
15118
|
-
embeddedMigrations = (journal) => {
|
15119
|
-
let content = "import journal from './meta/_journal.json';\n";
|
15120
|
-
journal.entries.forEach((entry) => {
|
15121
|
-
content += `import m${entry.idx.toString().padStart(4, "0")} from './${entry.tag}.sql';
|
15122
|
-
`;
|
15123
|
-
});
|
15124
|
-
content += `
|
15125
|
-
export default {
|
15126
|
-
journal,
|
15127
|
-
migrations: {
|
15128
|
-
${journal.entries.map((it) => `m${it.idx.toString().padStart(4, "0")}`).join(",\n")}
|
15129
|
-
}
|
15130
|
-
}
|
15131
|
-
`;
|
15132
|
-
return content;
|
15133
|
-
};
|
15134
15104
|
prepareSnapshotFolderName = () => {
|
15135
15105
|
const now = /* @__PURE__ */ new Date();
|
15136
15106
|
return `${now.getFullYear()}${two(now.getUTCMonth() + 1)}${two(
|