drizzle-kit 0.20.14-1ebe0ff → 0.20.14-1f99bf7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/bin.cjs +46606 -46728
  2. package/cli/commands/migrate.d.ts +24 -24
  3. package/cli/commands/mysqlIntrospect.d.ts +119 -0
  4. package/cli/commands/mysqlPushUtils.d.ts +18 -0
  5. package/cli/commands/mysqlUp.d.ts +2 -2
  6. package/cli/commands/pgConnect.d.ts +1 -1
  7. package/cli/commands/pgIntrospect.d.ts +9 -9
  8. package/cli/commands/pgPushUtils.d.ts +2 -2
  9. package/cli/commands/pgUp.d.ts +2 -2
  10. package/cli/commands/sqliteIntrospect.d.ts +9 -9
  11. package/cli/commands/sqlitePushUtils.d.ts +21 -0
  12. package/cli/commands/upFolders.d.ts +1 -1
  13. package/cli/commands/utils.d.ts +14 -259
  14. package/cli/validations/cli.d.ts +104 -0
  15. package/cli/validations/common.d.ts +205 -7
  16. package/cli/validations/mysql.d.ts +6 -1
  17. package/cli/validations/pg.d.ts +6 -1
  18. package/cli/validations/sqlite.d.ts +165 -3
  19. package/cli/views.d.ts +1 -1
  20. package/drivers/index.d.ts +14 -0
  21. package/global.d.ts +2 -1
  22. package/index.d.mts +8 -6
  23. package/index.d.ts +8 -6
  24. package/index.js +1 -0
  25. package/introspect-mysql.d.ts +9 -0
  26. package/introspect-pg.d.ts +1 -1
  27. package/introspect-sqlite.d.ts +1 -1
  28. package/jsonStatements.d.ts +1 -1
  29. package/package.json +17 -4
  30. package/payload.d.mts +33 -0
  31. package/payload.d.ts +33 -0
  32. package/payload.js +37106 -0
  33. package/payload.mjs +37124 -0
  34. package/schemaValidator.d.ts +40 -40
  35. package/serializer/mysqlImports.d.ts +5 -0
  36. package/serializer/mysqlSchema.d.ts +1991 -753
  37. package/serializer/mysqlSerializer.d.ts +4 -4
  38. package/serializer/pgSchema.d.ts +1113 -788
  39. package/serializer/sqliteImports.d.ts +4 -0
  40. package/serializer/sqliteSchema.d.ts +144 -570
  41. package/serializer/sqliteSerializer.d.ts +2 -2
  42. package/snapshotsDiffer.d.ts +24 -20
  43. package/utils-studio.js +21 -8
  44. package/utils-studio.mjs +20 -8
  45. package/utils.d.ts +13 -27
  46. package/utils.js +3080 -54201
  47. package/utils.mjs +8175 -0
  48. package/cli/commands/sqliteUtils.d.ts +0 -162
  49. package/cli/utils.d.ts +0 -12
  50. package/cli/validations/studio.d.ts +0 -593
  51. package/orm-extenstions/d1-driver/driver.d.ts +0 -8
  52. package/orm-extenstions/d1-driver/session.d.ts +0 -51
  53. package/orm-extenstions/d1-driver/wrangler-client.d.ts +0 -3
  54. package/serializer/studioUtils.d.ts +0 -65
@@ -239,6 +239,7 @@ export declare const mysqlCliIntrospectParams: import("zod").ZodIntersection<imp
239
239
  uri: string;
240
240
  }>]>>;
