drizzle-kit 0.20.7-c9519c9 → 0.20.8-883376b
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +797 -783
- package/cli/commands/migrate.d.ts +11 -1
- package/cli/commands/utils.d.ts +9 -0
- package/cli/validations/mysql.d.ts +6 -6
- package/cli/validations/pg.d.ts +12 -12
- package/index.d.mts +2 -0
- package/index.d.ts +2 -0
- package/package.json +3 -2
- package/serializer/pgSerializer.d.ts +0 -2
- package/serializer/schemaToDrizzle.d.ts +7 -0
- package/serializer/sqliteSerializer.d.ts +0 -2
- package/serializer/studioUtils.d.ts +4 -4
- package/utils-studio.d.mts +2 -2
- package/utils-studio.d.ts +2 -2
- package/utils-studio.js +959 -957
- package/utils-studio.mjs +624 -622
- package/utils.js +250 -213
@@ -256,5 +256,15 @@ 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: (cur
|
259
|
+
export declare const writeResult: ({ cur, sqlStatements, journal, _meta, outFolder, breakpoints, bundle, type, }: {
|
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;
|
260
270
|
export declare const prepareSnapshotFolderName: () => string;
|
package/cli/commands/utils.d.ts
CHANGED
@@ -7,6 +7,7 @@ export type GenerateConfig = {
|
|
7
7
|
out: string;
|
8
8
|
breakpoints: boolean;
|
9
9
|
custom: boolean;
|
10
|
+
bundle: boolean;
|
10
11
|
};
|
11
12
|
export declare const prepareGenerateConfig: (options: {
|
12
13
|
schema?: string | string[];
|
@@ -20,14 +21,17 @@ export declare const assertOutFolder: (it: {
|
|
20
21
|
} | {
|
21
22
|
out: string;
|
22
23
|
}) => 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">]>;
|
23
25
|
export declare const configCommonSchema: import("zod").ZodObject<{
|
24
26
|
schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
|
25
27
|
out: import("zod").ZodOptional<import("zod").ZodString>;
|
26
28
|
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">]>>;
|
27
30
|
tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
|
28
31
|
schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
|
29
32
|
}, "strip", import("zod").ZodTypeAny, {
|
30
33
|
out?: string | undefined;
|
34
|
+
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
31
35
|
tablesFilter?: string | string[] | undefined;
|
32
36
|
schema: string | string[];
|
33
37
|
breakpoints: boolean;
|
@@ -35,6 +39,7 @@ export declare const configCommonSchema: import("zod").ZodObject<{
|
|
35
39
|
}, {
|
36
40
|
out?: string | undefined;
|
37
41
|
breakpoints?: boolean | undefined;
|
42
|
+
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
38
43
|
tablesFilter?: string | string[] | undefined;
|
39
44
|
schemaFilter?: string | string[] | undefined;
|
40
45
|
schema: string | string[];
|
@@ -164,10 +169,12 @@ export declare const mySqlCliConfigSchema: import("zod").ZodIntersection<import(
|
|
164
169
|
schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
|
165
170
|
out: import("zod").ZodOptional<import("zod").ZodString>;
|
166
171
|
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">]>>;
|
167
173
|
tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
|
168
174
|
schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
|
169
175
|
}, "strip", import("zod").ZodTypeAny, {
|
170
176
|
out?: string | undefined;
|
177
|
+
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
171
178
|
tablesFilter?: string | string[] | undefined;
|
172
179
|
schema: string | string[];
|
173
180
|
breakpoints: boolean;
|
@@ -175,6 +182,7 @@ export declare const mySqlCliConfigSchema: import("zod").ZodIntersection<import(
|
|
175
182
|
}, {
|
176
183
|
out?: string | undefined;
|
177
184
|
breakpoints?: boolean | undefined;
|
185
|
+
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
178
186
|
tablesFilter?: string | string[] | undefined;
|
179
187
|
schemaFilter?: string | string[] | undefined;
|
180
188
|
schema: string | string[];
|
@@ -261,5 +269,6 @@ export declare const mySqlIntrospectConfigSchema: import("zod").ZodIntersection<
|
|
261
269
|
}>, import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>]>>;
|
262
270
|
export type MySqlCliConfig = TypeOf<typeof mySqlCliConfigSchema>;
|
263
271
|
export type CliConfig = MySqlCliConfig;
|
272
|
+
export type Driver = TypeOf<typeof driver>;
|
264
273
|
export declare const drizzleConfigFromFile: (configPath?: string) => Promise<CliConfig>;
|
265
274
|
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";
|
12
13
|
host: string;
|
13
14
|
user: string;
|
14
15
|
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";
|
20
21
|
host: string;
|
21
22
|
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";
|
220
221
|
host: string;
|
221
222
|
user: string;
|
222
223
|
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";
|
228
229
|
host: string;
|
229
230
|
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";
|
269
270
|
host: string;
|
270
271
|
user: string;
|
271
272
|
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";
|
277
278
|
host: string;
|
278
279
|
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";
|
16
17
|
host: string;
|
17
18
|
user: string;
|
18
19
|
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";
|
26
27
|
host: string;
|
27
28
|
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
|
-
connectionString: string;
|
36
35
|
driver: "pg";
|
36
|
+
connectionString: string;
|
37
37
|
}, {
|
38
38
|
type?: "url" | undefined;
|
39
|
-
connectionString: string;
|
40
39
|
driver: "pg";
|
40
|
+
connectionString: string;
|
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";
|
256
257
|
host: string;
|
257
258
|
user: string;
|
258
259
|
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";
|
266
267
|
host: string;
|
267
268
|
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
|
-
connectionString: string;
|
276
275
|
driver: "pg";
|
276
|
+
connectionString: string;
|
277
277
|
}, {
|
278
278
|
type?: "url" | undefined;
|
279
|
-
connectionString: string;
|
280
279
|
driver: "pg";
|
280
|
+
connectionString: string;
|
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";
|
314
315
|
host: string;
|
315
316
|
user: string;
|
316
317
|
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";
|
324
325
|
host: string;
|
325
326
|
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
|
-
connectionString: string;
|
334
333
|
driver: "pg";
|
334
|
+
connectionString: string;
|
335
335
|
}, {
|
336
336
|
type?: "url" | undefined;
|
337
|
-
connectionString: string;
|
338
337
|
driver: "pg";
|
338
|
+
connectionString: string;
|
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
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "drizzle-kit",
|
3
|
-
"version": "0.20.
|
3
|
+
"version": "0.20.8-883376b",
|
4
4
|
"repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
|
5
5
|
"author": "Drizzle Team",
|
6
6
|
"license": "MIT",
|
@@ -56,11 +56,12 @@
|
|
56
56
|
]
|
57
57
|
},
|
58
58
|
"dependencies": {
|
59
|
-
"@drizzle-team/studio": "^0.0.
|
59
|
+
"@drizzle-team/studio": "^0.0.37",
|
60
60
|
"@esbuild-kit/esm-loader": "^2.5.5",
|
61
61
|
"camelcase": "^7.0.1",
|
62
62
|
"chalk": "^5.2.0",
|
63
63
|
"commander": "^9.4.1",
|
64
|
+
"env-paths": "^3.0.0",
|
64
65
|
"esbuild": "^0.19.7",
|
65
66
|
"esbuild-register": "^3.5.0",
|
66
67
|
"glob": "^8.1.0",
|
@@ -1,9 +1,7 @@
|
|
1
1
|
import { AnyPgTable, PgEnum, PgSchema } from "drizzle-orm/pg-core";
|
2
|
-
import { Relations } from "drizzle-orm";
|
3
2
|
import type { IntrospectStage, IntrospectStatus } from "../cli/views";
|
4
3
|
import type { PgSchemaInternal } from "../serializer/pgSchema";
|
5
4
|
import type { DrizzleDbClient } from "../drivers";
|
6
5
|
export declare const indexName: (tableName: string, columns: string[]) => string;
|
7
6
|
export declare const generatePgSnapshot: (tables: AnyPgTable[], enums: PgEnum<any>[], schemas: PgSchema[], schemaFilter?: string[]) => PgSchemaInternal;
|
8
7
|
export declare const fromDatabase: (db: DrizzleDbClient, tablesFilter: ((table: string) => boolean) | undefined, schemaFilters: string[], progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<PgSchemaInternal>;
|
9
|
-
export declare const toDrizzle: (schema: PgSchemaInternal, schemaName: string) => Record<string, AnyPgTable | Relations>;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { Relations } from "drizzle-orm";
|
2
|
+
import { AnyPgTable } from "drizzle-orm/pg-core";
|
3
|
+
import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
4
|
+
import type { PgSchemaInternal } from "./pgSchema";
|
5
|
+
import type { SQLiteSchemaInternal } from "./sqliteSchema";
|
6
|
+
export declare const pgSchemaToDrizzle: (schema: PgSchemaInternal, schemaName: string) => Record<string, AnyPgTable | Relations>;
|
7
|
+
export declare const sqliteSchemaToDrizzle: (schema: SQLiteSchemaInternal) => Record<string, AnySQLiteTable | Relations>;
|
@@ -1,8 +1,6 @@
|
|
1
1
|
import type { SQLiteSchemaInternal } from "../serializer/sqliteSchema";
|
2
|
-
import { Relations } from "drizzle-orm";
|
3
2
|
import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
4
3
|
import type { IntrospectStage, IntrospectStatus } from "src/cli/views";
|
5
4
|
import type { DrizzleDbClient } from "src/drivers";
|
6
5
|
export declare const generateSqliteSnapshot: (tables: AnySQLiteTable[], enums: any[]) => SQLiteSchemaInternal;
|
7
6
|
export declare const fromDatabase: (db: DrizzleDbClient, tablesFilter?: (table: string) => boolean, progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<SQLiteSchemaInternal>;
|
8
|
-
export declare const toDrizzle: (schema: SQLiteSchemaInternal) => Record<string, AnySQLiteTable | Relations>;
|
@@ -21,7 +21,7 @@ export declare const prepareSQLiteSchema: (path: string | string[]) => Promise<{
|
|
21
21
|
export declare const prepareModels: (path: string | string[]) => Promise<{
|
22
22
|
pgSchema: Record<string, AnyPgTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
23
23
|
mysqlSchema: Record<string, AnyMySqlTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
24
|
-
sqliteSchema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string
|
24
|
+
sqliteSchema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
25
25
|
}>;
|
26
26
|
export declare const drizzleForPostgres: (connectionConfig: PgConnectionConfig, pgSchema: Record<string, Record<string, AnyPgTable>>, relations: Record<string, Relations>, ts: {
|
27
27
|
imports: string;
|
@@ -53,13 +53,13 @@ export declare const drizzleDb: (drizzleConfig: StudioConfigConnections, models:
|
|
53
53
|
} | {
|
54
54
|
db: import("../orm-extenstions/d1-driver/driver").DrizzleD1WranglerDatabase<Record<string, never>>;
|
55
55
|
type: "sqlite";
|
56
|
-
schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string
|
56
|
+
schema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
57
57
|
} | {
|
58
58
|
db: import("drizzle-orm/better-sqlite3").BetterSQLite3Database<Record<string, never>>;
|
59
59
|
type: "sqlite";
|
60
|
-
schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string
|
60
|
+
schema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
61
61
|
} | {
|
62
62
|
db: import("drizzle-orm/libsql").LibSQLDatabase<Record<string, never>>;
|
63
63
|
type: "sqlite";
|
64
|
-
schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string
|
64
|
+
schema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
65
65
|
}>;
|
package/utils-studio.d.mts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
export {
|
2
|
-
export {
|
1
|
+
export { pgSchemaToDrizzle as drizzleSchemaPg } from "./serializer/schemaToDrizzle";
|
2
|
+
export { sqliteSchemaToDrizzle as drizzleSchemaSQLite } from "./serializer/schemaToDrizzle";
|
3
3
|
export { sqlitePushIntrospect } from "./cli/commands/sqliteIntrospect";
|
4
4
|
export { pgPushIntrospect } from "./cli/commands/pgIntrospect";
|
5
5
|
export { DrizzleORMPgClient, TursoSqlite } from "./drivers";
|
package/utils-studio.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
export {
|
2
|
-
export {
|
1
|
+
export { pgSchemaToDrizzle as drizzleSchemaPg } from "./serializer/schemaToDrizzle";
|
2
|
+
export { sqliteSchemaToDrizzle as drizzleSchemaSQLite } from "./serializer/schemaToDrizzle";
|
3
3
|
export { sqlitePushIntrospect } from "./cli/commands/sqliteIntrospect";
|
4
4
|
export { pgPushIntrospect } from "./cli/commands/pgIntrospect";
|
5
5
|
export { DrizzleORMPgClient, TursoSqlite } from "./drivers";
|