drizzle-kit 0.20.0-5198fb7 → 0.20.0-c31f6ba
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/cli/commands/migrate.d.ts +1 -1
- package/cli/validations/pg.d.ts +18 -18
- package/cli/validations/studio.d.ts +14 -14
- package/index.cjs +114 -25
- package/index.d.ts +1 -0
- package/package.json +2 -2
- package/serializer/pgSchema.d.ts +16 -16
- package/serializer/pgSerializer.d.ts +2 -0
- package/serializer/studioUtils.d.ts +4 -4
- package/utils.d.ts +211 -12
- package/utils.js +138 -26
- package/utilsR.d.ts +0 -232
|
@@ -3,7 +3,7 @@ import { schema } from "../views";
|
|
|
3
3
|
import { PgSchema } from "src/serializer/pgSchema";
|
|
4
4
|
import { SQLiteSchema } from "src/serializer/sqliteSchema";
|
|
5
5
|
import { MySqlSchema } from "src/serializer/mysqlSchema";
|
|
6
|
-
import { Journal } from "src/
|
|
6
|
+
import { Journal } from "src/utils";
|
|
7
7
|
import { GenerateConfig } from "./utils";
|
|
8
8
|
export type Named = {
|
|
9
9
|
name: string;
|
package/cli/validations/pg.d.ts
CHANGED
|
@@ -48,12 +48,12 @@ export declare const pgConnectionConfig: import("zod").ZodUnion<[import("zod").Z
|
|
|
48
48
|
password: import("zod").ZodOptional<import("zod").ZodString>;
|
|
49
49
|
database: import("zod").ZodString;
|
|
50
50
|
ssl: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
51
|
-
type: import("zod").ZodDefault<import("zod").ZodLiteral<"params"
|
|
51
|
+
type: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodLiteral<"params">>>;
|
|
52
52
|
}, "strip", import("zod").ZodTypeAny, {
|
|
53
|
+
type?: "params" | undefined;
|
|
53
54
|
port?: number | undefined;
|
|
54
55
|
password?: string | undefined;
|
|
55
56
|
ssl?: boolean | undefined;
|
|
56
|
-
type: "params";
|
|
57
57
|
host: string;
|
|
58
58
|
user: string;
|
|
59
59
|
database: string;
|
|
@@ -69,10 +69,10 @@ export declare const pgConnectionConfig: import("zod").ZodUnion<[import("zod").Z
|
|
|
69
69
|
}, "strip", import("zod").ZodTypeAny, {
|
|
70
70
|
driver: "pg";
|
|
71
71
|
dbCredentials: {
|
|
72
|
+
type?: "params" | undefined;
|
|
72
73
|
port?: number | undefined;
|
|
73
74
|
password?: string | undefined;
|
|
74
75
|
ssl?: boolean | undefined;
|
|
75
|
-
type: "params";
|
|
76
76
|
host: string;
|
|
77
77
|
user: string;
|
|
78
78
|
database: string;
|
|
@@ -92,9 +92,9 @@ export declare const pgConnectionConfig: import("zod").ZodUnion<[import("zod").Z
|
|
|
92
92
|
driver: import("zod").ZodLiteral<"pg">;
|
|
93
93
|
dbCredentials: import("zod").ZodObject<{
|
|
94
94
|
connectionString: import("zod").ZodString;
|
|
95
|
-
type: import("zod").ZodDefault<import("zod").ZodLiteral<"url"
|
|
95
|
+
type: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodLiteral<"url">>>;
|
|
96
96
|
}, "strip", import("zod").ZodTypeAny, {
|
|
97
|
-
type
|
|
97
|
+
type?: "url" | undefined;
|
|
98
98
|
connectionString: string;
|
|
99
99
|
}, {
|
|
100
100
|
type?: "url" | undefined;
|
|
@@ -103,7 +103,7 @@ export declare const pgConnectionConfig: import("zod").ZodUnion<[import("zod").Z
|
|
|
103
103
|
}, "strip", import("zod").ZodTypeAny, {
|
|
104
104
|
driver: "pg";
|
|
105
105
|
dbCredentials: {
|
|
106
|
-
type
|
|
106
|
+
type?: "url" | undefined;
|
|
107
107
|
connectionString: string;
|
|
108
108
|
};
|
|
109
109
|
}, {
|
|
@@ -153,12 +153,12 @@ export declare const pgConfigIntrospectSchema: import("zod").ZodIntersection<imp
|
|
|
153
153
|
password: import("zod").ZodOptional<import("zod").ZodString>;
|
|
154
154
|
database: import("zod").ZodString;
|
|
155
155
|
ssl: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
156
|
-
type: import("zod").ZodDefault<import("zod").ZodLiteral<"params"
|
|
156
|
+
type: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodLiteral<"params">>>;
|
|
157
157
|
}, "strip", import("zod").ZodTypeAny, {
|
|
158
|
+
type?: "params" | undefined;
|
|
158
159
|
port?: number | undefined;
|
|
159
160
|
password?: string | undefined;
|
|
160
161
|
ssl?: boolean | undefined;
|
|
161
|
-
type: "params";
|
|
162
162
|
host: string;
|
|
163
163
|
user: string;
|
|
164
164
|
database: string;
|
|
@@ -174,10 +174,10 @@ export declare const pgConfigIntrospectSchema: import("zod").ZodIntersection<imp
|
|
|
174
174
|
}, "strip", import("zod").ZodTypeAny, {
|
|
175
175
|
driver: "pg";
|
|
176
176
|
dbCredentials: {
|
|
177
|
+
type?: "params" | undefined;
|
|
177
178
|
port?: number | undefined;
|
|
178
179
|
password?: string | undefined;
|
|
179
180
|
ssl?: boolean | undefined;
|
|
180
|
-
type: "params";
|
|
181
181
|
host: string;
|
|
182
182
|
user: string;
|
|
183
183
|
database: string;
|
|
@@ -197,9 +197,9 @@ export declare const pgConfigIntrospectSchema: import("zod").ZodIntersection<imp
|
|
|
197
197
|
driver: import("zod").ZodLiteral<"pg">;
|
|
198
198
|
dbCredentials: import("zod").ZodObject<{
|
|
199
199
|
connectionString: import("zod").ZodString;
|
|
200
|
-
type: import("zod").ZodDefault<import("zod").ZodLiteral<"url"
|
|
200
|
+
type: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodLiteral<"url">>>;
|
|
201
201
|
}, "strip", import("zod").ZodTypeAny, {
|
|
202
|
-
type
|
|
202
|
+
type?: "url" | undefined;
|
|
203
203
|
connectionString: string;
|
|
204
204
|
}, {
|
|
205
205
|
type?: "url" | undefined;
|
|
@@ -208,7 +208,7 @@ export declare const pgConfigIntrospectSchema: import("zod").ZodIntersection<imp
|
|
|
208
208
|
}, "strip", import("zod").ZodTypeAny, {
|
|
209
209
|
driver: "pg";
|
|
210
210
|
dbCredentials: {
|
|
211
|
-
type
|
|
211
|
+
type?: "url" | undefined;
|
|
212
212
|
connectionString: string;
|
|
213
213
|
};
|
|
214
214
|
}, {
|
|
@@ -364,12 +364,12 @@ export declare const pgConfigPushParams: import("zod").ZodIntersection<import("z
|
|
|
364
364
|
password: import("zod").ZodOptional<import("zod").ZodString>;
|
|
365
365
|
database: import("zod").ZodString;
|
|
366
366
|
ssl: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
367
|
-
type: import("zod").ZodDefault<import("zod").ZodLiteral<"params"
|
|
367
|
+
type: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodLiteral<"params">>>;
|
|
368
368
|
}, "strip", import("zod").ZodTypeAny, {
|
|
369
|
+
type?: "params" | undefined;
|
|
369
370
|
port?: number | undefined;
|
|
370
371
|
password?: string | undefined;
|
|
371
372
|
ssl?: boolean | undefined;
|
|
372
|
-
type: "params";
|
|
373
373
|
host: string;
|
|
374
374
|
user: string;
|
|
375
375
|
database: string;
|
|
@@ -385,10 +385,10 @@ export declare const pgConfigPushParams: import("zod").ZodIntersection<import("z
|
|
|
385
385
|
}, "strip", import("zod").ZodTypeAny, {
|
|
386
386
|
driver: "pg";
|
|
387
387
|
dbCredentials: {
|
|
388
|
+
type?: "params" | undefined;
|
|
388
389
|
port?: number | undefined;
|
|
389
390
|
password?: string | undefined;
|
|
390
391
|
ssl?: boolean | undefined;
|
|
391
|
-
type: "params";
|
|
392
392
|
host: string;
|
|
393
393
|
user: string;
|
|
394
394
|
database: string;
|
|
@@ -408,9 +408,9 @@ export declare const pgConfigPushParams: import("zod").ZodIntersection<import("z
|
|
|
408
408
|
driver: import("zod").ZodLiteral<"pg">;
|
|
409
409
|
dbCredentials: import("zod").ZodObject<{
|
|
410
410
|
connectionString: import("zod").ZodString;
|
|
411
|
-
type: import("zod").ZodDefault<import("zod").ZodLiteral<"url"
|
|
411
|
+
type: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodLiteral<"url">>>;
|
|
412
412
|
}, "strip", import("zod").ZodTypeAny, {
|
|
413
|
-
type
|
|
413
|
+
type?: "url" | undefined;
|
|
414
414
|
connectionString: string;
|
|
415
415
|
}, {
|
|
416
416
|
type?: "url" | undefined;
|
|
@@ -419,7 +419,7 @@ export declare const pgConfigPushParams: import("zod").ZodIntersection<import("z
|
|
|
419
419
|
}, "strip", import("zod").ZodTypeAny, {
|
|
420
420
|
driver: "pg";
|
|
421
421
|
dbCredentials: {
|
|
422
|
-
type
|
|
422
|
+
type?: "url" | undefined;
|
|
423
423
|
connectionString: string;
|
|
424
424
|
};
|
|
425
425
|
}, {
|
|
@@ -101,12 +101,12 @@ export declare const studioConfidConnections: import("zod").ZodUnion<[import("zo
|
|
|
101
101
|
password: import("zod").ZodOptional<import("zod").ZodString>;
|
|
102
102
|
database: import("zod").ZodString;
|
|
103
103
|
ssl: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
104
|
-
type: import("zod").ZodDefault<import("zod").ZodLiteral<"params"
|
|
104
|
+
type: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodLiteral<"params">>>;
|
|
105
105
|
}, "strip", import("zod").ZodTypeAny, {
|
|
106
|
+
type?: "params" | undefined;
|
|
106
107
|
port?: number | undefined;
|
|
107
108
|
password?: string | undefined;
|
|
108
109
|
ssl?: boolean | undefined;
|
|
109
|
-
type: "params";
|
|
110
110
|
host: string;
|
|
111
111
|
user: string;
|
|
112
112
|
database: string;
|
|
@@ -122,10 +122,10 @@ export declare const studioConfidConnections: import("zod").ZodUnion<[import("zo
|
|
|
122
122
|
}, "strip", import("zod").ZodTypeAny, {
|
|
123
123
|
driver: "pg";
|
|
124
124
|
dbCredentials: {
|
|
125
|
+
type?: "params" | undefined;
|
|
125
126
|
port?: number | undefined;
|
|
126
127
|
password?: string | undefined;
|
|
127
128
|
ssl?: boolean | undefined;
|
|
128
|
-
type: "params";
|
|
129
129
|
host: string;
|
|
130
130
|
user: string;
|
|
131
131
|
database: string;
|
|
@@ -145,9 +145,9 @@ export declare const studioConfidConnections: import("zod").ZodUnion<[import("zo
|
|
|
145
145
|
driver: import("zod").ZodLiteral<"pg">;
|
|
146
146
|
dbCredentials: import("zod").ZodObject<{
|
|
147
147
|
connectionString: import("zod").ZodString;
|
|
148
|
-
type: import("zod").ZodDefault<import("zod").ZodLiteral<"url"
|
|
148
|
+
type: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodLiteral<"url">>>;
|
|
149
149
|
}, "strip", import("zod").ZodTypeAny, {
|
|
150
|
-
type
|
|
150
|
+
type?: "url" | undefined;
|
|
151
151
|
connectionString: string;
|
|
152
152
|
}, {
|
|
153
153
|
type?: "url" | undefined;
|
|
@@ -156,7 +156,7 @@ export declare const studioConfidConnections: import("zod").ZodUnion<[import("zo
|
|
|
156
156
|
}, "strip", import("zod").ZodTypeAny, {
|
|
157
157
|
driver: "pg";
|
|
158
158
|
dbCredentials: {
|
|
159
|
-
type
|
|
159
|
+
type?: "url" | undefined;
|
|
160
160
|
connectionString: string;
|
|
161
161
|
};
|
|
162
162
|
}, {
|
|
@@ -335,12 +335,12 @@ export declare const studioConfigSchema: import("zod").ZodIntersection<import("z
|
|
|
335
335
|
password: import("zod").ZodOptional<import("zod").ZodString>;
|
|
336
336
|
database: import("zod").ZodString;
|
|
337
337
|
ssl: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
338
|
-
type: import("zod").ZodDefault<import("zod").ZodLiteral<"params"
|
|
338
|
+
type: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodLiteral<"params">>>;
|
|
339
339
|
}, "strip", import("zod").ZodTypeAny, {
|
|
340
|
+
type?: "params" | undefined;
|
|
340
341
|
port?: number | undefined;
|
|
341
342
|
password?: string | undefined;
|
|
342
343
|
ssl?: boolean | undefined;
|
|
343
|
-
type: "params";
|
|
344
344
|
host: string;
|
|
345
345
|
user: string;
|
|
346
346
|
database: string;
|
|
@@ -356,10 +356,10 @@ export declare const studioConfigSchema: import("zod").ZodIntersection<import("z
|
|
|
356
356
|
}, "strip", import("zod").ZodTypeAny, {
|
|
357
357
|
driver: "pg";
|
|
358
358
|
dbCredentials: {
|
|
359
|
+
type?: "params" | undefined;
|
|
359
360
|
port?: number | undefined;
|
|
360
361
|
password?: string | undefined;
|
|
361
362
|
ssl?: boolean | undefined;
|
|
362
|
-
type: "params";
|
|
363
363
|
host: string;
|
|
364
364
|
user: string;
|
|
365
365
|
database: string;
|
|
@@ -379,9 +379,9 @@ export declare const studioConfigSchema: import("zod").ZodIntersection<import("z
|
|
|
379
379
|
driver: import("zod").ZodLiteral<"pg">;
|
|
380
380
|
dbCredentials: import("zod").ZodObject<{
|
|
381
381
|
connectionString: import("zod").ZodString;
|
|
382
|
-
type: import("zod").ZodDefault<import("zod").ZodLiteral<"url"
|
|
382
|
+
type: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodLiteral<"url">>>;
|
|
383
383
|
}, "strip", import("zod").ZodTypeAny, {
|
|
384
|
-
type
|
|
384
|
+
type?: "url" | undefined;
|
|
385
385
|
connectionString: string;
|
|
386
386
|
}, {
|
|
387
387
|
type?: "url" | undefined;
|
|
@@ -390,7 +390,7 @@ export declare const studioConfigSchema: import("zod").ZodIntersection<import("z
|
|
|
390
390
|
}, "strip", import("zod").ZodTypeAny, {
|
|
391
391
|
driver: "pg";
|
|
392
392
|
dbCredentials: {
|
|
393
|
-
type
|
|
393
|
+
type?: "url" | undefined;
|
|
394
394
|
connectionString: string;
|
|
395
395
|
};
|
|
396
396
|
}, {
|
|
@@ -493,10 +493,10 @@ export declare const validateStudio: (options: any) => Promise<{
|
|
|
493
493
|
} & ({
|
|
494
494
|
driver: "pg";
|
|
495
495
|
dbCredentials: {
|
|
496
|
+
type?: "params" | undefined;
|
|
496
497
|
port?: number | undefined;
|
|
497
498
|
password?: string | undefined;
|
|
498
499
|
ssl?: boolean | undefined;
|
|
499
|
-
type: "params";
|
|
500
500
|
host: string;
|
|
501
501
|
user: string;
|
|
502
502
|
database: string;
|
|
@@ -504,7 +504,7 @@ export declare const validateStudio: (options: any) => Promise<{
|
|
|
504
504
|
} | {
|
|
505
505
|
driver: "pg";
|
|
506
506
|
dbCredentials: {
|
|
507
|
-
type
|
|
507
|
+
type?: "url" | undefined;
|
|
508
508
|
connectionString: string;
|
|
509
509
|
};
|
|
510
510
|
} | {
|
package/index.cjs
CHANGED
|
@@ -4555,7 +4555,7 @@ var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, d
|
|
|
4555
4555
|
var init_mysqlSchema = __esm({
|
|
4556
4556
|
"src/serializer/mysqlSchema.ts"() {
|
|
4557
4557
|
init_global();
|
|
4558
|
-
|
|
4558
|
+
init_utils4();
|
|
4559
4559
|
init_lib();
|
|
4560
4560
|
index = objectType({
|
|
4561
4561
|
name: stringType(),
|
|
@@ -4835,7 +4835,7 @@ var indexV2, columnV2, tableV2, enumSchema, pgSchemaV2, references, columnV1, ta
|
|
|
4835
4835
|
var init_pgSchema = __esm({
|
|
4836
4836
|
"src/serializer/pgSchema.ts"() {
|
|
4837
4837
|
init_global();
|
|
4838
|
-
|
|
4838
|
+
init_utils4();
|
|
4839
4839
|
init_lib();
|
|
4840
4840
|
indexV2 = objectType({
|
|
4841
4841
|
name: stringType(),
|
|
@@ -5193,7 +5193,7 @@ var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dia
|
|
|
5193
5193
|
var init_sqliteSchema = __esm({
|
|
5194
5194
|
"src/serializer/sqliteSchema.ts"() {
|
|
5195
5195
|
init_global();
|
|
5196
|
-
|
|
5196
|
+
init_utils4();
|
|
5197
5197
|
init_lib();
|
|
5198
5198
|
index3 = objectType({
|
|
5199
5199
|
name: stringType(),
|
|
@@ -12094,9 +12094,10 @@ var pgSerializer_exports = {};
|
|
|
12094
12094
|
__export(pgSerializer_exports, {
|
|
12095
12095
|
fromDatabase: () => fromDatabase2,
|
|
12096
12096
|
generatePgSnapshot: () => generatePgSnapshot,
|
|
12097
|
-
indexName: () => indexName2
|
|
12097
|
+
indexName: () => indexName2,
|
|
12098
|
+
toDrizzle: () => toDrizzle
|
|
12098
12099
|
});
|
|
12099
|
-
var import_pg_core2, import_pg_core3, import_drizzle_orm5, import_drizzle_orm6, dialect4, indexName2, generatePgSnapshot, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
|
|
12100
|
+
var import_pg_core2, import_pg_core3, import_drizzle_orm5, import_drizzle_orm6, dialect4, indexName2, generatePgSnapshot, trimChar, fromDatabase2, columnToDefault, defaultForColumn, toDrizzle;
|
|
12100
12101
|
var init_pgSerializer = __esm({
|
|
12101
12102
|
"src/serializer/pgSerializer.ts"() {
|
|
12102
12103
|
import_pg_core2 = require("drizzle-orm/pg-core");
|
|
@@ -12707,6 +12708,94 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
|
12707
12708
|
}
|
|
12708
12709
|
}
|
|
12709
12710
|
};
|
|
12711
|
+
toDrizzle = (schema4) => {
|
|
12712
|
+
const tables = {};
|
|
12713
|
+
Object.values(schema4.tables).forEach((t) => {
|
|
12714
|
+
const columns = {};
|
|
12715
|
+
Object.values(t.columns).forEach((c) => {
|
|
12716
|
+
const columnName = c.name;
|
|
12717
|
+
const type = c.type;
|
|
12718
|
+
let columnBuilder;
|
|
12719
|
+
if (type === "bigint") {
|
|
12720
|
+
columnBuilder = new import_pg_core2.PgBigInt53Builder(columnName);
|
|
12721
|
+
} else if (type === "bigserial") {
|
|
12722
|
+
columnBuilder = new import_pg_core2.PgBigSerial53Builder(columnName);
|
|
12723
|
+
} else if (type === "boolean") {
|
|
12724
|
+
columnBuilder = new import_pg_core2.PgBooleanBuilder(columnName);
|
|
12725
|
+
} else if (type === "cidr") {
|
|
12726
|
+
columnBuilder = new import_pg_core2.PgCidrBuilder(columnName);
|
|
12727
|
+
} else if (type === "date") {
|
|
12728
|
+
columnBuilder = new import_pg_core2.PgDateBuilder(columnName);
|
|
12729
|
+
} else if (type === "double precision") {
|
|
12730
|
+
columnBuilder = new import_pg_core2.PgDoublePrecisionBuilder(columnName);
|
|
12731
|
+
} else if (type === "inet") {
|
|
12732
|
+
columnBuilder = new import_pg_core2.PgInetBuilder(columnName);
|
|
12733
|
+
} else if (type === "integer") {
|
|
12734
|
+
columnBuilder = new import_pg_core2.PgIntegerBuilder(columnName);
|
|
12735
|
+
} else if (type === "interval" || type.startsWith("interval ")) {
|
|
12736
|
+
columnBuilder = new import_pg_core2.PgIntervalBuilder(columnName, {});
|
|
12737
|
+
} else if (type === "json") {
|
|
12738
|
+
columnBuilder = new import_pg_core2.PgJsonBuilder(columnName);
|
|
12739
|
+
} else if (type === "jsonb") {
|
|
12740
|
+
columnBuilder = new import_pg_core2.PgJsonbBuilder(columnName);
|
|
12741
|
+
} else if (type === "macaddr") {
|
|
12742
|
+
columnBuilder = new import_pg_core2.PgMacaddrBuilder(columnName);
|
|
12743
|
+
} else if (type === "macaddr8") {
|
|
12744
|
+
columnBuilder = new import_pg_core2.PgMacaddr8Builder(columnName);
|
|
12745
|
+
} else if (type === "numeric" || type.startsWith("numeric(")) {
|
|
12746
|
+
columnBuilder = new import_pg_core2.PgNumericBuilder(columnName);
|
|
12747
|
+
} else if (type === "real") {
|
|
12748
|
+
columnBuilder = new import_pg_core2.PgRealBuilder(columnName);
|
|
12749
|
+
} else if (type === "serial") {
|
|
12750
|
+
columnBuilder = new import_pg_core2.PgSerialBuilder(columnName);
|
|
12751
|
+
} else if (type === "smallint") {
|
|
12752
|
+
columnBuilder = new import_pg_core2.PgSmallIntBuilder(columnName);
|
|
12753
|
+
} else if (type === "smallserial") {
|
|
12754
|
+
columnBuilder = new import_pg_core2.PgSmallSerialBuilder(columnName);
|
|
12755
|
+
} else if (type === "text") {
|
|
12756
|
+
columnBuilder = new import_pg_core2.PgTextBuilder(columnName, {});
|
|
12757
|
+
} else if (type === "time" || type.startsWith("time(") || type === "time with time zone") {
|
|
12758
|
+
columnBuilder = new import_pg_core2.PgTimeBuilder(columnName, false, void 0);
|
|
12759
|
+
} else if (type === "timestamp" || type.startsWith("timestamp(") || type === "timestamp with time zone") {
|
|
12760
|
+
columnBuilder = new import_pg_core2.PgTimestampBuilder(columnName, false, void 0);
|
|
12761
|
+
} else if (type === "uuid") {
|
|
12762
|
+
columnBuilder = new import_pg_core2.PgUUIDBuilder(columnName);
|
|
12763
|
+
} else if (type === "varchar" || type.startsWith("varchar(")) {
|
|
12764
|
+
columnBuilder = new import_pg_core2.PgVarcharBuilder(columnName, {});
|
|
12765
|
+
} else if (type === "char" || type.startsWith("char(")) {
|
|
12766
|
+
columnBuilder = new import_pg_core2.PgCharBuilder(columnName, {});
|
|
12767
|
+
} else {
|
|
12768
|
+
columnBuilder = (0, import_pg_core2.customType)({
|
|
12769
|
+
dataType() {
|
|
12770
|
+
return type;
|
|
12771
|
+
}
|
|
12772
|
+
})(columnName);
|
|
12773
|
+
}
|
|
12774
|
+
if (c.notNull) {
|
|
12775
|
+
columnBuilder = columnBuilder.notNull();
|
|
12776
|
+
}
|
|
12777
|
+
if (c.default) {
|
|
12778
|
+
columnBuilder = columnBuilder.default(c.default);
|
|
12779
|
+
}
|
|
12780
|
+
if (c.primaryKey) {
|
|
12781
|
+
columnBuilder = columnBuilder.primaryKey();
|
|
12782
|
+
}
|
|
12783
|
+
columns[columnName] = columnBuilder;
|
|
12784
|
+
});
|
|
12785
|
+
tables[t.name] = (0, import_pg_core2.pgTable)(t.name, columns, (cb) => {
|
|
12786
|
+
const res = {};
|
|
12787
|
+
Object.values(t.compositePrimaryKeys).forEach((cpk) => {
|
|
12788
|
+
const gh = cpk.columns.map((c) => cb[c]);
|
|
12789
|
+
res[cpk.name] = new import_pg_core2.PrimaryKeyBuilder(
|
|
12790
|
+
gh,
|
|
12791
|
+
cpk.name
|
|
12792
|
+
);
|
|
12793
|
+
});
|
|
12794
|
+
return res;
|
|
12795
|
+
});
|
|
12796
|
+
});
|
|
12797
|
+
return tables;
|
|
12798
|
+
};
|
|
12710
12799
|
}
|
|
12711
12800
|
});
|
|
12712
12801
|
|
|
@@ -12746,7 +12835,7 @@ var sqliteSerializer_exports = {};
|
|
|
12746
12835
|
__export(sqliteSerializer_exports, {
|
|
12747
12836
|
fromDatabase: () => fromDatabase3,
|
|
12748
12837
|
generateSqliteSnapshot: () => generateSqliteSnapshot,
|
|
12749
|
-
toDrizzle: () =>
|
|
12838
|
+
toDrizzle: () => toDrizzle2
|
|
12750
12839
|
});
|
|
12751
12840
|
function mapSqlToSqliteType(sqlType) {
|
|
12752
12841
|
if ([
|
|
@@ -12783,7 +12872,7 @@ function mapSqlToSqliteType(sqlType) {
|
|
|
12783
12872
|
return "numeric";
|
|
12784
12873
|
}
|
|
12785
12874
|
}
|
|
12786
|
-
var import_drizzle_orm8, import_drizzle_orm9, import_sqlite_core2, dialect5, generateSqliteSnapshot, fromDatabase3,
|
|
12875
|
+
var import_drizzle_orm8, import_drizzle_orm9, import_sqlite_core2, dialect5, generateSqliteSnapshot, fromDatabase3, toDrizzle2;
|
|
12787
12876
|
var init_sqliteSerializer = __esm({
|
|
12788
12877
|
"src/serializer/sqliteSerializer.ts"() {
|
|
12789
12878
|
import_drizzle_orm8 = require("drizzle-orm");
|
|
@@ -13152,7 +13241,7 @@ WHERE
|
|
|
13152
13241
|
}
|
|
13153
13242
|
};
|
|
13154
13243
|
};
|
|
13155
|
-
|
|
13244
|
+
toDrizzle2 = (schema4) => {
|
|
13156
13245
|
const tables = {};
|
|
13157
13246
|
Object.values(schema4.tables).forEach((t) => {
|
|
13158
13247
|
const columns = {};
|
|
@@ -14717,7 +14806,7 @@ var init_migrate = __esm({
|
|
|
14717
14806
|
init_pgSchema();
|
|
14718
14807
|
init_sqliteSchema();
|
|
14719
14808
|
init_mysqlSchema();
|
|
14720
|
-
|
|
14809
|
+
init_utils4();
|
|
14721
14810
|
init_words();
|
|
14722
14811
|
init_outputs();
|
|
14723
14812
|
prepareAndMigratePg = async (config) => {
|
|
@@ -16987,12 +17076,13 @@ var init_jsonStatements = __esm({
|
|
|
16987
17076
|
};
|
|
16988
17077
|
prepareAddCompositePrimaryKeyPg = (tableName, schema4, pks, json2) => {
|
|
16989
17078
|
return Object.values(pks).map((it) => {
|
|
17079
|
+
const unsquashed = MySqlSquasher.unsquashPK(it);
|
|
16990
17080
|
return {
|
|
16991
17081
|
type: "create_composite_pk",
|
|
16992
17082
|
tableName,
|
|
16993
17083
|
data: it,
|
|
16994
17084
|
schema: schema4,
|
|
16995
|
-
constraintName: json2.tables[tableName].compositePrimaryKeys[
|
|
17085
|
+
constraintName: json2.tables[tableName].compositePrimaryKeys[unsquashed.name].name
|
|
16996
17086
|
};
|
|
16997
17087
|
});
|
|
16998
17088
|
};
|
|
@@ -17090,7 +17180,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
17090
17180
|
init_lib();
|
|
17091
17181
|
init_jsonDiffer();
|
|
17092
17182
|
init_jsonStatements();
|
|
17093
|
-
|
|
17183
|
+
init_utils4();
|
|
17094
17184
|
init_sqliteSchema();
|
|
17095
17185
|
init_mysqlSchema();
|
|
17096
17186
|
makeChanged = (schema4) => {
|
|
@@ -17400,8 +17490,6 @@ var init_snapshotsDiffer = __esm({
|
|
|
17400
17490
|
deletedColumns = SQLiteSquasher.unsquashPK(deletedPkColumns);
|
|
17401
17491
|
}
|
|
17402
17492
|
}
|
|
17403
|
-
addedColumns.sort();
|
|
17404
|
-
deletedColumns.sort();
|
|
17405
17493
|
const doPerformDeleteAndCreate = JSON.stringify(addedColumns) !== JSON.stringify(deletedColumns);
|
|
17406
17494
|
let addedCompositePKs = [];
|
|
17407
17495
|
let deletedCompositePKs = [];
|
|
@@ -17714,7 +17802,7 @@ var init_pgUp = __esm({
|
|
|
17714
17802
|
import_fs5 = require("fs");
|
|
17715
17803
|
init_global();
|
|
17716
17804
|
init_pgSchema();
|
|
17717
|
-
|
|
17805
|
+
init_utils4();
|
|
17718
17806
|
upPgHandlerV4toV5 = (obj) => {
|
|
17719
17807
|
const mappedTables = {};
|
|
17720
17808
|
for (const [key, table4] of Object.entries(obj.tables)) {
|
|
@@ -17951,7 +18039,7 @@ var init_mysqlUp = __esm({
|
|
|
17951
18039
|
init_source();
|
|
17952
18040
|
import_fs6 = __toESM(require("fs"));
|
|
17953
18041
|
init_mysqlSchema();
|
|
17954
|
-
|
|
18042
|
+
init_utils4();
|
|
17955
18043
|
upMysqlHandler = (out) => {
|
|
17956
18044
|
};
|
|
17957
18045
|
upMySqlHandlerV4toV5 = (obj) => {
|
|
@@ -18064,7 +18152,7 @@ var init_upFolders = __esm({
|
|
|
18064
18152
|
init_mysqlSchema();
|
|
18065
18153
|
init_sqliteSchema();
|
|
18066
18154
|
init_snapshotsDiffer();
|
|
18067
|
-
|
|
18155
|
+
init_utils4();
|
|
18068
18156
|
init_words();
|
|
18069
18157
|
init_pgUp();
|
|
18070
18158
|
init_pgSchema();
|
|
@@ -57999,10 +58087,10 @@ var init_studioUtils = __esm({
|
|
|
57999
58087
|
}
|
|
58000
58088
|
});
|
|
58001
58089
|
|
|
58002
|
-
// src/
|
|
58090
|
+
// src/utils.ts
|
|
58003
58091
|
var import_fs8, import_path5, assertV1OutFolder, dryJournal, snapshotsPriorV4, prepareOutFolder2, mapValues, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey;
|
|
58004
|
-
var
|
|
58005
|
-
"src/
|
|
58092
|
+
var init_utils4 = __esm({
|
|
58093
|
+
"src/utils.ts"() {
|
|
58006
58094
|
import_fs8 = require("fs");
|
|
58007
58095
|
init_views();
|
|
58008
58096
|
init_mysqlSchema();
|
|
@@ -58020,6 +58108,7 @@ var init_utilsR = __esm({
|
|
|
58020
58108
|
init_pgPushUtils();
|
|
58021
58109
|
init_sqliteIntrospect();
|
|
58022
58110
|
init_sqliteSerializer();
|
|
58111
|
+
init_pgSerializer();
|
|
58023
58112
|
init_studioUtils();
|
|
58024
58113
|
assertV1OutFolder = (out, dialect6) => {
|
|
58025
58114
|
if (!(0, import_fs8.existsSync)(out))
|
|
@@ -58460,14 +58549,14 @@ var init_pg = __esm({
|
|
|
58460
58549
|
password: stringType().optional(),
|
|
58461
58550
|
database: stringType(),
|
|
58462
58551
|
ssl: coerce.boolean().optional(),
|
|
58463
|
-
type: literalType("params").default("params")
|
|
58552
|
+
type: literalType("params").default("params").optional()
|
|
58464
58553
|
})
|
|
58465
58554
|
}),
|
|
58466
58555
|
objectType({
|
|
58467
58556
|
driver: literalType("pg"),
|
|
58468
58557
|
dbCredentials: objectType({
|
|
58469
58558
|
connectionString: stringType(),
|
|
58470
|
-
type: literalType("url").default("url")
|
|
58559
|
+
type: literalType("url").default("url").optional()
|
|
58471
58560
|
})
|
|
58472
58561
|
})
|
|
58473
58562
|
]);
|
|
@@ -59657,7 +59746,7 @@ var import_fs11 = require("fs");
|
|
|
59657
59746
|
init_lib();
|
|
59658
59747
|
|
|
59659
59748
|
// src/cli/commands/check.ts
|
|
59660
|
-
|
|
59749
|
+
init_utils4();
|
|
59661
59750
|
var checkHandler = (out, dialect6) => {
|
|
59662
59751
|
const { snapshots } = prepareOutFolder2(out, dialect6);
|
|
59663
59752
|
const report = validateWithReport(snapshots, dialect6);
|
|
@@ -59803,7 +59892,7 @@ var package_default = {
|
|
|
59803
59892
|
]
|
|
59804
59893
|
},
|
|
59805
59894
|
dependencies: {
|
|
59806
|
-
"@drizzle-team/studio": "^0.0.
|
|
59895
|
+
"@drizzle-team/studio": "^0.0.9",
|
|
59807
59896
|
"@esbuild-kit/esm-loader": "^2.5.5",
|
|
59808
59897
|
camelcase: "^7.0.1",
|
|
59809
59898
|
chalk: "^5.2.0",
|
|
@@ -59852,14 +59941,14 @@ var package_default = {
|
|
|
59852
59941
|
init_migrate();
|
|
59853
59942
|
init_utils2();
|
|
59854
59943
|
init_pgSchema();
|
|
59855
|
-
|
|
59944
|
+
init_utils4();
|
|
59856
59945
|
init_pgUp();
|
|
59857
59946
|
|
|
59858
59947
|
// src/cli/commands/sqliteUp.ts
|
|
59859
59948
|
init_source();
|
|
59860
59949
|
var import_fs9 = __toESM(require("fs"));
|
|
59861
59950
|
init_sqliteSchema();
|
|
59862
|
-
|
|
59951
|
+
init_utils4();
|
|
59863
59952
|
var upSqliteHandler = (out) => {
|
|
59864
59953
|
};
|
|
59865
59954
|
var upSqliteHandlerV4 = (out) => {
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drizzle-kit",
|
|
3
|
-
"version": "0.20.0-
|
|
3
|
+
"version": "0.20.0-c31f6ba",
|
|
4
4
|
"repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
|
|
5
5
|
"author": "Drizzle Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
]
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@drizzle-team/studio": "^0.0.
|
|
57
|
+
"@drizzle-team/studio": "^0.0.9",
|
|
58
58
|
"@esbuild-kit/esm-loader": "^2.5.5",
|
|
59
59
|
"camelcase": "^7.0.1",
|
|
60
60
|
"chalk": "^5.2.0",
|