241
241
  export declare const mysqlCliPushParams: import("zod").ZodIntersection<import("zod").ZodObject<{
242
+ dialect: import("zod").ZodEnum<["pg", "mysql", "sqlite"]>;
242
243
  schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
243
244
  tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
244
245
  schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
@@ -248,6 +249,7 @@ export declare const mysqlCliPushParams: import("zod").ZodIntersection<import("z
248
249
  tablesFilter?: string | string[] | undefined;
249
250
  strict: boolean;
250
251
  schema: string | string[];
252
+ dialect: "mysql" | "pg" | "sqlite";
251
253
  schemaFilter: string | string[];
252
254
  verbose: boolean;
253
255
  }, {
@@ -256,6 +258,7 @@ export declare const mysqlCliPushParams: import("zod").ZodIntersection<import("z
256
258
  schemaFilter?: string | string[] | undefined;
257
259
  verbose?: boolean | undefined;
258
260
  schema: string | string[];
261
+ dialect: "mysql" | "pg" | "sqlite";
259
262
  }>, import("zod").ZodUnion<[import("zod").ZodObject<{
260
263
  driver: import("zod").ZodLiteral<"mysql2">;
261
264
  host: import("zod").ZodString;
@@ -288,6 +291,7 @@ export declare const mysqlCliPushParams: import("zod").ZodIntersection<import("z
288
291
  uri: string;
289
292
  }>]>>;
290
293
  export declare const mysqlConfigPushParams: import("zod").ZodIntersection<import("zod").ZodObject<{
294
+ dialect: import("zod").ZodEnum<["pg", "mysql", "sqlite"]>;
291
295
  schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
292
296
  tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
293
297
  schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
@@ -297,6 +301,7 @@ export declare const mysqlConfigPushParams: import("zod").ZodIntersection<import
297
301
  tablesFilter?: string | string[] | undefined;
298
302
  strict: boolean;
299
303
  schema: string | string[];
304
+ dialect: "mysql" | "pg" | "sqlite";
300
305
  schemaFilter: string | string[];
301
306
  verbose: boolean;
302
307
  }, {
@@ -305,6 +310,7 @@ export declare const mysqlConfigPushParams: import("zod").ZodIntersection<import
305
310
  schemaFilter?: string | string[] | undefined;
306
311
  verbose?: boolean | undefined;
307
312
  schema: string | string[];
313
+ dialect: "mysql" | "pg" | "sqlite";
308
314
  }>, import("zod").ZodObject<{
309
315
  driver: import("zod").ZodLiteral<"mysql2">;
310
316
  dbCredentials: import("zod").ZodUnion<[import("zod").ZodObject<{
@@ -362,4 +368,3 @@ export type MySQLConnectionConfig = TypeOf<typeof mysqlConnectionConfig>;
362
368
  export declare const printCliConnectionIssues: (options: any) => void;
363
369
  export declare const printConfigConnectionIssues: (options: any) => void;
364
370
  export declare const validateMySqlIntrospect: (options: Record<string, any>) => Promise<MySQLConfigIntrospect>;
365
- export declare const validateMySqlPush: (options: Record<string, unknown>) => Promise<MySQLPushConfig>;
@@ -280,6 +280,7 @@ export declare const pgCliIntrospectParams: import("zod").ZodIntersection<import
280
280
  connectionString: string;
281
281
  }>]>>;
282
282
  export declare const pgCliPushParams: import("zod").ZodIntersection<import("zod").ZodObject<{
283
+ dialect: import("zod").ZodEnum<["pg", "mysql", "sqlite"]>;
283
284
  schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
284
285
  tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
285
286
  schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
@@ -289,6 +290,7 @@ export declare const pgCliPushParams: import("zod").ZodIntersection<import("zod"
289
290
  tablesFilter?: string | string[] | undefined;
290
291
  strict: boolean;
291
292
  schema: string | string[];
293
+ dialect: "mysql" | "pg" | "sqlite";
292
294
  schemaFilter: string | string[];
293
295
  verbose: boolean;
294
296
  }, {
@@ -297,6 +299,7 @@ export declare const pgCliPushParams: import("zod").ZodIntersection<import("zod"
297
299
  schemaFilter?: string | string[] | undefined;
298
300
  verbose?: boolean | undefined;
299
301
  schema: string | string[];
302
+ dialect: "mysql" | "pg" | "sqlite";
300
303
  }>, import("zod").ZodUnion<[import("zod").ZodObject<{
301
304
  driver: import("zod").ZodLiteral<"pg">;
302
305
  host: import("zod").ZodString;
@@ -338,6 +341,7 @@ export declare const pgCliPushParams: import("zod").ZodIntersection<import("zod"
338
341
  connectionString: string;
339
342
  }>]>>;
340
343
  export declare const pgConfigPushParams: import("zod").ZodIntersection<import("zod").ZodObject<{
344
+ dialect: import("zod").ZodEnum<["pg", "mysql", "sqlite"]>;
341
345
  schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
342
346
  tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
343
347
  schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
@@ -347,6 +351,7 @@ export declare const pgConfigPushParams: import("zod").ZodIntersection<import("z
347
351
  tablesFilter?: string | string[] | undefined;
348
352
  strict: boolean;
349
353
  schema: string | string[];
354
+ dialect: "mysql" | "pg" | "sqlite";
350
355
  schemaFilter: string | string[];
351
356
  verbose: boolean;
352
357
  }, {
@@ -355,6 +360,7 @@ export declare const pgConfigPushParams: import("zod").ZodIntersection<import("z
355
360
  schemaFilter?: string | string[] | undefined;
356
361
  verbose?: boolean | undefined;
357
362
  schema: string | string[];
363
+ dialect: "mysql" | "pg" | "sqlite";
358
364
  }>, import("zod").ZodUnion<[import("zod").ZodObject<{
359
365
  driver: import("zod").ZodLiteral<"pg">;
360
366
  dbCredentials: import("zod").ZodObject<{
@@ -435,4 +441,3 @@ export type PgCliIntrospect = TypeOf<typeof pgCliIntrospectParams>;
435
441
  export type PgConnectionConfig = TypeOf<typeof pgConnectionConfig>;
436
442
  export declare const printConfigConnectionIssues: (options: any) => void;
437
443
  export declare const validatePgIntrospect: (options: Record<string, any>) => Promise<PgConfigIntrospect>;
438
- export declare const validatePgPush: (options: Record<string, unknown>) => Promise<PgPushConfig>;
@@ -1,5 +1,4 @@
1
1
  import { TypeOf } from "zod";
2
- import { SQLiteCliConfig } from "../commands/sqliteUtils";
3
2
  export declare const sqliteConnectionCli: import("zod").ZodUnion<[import("zod").ZodObject<{
4
3
  driver: import("zod").ZodLiteral<"turso">;
5
4
  url: import("zod").ZodString;
@@ -31,6 +30,165 @@ export declare const sqliteConnectionCli: import("zod").ZodUnion<[import("zod").
31
30
  url: string;
32
31
  driver: "libsql";
33
32
  }>]>;
33
+ export declare const sqliteConnectionSchema: import("zod").ZodUnion<[import("zod").ZodObject<{
34
+ driver: import("zod").ZodLiteral<"turso">;
35
+ dbCredentials: import("zod").ZodObject<{
36
+ url: import("zod").ZodString;
37
+ authToken: import("zod").ZodOptional<import("zod").ZodString>;
38
+ }, "strip", import("zod").ZodTypeAny, {
39
+ authToken?: string | undefined;
40
+ url: string;
41
+ }, {
42
+ authToken?: string | undefined;
43
+ url: string;
44
+ }>;
45
+ }, "strip", import("zod").ZodTypeAny, {
46
+ driver: "turso";
47
+ dbCredentials: {
48
+ authToken?: string | undefined;
49
+ url: string;
50
+ };
51
+ }, {
52
+ driver: "turso";
53
+ dbCredentials: {
54
+ authToken?: string | undefined;
55
+ url: string;
56
+ };
57
+ }>, import("zod").ZodObject<{
58
+ driver: import("zod").ZodLiteral<"libsql">;
59
+ dbCredentials: import("zod").ZodObject<{
60
+ url: import("zod").ZodString;
61
+ }, "strip", import("zod").ZodTypeAny, {
62
+ url: string;
63
+ }, {
64
+ url: string;
65
+ }>;
66
+ }, "strip", import("zod").ZodTypeAny, {
67
+ driver: "libsql";
68
+ dbCredentials: {
69
+ url: string;
70
+ };
71
+ }, {
72
+ driver: "libsql";
73
+ dbCredentials: {
74
+ url: string;
75
+ };
76
+ }>, import("zod").ZodObject<{
77
+ driver: import("zod").ZodLiteral<"better-sqlite">;
78
+ dbCredentials: import("zod").ZodObject<{
79
+ url: import("zod").ZodString;
80
+ }, "strip", import("zod").ZodTypeAny, {
81
+ url: string;
82
+ }, {
83
+ url: string;
84
+ }>;
85
+ }, "strip", import("zod").ZodTypeAny, {
86
+ driver: "better-sqlite";
87
+ dbCredentials: {
88
+ url: string;
89
+ };
90
+ }, {
91
+ driver: "better-sqlite";
92
+ dbCredentials: {
93
+ url: string;
94
+ };
95
+ }>]>;
96
+ export declare const sqliteCliConfigSchema: import("zod").ZodIntersection<import("zod").ZodObject<{
97
+ schema: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
98
+ out: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
99
+ breakpoints: import("zod").ZodDefault<import("zod").ZodBoolean>;
100
+ tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
101
+ schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
102
+ introspect: import("zod").ZodDefault<import("zod").ZodObject<{
103
+ casing: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodLiteral<"camel">, import("zod").ZodLiteral<"preserve">]>>;
104
+ }, "strip", import("zod").ZodTypeAny, {
105
+ casing: "camel" | "preserve";
106
+ }, {
107
+ casing?: "camel" | "preserve" | undefined;
108
+ }>>;
109
+ }, "strip", import("zod").ZodTypeAny, {
110
+ schema?: string | string[] | undefined;
111
+ tablesFilter?: string | string[] | undefined;
112
+ out: string;
113
+ breakpoints: boolean;
114
+ schemaFilter: string | string[];
115
+ introspect: {
116
+ casing: "camel" | "preserve";
117
+ };
118
+ }, {
119
+ schema?: string | string[] | undefined;
120
+ out?: string | undefined;
121
+ breakpoints?: boolean | undefined;
122
+ tablesFilter?: string | string[] | undefined;
123
+ schemaFilter?: string | string[] | undefined;
124
+ introspect?: {
125
+ casing?: "camel" | "preserve" | undefined;
126
+ } | undefined;
127
+ }>, import("zod").ZodUnion<[import("zod").ZodObject<{
128
+ driver: import("zod").ZodLiteral<"turso">;
129
+ dbCredentials: import("zod").ZodObject<{
130
+ url: import("zod").ZodString;
131
+ authToken: import("zod").ZodOptional<import("zod").ZodString>;
132
+ }, "strip", import("zod").ZodTypeAny, {
133
+ authToken?: string | undefined;
134
+ url: string;
135
+ }, {
136
+ authToken?: string | undefined;
137
+ url: string;
138
+ }>;
139
+ }, "strip", import("zod").ZodTypeAny, {
140
+ driver: "turso";
141
+ dbCredentials: {
142
+ authToken?: string | undefined;
143
+ url: string;
144
+ };
145
+ }, {
146
+ driver: "turso";
147
+ dbCredentials: {
148
+ authToken?: string | undefined;
149
+ url: string;
150
+ };
151
+ }>, import("zod").ZodObject<{
152
+ driver: import("zod").ZodLiteral<"libsql">;
153
+ dbCredentials: import("zod").ZodObject<{
154
+ url: import("zod").ZodString;
155
+ }, "strip", import("zod").ZodTypeAny, {
156
+ url: string;
157
+ }, {
158
+ url: string;
159
+ }>;
160
+ }, "strip", import("zod").ZodTypeAny, {
161
+ driver: "libsql";
162
+ dbCredentials: {
163
+ url: string;
164
+ };
165
+ }, {
166
+ driver: "libsql";
167
+ dbCredentials: {
168
+ url: string;
169
+ };
170
+ }>, import("zod").ZodObject<{
171
+ driver: import("zod").ZodLiteral<"better-sqlite">;
172
+ dbCredentials: import("zod").ZodObject<{
173
+ url: import("zod").ZodString;
174
+ }, "strip", import("zod").ZodTypeAny, {
175
+ url: string;
176
+ }, {
177
+ url: string;
178
+ }>;
179
+ }, "strip", import("zod").ZodTypeAny, {
180
+ driver: "better-sqlite";
181
+ dbCredentials: {
182
+ url: string;
183
+ };
184
+ }, {
185
+ driver: "better-sqlite";
186
+ dbCredentials: {
187
+ url: string;
188
+ };
189
+ }>]>>;
190
+ export type SQLiteCliConfig = TypeOf<typeof sqliteCliConfigSchema>;
191
+ export type SQLiteConnectionConfig = TypeOf<typeof sqliteConnectionSchema>;
34
192
  export declare const sqliteCliIntrospectParams: import("zod").ZodIntersection<import("zod").ZodObject<{
35
193
  schema: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
36
194
  out: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
@@ -84,6 +242,7 @@ export declare const sqliteCliIntrospectParams: import("zod").ZodIntersection<im
84
242
  driver: "libsql";
85
243
  }>]>>;
86
244
  export declare const sqliteCliPushParams: import("zod").ZodIntersection<import("zod").ZodObject<{
245
+ dialect: import("zod").ZodEnum<["pg", "mysql", "sqlite"]>;
87
246
  schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
88
247
  tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
89
248
  schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
@@ -93,6 +252,7 @@ export declare const sqliteCliPushParams: import("zod").ZodIntersection<import("
93
252
  tablesFilter?: string | string[] | undefined;
94
253
  strict: boolean;
95
254
  schema: string | string[];
255
+ dialect: "mysql" | "pg" | "sqlite";
96
256
  schemaFilter: string | string[];
97
257
  verbose: boolean;
98
258
  }, {
@@ -101,6 +261,7 @@ export declare const sqliteCliPushParams: import("zod").ZodIntersection<import("
101
261
  schemaFilter?: string | string[] | undefined;
102
262
  verbose?: boolean | undefined;
103
263
  schema: string | string[];
264
+ dialect: "mysql" | "pg" | "sqlite";
104
265
  }>, import("zod").ZodUnion<[import("zod").ZodObject<{
105
266
  driver: import("zod").ZodLiteral<"turso">;
106
267
  url: import("zod").ZodString;
@@ -133,6 +294,7 @@ export declare const sqliteCliPushParams: import("zod").ZodIntersection<import("
133
294
  driver: "libsql";
134
295
  }>]>>;
135
296
  export declare const sqliteConfigPushParams: import("zod").ZodIntersection<import("zod").ZodObject<{
297
+ dialect: import("zod").ZodEnum<["pg", "mysql", "sqlite"]>;
136
298
  schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
137
299
  tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
138
300
  schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
@@ -142,6 +304,7 @@ export declare const sqliteConfigPushParams: import("zod").ZodIntersection<impor
142
304
  tablesFilter?: string | string[] | undefined;
143
305
  strict: boolean;
144
306
  schema: string | string[];
307
+ dialect: "mysql" | "pg" | "sqlite";
145
308
  schemaFilter: string | string[];
146
309
  verbose: boolean;
147
310
  }, {
@@ -150,6 +313,7 @@ export declare const sqliteConfigPushParams: import("zod").ZodIntersection<impor
150
313
  schemaFilter?: string | string[] | undefined;
151
314
  verbose?: boolean | undefined;
152
315
  schema: string | string[];
316
+ dialect: "mysql" | "pg" | "sqlite";
153
317
  }>, import("zod").ZodUnion<[import("zod").ZodObject<{
154
318
  driver: import("zod").ZodLiteral<"turso">;
155
319
  dbCredentials: import("zod").ZodObject<{
@@ -216,5 +380,3 @@ export declare const sqliteConfigPushParams: import("zod").ZodIntersection<impor
216
380
  export type SQLitePushConfig = TypeOf<typeof sqliteConfigPushParams>;
217
381
  export declare const printConfigConnectionIssues: (options: any) => void;
218
382
  export declare const validateIntrospect: (options: Record<string, any>) => Promise<SQLiteCliConfig>;
219
- export declare const validatePush: (options: Record<string, unknown>) => Promise<SQLitePushConfig>;
220
- export declare const validateGenerate: () => void;
package/cli/views.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Prompt, TaskView } from "hanji";
2
- import type { CommonSchema } from "src/schemaValidator";
2
+ import type { CommonSchema } from "../schemaValidator";
3
3
  import type { Named } from "./commands/migrate";
4
4
  export declare const warning: (msg: string) => void;
5
5
  export declare const err: (msg: string) => void;
@@ -1,4 +1,6 @@
1
1
  import type { Client } from "@libsql/client";
2
+ import { BetterSQLite3Database } from "drizzle-orm/better-sqlite3";
3
+ import { MySql2Database } from "drizzle-orm/mysql2";
2
4
  import type { PgDatabase } from "drizzle-orm/pg-core";
3
5
  import type { Client as PgClient } from "pg";
4
6
  export declare abstract class DrizzleDbClient<T = any> {
@@ -11,10 +13,22 @@ export declare class DrizzleORMPgClient extends DrizzleDbClient<PgDatabase<any>>
11
13
  query<K = any>(query: string, values?: any[] | undefined): Promise<K[]>;
12
14
  run(query: string): Promise<void>;
13
15
  }
16
+ export declare class DrizzleORMMySQLClient extends DrizzleDbClient<MySql2Database<any>> {
17
+ query<K = any>(query: string, values?: any[] | undefined): Promise<K[]>;
18
+ run(query: string): Promise<void>;
19
+ }
20
+ export declare class DrizzleORMSQLiteClient extends DrizzleDbClient<BetterSQLite3Database<any>> {
21
+ query<K = any>(query: string, values?: any[] | undefined): Promise<K[]>;
22
+ run(query: string): Promise<void>;
23
+ }
14
24
  export declare class BetterSqlite extends DrizzleDbClient {
15
25
  run(query: string): Promise<void>;
16
26
  query(query: string): Promise<any[]>;
17
27
  }
28
+ export declare class MySQL2Client extends DrizzleDbClient {
29
+ run(query: string): Promise<void>;
30
+ query(query: string): Promise<any>;
31
+ }
18
32
  export declare class TursoSqlite extends DrizzleDbClient<Client> {
19
33
  run(query: string): Promise<void>;
20
34
  query(query: string): Promise<any[]>;
package/global.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export declare const originUUID = "00000000-0000-0000-0000-000000000000";
2
- export declare const snapshotVersion = "5";
2
+ export declare const snapshotVersion = "6";
3
3
  export declare function assertUnreachable(x: never): never;
4
+ export declare const mapValues: <IN, OUT>(obj: Record<string, IN>, map: (input: IN) => OUT) => Record<string, OUT>;
package/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Dialect } from "./schemaValidator";
1
2
  export type DbConnection = {
2
3
  driver: "turso";
3
4
  dbCredentials: {
@@ -45,13 +46,14 @@ export type DbConnection = {
45
46
  };
46
47
  };
47
48
  export type Config = {
48
- out?: string | undefined;
49
- breakpoints?: boolean | undefined;
50
- tablesFilter?: string | string[] | undefined;
51
- schemaFilter?: string | string[] | undefined;
49
+ dialect?: Dialect;
50
+ out?: string;
51
+ breakpoints?: boolean;
52
+ tablesFilter?: string | string[];
53
+ schemaFilter?: string | string[];
52
54
  schema?: string | string[];
53
- verbose?: boolean | undefined;
54
- strict?: boolean | undefined;
55
+ verbose?: boolean;
56
+ strict?: boolean;
55
57
  } & {
56
58
  introspect?: {
57
59
  casing: "camel" | "preserve";
package/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Dialect } from "./schemaValidator";
1
2
  export type DbConnection = {
2
3
  driver: "turso";
3
4
  dbCredentials: {
@@ -45,13 +46,14 @@ export type DbConnection = {
45
46
  };
46
47
  };
47
48
  export type Config = {
48
- out?: string | undefined;
49
- breakpoints?: boolean | undefined;
50
- tablesFilter?: string | string[] | undefined;
51
- schemaFilter?: string | string[] | undefined;
49
+ dialect?: Dialect;
50
+ out?: string;
51
+ breakpoints?: boolean;
52
+ tablesFilter?: string | string[];
53
+ schemaFilter?: string | string[];
52
54
  schema?: string | string[];
53
- verbose?: boolean | undefined;
54
- strict?: boolean | undefined;
55
+ verbose?: boolean;
56
+ strict?: boolean;
55
57
  } & {
56
58
  introspect?: {
57
59
  casing: "camel" | "preserve";
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -0,0 +1,9 @@
1
+ import "./@types/utils";
2
+ import type { ConfigIntrospectCasing } from "./cli/validations/common";
3
+ import { MySqlSchemaInternal } from "./serializer/mysqlSchema";
4
+ export declare const schemaToTypeScript: (schema: MySqlSchemaInternal, casing: ConfigIntrospectCasing["casing"]) => {
5
+ file: string;
6
+ imports: string;
7
+ decalrations: string;
8
+ schemaEntry: string;
9
+ };
@@ -1,7 +1,7 @@
1
1
  import { AnyPgTable } from "drizzle-orm/pg-core";
2
2
  import { Relation, Relations } from "drizzle-orm/relations";
3
3
  import "./@types/utils";
4
- import { ConfigIntrospectCasing } from "./cli/commands/utils";
4
+ import type { ConfigIntrospectCasing } from "./cli/validations/common";
5
5
  import { PgSchemaInternal } from "./serializer/pgSchema";
6
6
  export declare const relationsToTypeScript: (schema: Record<string, Record<string, AnyPgTable<{}>>>, relations: Record<string, Relations<string, Record<string, Relation<string>>>>) => string;
7
7
  export declare const schemaToTypeScript: (schema: PgSchemaInternal, casing: ConfigIntrospectCasing) => {
@@ -1,5 +1,5 @@
1
1
  import "./@types/utils";
2
- import type { ConfigIntrospectCasing } from "./cli/commands/utils";
2
+ import type { ConfigIntrospectCasing } from "./cli/validations/common";
3
3
  import type { SQLiteSchemaInternal } from "./serializer/sqliteSchema";
4
4
  export declare const indexName: (tableName: string, columns: string[]) => string;
5
5
  export declare const schemaToTypeScript: (schema: SQLiteSchemaInternal, casing: ConfigIntrospectCasing["casing"]) => {
@@ -294,7 +294,7 @@ export interface JsonRenameSchema {
294
294
  export type JsonAlterColumnStatement = JsonRenameColumnStatement | JsonAlterColumnTypeStatement | JsonAlterColumnSetDefaultStatement | JsonAlterColumnDropDefaultStatement | JsonAlterColumnSetNotNullStatement | JsonAlterColumnDropNotNullStatement | JsonAlterColumnDropOnUpdateStatement | JsonAlterColumnSetOnUpdateStatement | JsonAlterColumnDropAutoincrementStatement | JsonAlterColumnSetAutoincrementStatement | JsonAlterColumnSetPrimaryKeyStatement | JsonAlterColumnDropPrimaryKeyStatement;
295
295
  export type JsonStatement = JsonAlterColumnStatement | JsonCreateTableStatement | JsonDropTableStatement | JsonRenameTableStatement | JsonCreateEnumStatement | JsonAddValueToEnumStatement | JsonDropColumnStatement | JsonAddColumnStatement | JsonCreateIndexStatement | JsonCreateReferenceStatement | JsonAlterReferenceStatement | JsonDeleteReferenceStatement | JsonDropIndexStatement | JsonReferenceStatement | JsonSqliteCreateTableStatement | JsonSqliteAddColumnStatement | JsonCreateCompositePK | JsonDeleteCompositePK | JsonAlterCompositePK | JsonCreateUniqueConstraint | JsonDeleteUniqueConstraint | JsonAlterUniqueConstraint | JsonCreateSchema | JsonDropSchema | JsonRenameSchema | JsonAlterTableSetSchema | JsonAlterTableRemoveFromSchema | JsonAlterTableSetNewSchema;
296
296
  export declare const preparePgCreateTableJson: (table: Table, json2: PgSchema) => JsonCreateTableStatement;
297
- export declare const prepareMySqlCreateTableJson: (table: Table, json2: PgSchema) => JsonCreateTableStatement;
297
+ export declare const prepareMySqlCreateTableJson: (table: Table, json2: MySqlSchema) => JsonCreateTableStatement;
298
298
  export declare const prepareSQLiteCreateTable: (table: Table) => JsonSqliteCreateTableStatement;
299
299
  export declare const prepareDropTableJson: (table: Table) => JsonDropTableStatement;
300
300
  export declare const prepareRenameTableJson: (tableFrom: Table, tableTo: Table) => JsonRenameTableStatement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.20.14-1ebe0ff",
3
+ "version": "0.20.14-1f99bf7",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  "scripts": {
11
11
  "test:pg:push": "drizzle-kit push:pg",
12
12
  "payload": "tsx ./dev/payload.ts",
13
- "migrate:old": "drizzle-kit generate:pg --out ./dev/migrations-pg --schema ./dev/migrations-pg/schema2.ts",
13
+ "migrate:old": "drizzle-kit generate:mysql",
14
14
  "push": "node -r esbuild-register ./src/cli/index.ts push:mysql",
15
15
  "push:sqlite": "node -r ./src/loader.mjs ./src/cli/index.ts push:sqlite",
16
16
  "try1": "tsx ./src/t.ts",
@@ -36,7 +36,7 @@
36
36
  "sim:sqlite": "node -r esbuild-register ./dev/sqlite/index.ts",
37
37
  "test": "ava test --timeout=60s",
38
38
  "build": "rm -rf ./dist && tsc -p tsconfig.cli-types.json && pnpm mts && tsx build.ts",
39
- "mts": "cp dist/index.d.ts dist/index.d.mts && cp dist/utils-studio.d.ts dist/utils-studio.d.mts",
39
+ "mts": "cp dist/index.d.ts dist/index.d.mts && cp dist/utils-studio.d.ts dist/utils-studio.d.mts && cp dist/payload.d.ts dist/payload.d.mts",
40
40
  "build:dev": "rm -rf ./dist && tsx build.dev.ts && tsc -p tsconfig.cli-types.json && chmod +x ./dist/index.cjs",
41
41
  "packit": "pnpm build && cp package.json dist/ && cd dist && pnpm pack",
42
42
  "tsc": "tsc -p tsconfig.build.json",
@@ -87,7 +87,8 @@
87
87
  "better-sqlite3": "^8.4.0",
88
88
  "dockerode": "^3.3.4",
89
89
  "dotenv": "^16.0.3",
90
- "drizzle-orm": "0.29.0",
90
+ "drizzle-kit": "0.19.13",
91
+ "drizzle-orm": "0.29.3",
91
92
  "esbuild-node-externals": "^1.9.0",
92
93
  "eslint": "^8.29.0",
93
94
  "eslint-config-prettier": "^8.5.0",
@@ -127,6 +128,18 @@
127
128
  },
128
129
  "types": "./utils-studio.d.mts",
129
130
  "default": "./utils-studio.mjs"
131
+ },
132
+ "./payload": {
133
+ "import": {
134
+ "types": "./payload.d.mts",
135
+ "default": "./payload.mjs"
136
+ },
137
+ "require": {
138
+ "types": "./payload.d.ts",
139
+ "default": "./payload.js"
140
+ },
141
+ "types": "./payload.d.mts",
142
+ "default": "./payload.mjs"
130
143
  }
131
144
  }
132
145
  }
package/payload.d.mts ADDED
@@ -0,0 +1,33 @@
1
+ import { PgDatabase } from "drizzle-orm/pg-core";
2
+ import { PgSchema as PgSchemaKit } from "./serializer/pgSchema";
3
+ import { SQLiteSchema as SQLiteSchemaKit } from "./serializer/sqliteSchema";
4
+ import { MySqlSchema as MySQLSchemaKit } from "./serializer/mysqlSchema";
5
+ import { MySql2Database } from "drizzle-orm/mysql2";
6
+ import { BetterSQLite3Database } from "drizzle-orm/better-sqlite3";
7
+ export type DrizzleSnapshotJSON = PgSchemaKit;
8
+ export type DrizzleSQLiteSnapshotJSON = SQLiteSchemaKit;
9
+ export type DrizzleMySQLSnapshotJSON = MySQLSchemaKit;
10
+ export declare const generateDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => PgSchemaKit;
11
+ export declare const generateMigration: (prev: DrizzleSnapshotJSON, cur: DrizzleSnapshotJSON) => Promise<string[]>;
12
+ export declare const pushSchema: (imports: Record<string, unknown>, db: PgDatabase<any>) => Promise<{
13
+ hasDataLoss: boolean;
14
+ warnings: string[];
15
+ statementsToExecute: string[];
16
+ apply: () => Promise<void>;
17
+ }>;
18
+ export declare const generateSQLiteDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => Promise<SQLiteSchemaKit>;
19
+ export declare const generateSQLiteMigration: (prev: DrizzleSQLiteSnapshotJSON, cur: DrizzleSQLiteSnapshotJSON) => Promise<string[]>;
20
+ export declare const pushSQLiteSchema: (imports: Record<string, unknown>, db: BetterSQLite3Database<any>) => Promise<{
21
+ hasDataLoss: boolean;
22
+ warnings: string[];
23
+ statementsToExecute: string[];
24
+ apply: () => Promise<void>;
25
+ }>;
26
+ export declare const generateMySQLDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => Promise<MySQLSchemaKit>;
27
+ export declare const generateMySQLMigration: (prev: DrizzleMySQLSnapshotJSON, cur: DrizzleMySQLSnapshotJSON) => Promise<string[]>;
28
+ export declare const pushMySQLSchema: (imports: Record<string, unknown>, db: MySql2Database<any>, databaseName: string) => Promise<{
29
+ hasDataLoss: boolean;
30
+ warnings: string[];
31
+ statementsToExecute: string[];
32
+ apply: () => Promise<void>;
33
+ }>;
package/payload.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ import { PgDatabase } from "drizzle-orm/pg-core";
2
+ import { PgSchema as PgSchemaKit } from "./serializer/pgSchema";
3
+ import { SQLiteSchema as SQLiteSchemaKit } from "./serializer/sqliteSchema";
4
+ import { MySqlSchema as MySQLSchemaKit } from "./serializer/mysqlSchema";
5
+ import { MySql2Database } from "drizzle-orm/mysql2";
6
+ import { BetterSQLite3Database } from "drizzle-orm/better-sqlite3";
7
+ export type DrizzleSnapshotJSON = PgSchemaKit;
8
+ export type DrizzleSQLiteSnapshotJSON = SQLiteSchemaKit;
9
+ export type DrizzleMySQLSnapshotJSON = MySQLSchemaKit;
10
+ export declare const generateDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => PgSchemaKit;
11
+ export declare const generateMigration: (prev: DrizzleSnapshotJSON, cur: DrizzleSnapshotJSON) => Promise<string[]>;
12
+ export declare const pushSchema: (imports: Record<string, unknown>, db: PgDatabase<any>) => Promise<{
13
+ hasDataLoss: boolean;
14
+ warnings: string[];
15
+ statementsToExecute: string[];
16
+ apply: () => Promise<void>;
17
+ }>;
18
+ export declare const generateSQLiteDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => Promise<SQLiteSchemaKit>;
19
+ export declare const generateSQLiteMigration: (prev: DrizzleSQLiteSnapshotJSON, cur: DrizzleSQLiteSnapshotJSON) => Promise<string[]>;
20
+ export declare const pushSQLiteSchema: (imports: Record<string, unknown>, db: BetterSQLite3Database<any>) => Promise<{
21
+ hasDataLoss: boolean;
22
+ warnings: string[];
23
+ statementsToExecute: string[];
24
+ apply: () => Promise<void>;
25
+ }>;
26
+ export declare const generateMySQLDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => Promise<MySQLSchemaKit>;
27
+ export declare const generateMySQLMigration: (prev: DrizzleMySQLSnapshotJSON, cur: DrizzleMySQLSnapshotJSON) => Promise<string[]>;
28
+ export declare const pushMySQLSchema: (imports: Record<string, unknown>, db: MySql2Database<any>, databaseName: string) => Promise<{
29
+ hasDataLoss: boolean;
30
+ warnings: string[];
31
+ statementsToExecute: string[];
32
+ apply: () => Promise<void>;
33
+ }>;