drizzle-kit 0.20.14-dc3503a → 0.20.14-e8e7ed6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/bin.cjs +20592 -20027
  2. package/cli/commands/migrate.d.ts +114 -90
  3. package/cli/commands/mysqlIntrospect.d.ts +8 -14
  4. package/cli/commands/pgIntrospect.d.ts +17 -10
  5. package/cli/commands/sqliteIntrospect.d.ts +9 -9
  6. package/cli/commands/utils.d.ts +8 -261
  7. package/cli/validations/cli.d.ts +107 -0
  8. package/cli/validations/common.d.ts +205 -7
  9. package/cli/validations/mysql.d.ts +6 -1
  10. package/cli/validations/pg.d.ts +6 -1
  11. package/cli/validations/sqlite.d.ts +165 -3
  12. package/cli/views.d.ts +6 -4
  13. package/global.d.ts +3 -1
  14. package/index.d.mts +8 -6
  15. package/index.d.ts +8 -6
  16. package/index.js +1 -0
  17. package/introspect-mysql.d.ts +1 -1
  18. package/introspect-pg.d.ts +5 -2
  19. package/introspect-sqlite.d.ts +1 -1
  20. package/jsonDiffer.d.ts +14 -29
  21. package/jsonStatements.d.ts +38 -11
  22. package/package.json +18 -50
  23. package/payload.js +8130 -8617
  24. package/payload.mjs +8252 -8745
  25. package/schemaValidator.d.ts +72 -69
  26. package/serializer/mysqlImports.d.ts +3 -7
  27. package/serializer/mysqlSchema.d.ts +1624 -493
  28. package/serializer/mysqlSerializer.d.ts +2 -2
  29. package/serializer/pgImports.d.ts +2 -2
  30. package/serializer/pgSchema.d.ts +1260 -801
  31. package/serializer/sqliteImports.d.ts +2 -4
  32. package/serializer/sqliteSchema.d.ts +144 -570
  33. package/serializer/sqliteSerializer.d.ts +1 -1
  34. package/snapshotsDiffer.d.ts +1908 -1050
  35. package/utils/words.d.ts +1 -1
  36. package/utils-studio.js +4144 -85
  37. package/utils-studio.mjs +4144 -85
  38. package/utils.d.ts +6 -140
  39. package/utils.js +3906 -7081
  40. package/utils.mjs +3983 -7158
  41. package/cli/commands/check.d.ts +0 -2
  42. package/cli/commands/drop.d.ts +0 -4
  43. package/cli/commands/mysqlUp.d.ts +0 -4
  44. package/cli/commands/pgUp.d.ts +0 -4
  45. package/cli/commands/push.d.ts +0 -6
  46. package/cli/commands/sqliteUp.d.ts +0 -2
  47. package/cli/commands/sqliteUtils.d.ts +0 -162
  48. package/cli/commands/upFolders.d.ts +0 -27
  49. package/cli/index.d.ts +0 -71
  50. package/cli/utils.d.ts +0 -12
  51. package/cli/validations/studio.d.ts +0 -593
  52. package/orm-extenstions/d1-driver/driver.d.ts +0 -8
  53. package/orm-extenstions/d1-driver/session.d.ts +0 -51
  54. package/orm-extenstions/d1-driver/wrangler-client.d.ts +0 -3
  55. package/serializer/studioUtils.d.ts +0 -65
  56. package/utils/certs.d.ts +0 -4
@@ -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,6 +1,6 @@
1
1
  import { Prompt, TaskView } from "hanji";
2
2
  import type { CommonSchema } from "../schemaValidator";
3
- import type { Named } from "./commands/migrate";
3
+ import type { Named, NamedWithSchema } from "./commands/migrate";
4
4
  export declare const warning: (msg: string) => void;
5
5
  export declare const err: (msg: string) => void;
6
6
  export declare const info: (msg: string, greyMsg?: string) => string;
@@ -10,7 +10,7 @@ export interface RenamePropmtItem<T> {
10
10
  from: T;
11
11
  to: T;
12
12
  }
13
- export declare const isRenamePromptItem: <T extends Named>(item: T | RenamePropmtItem<T>) => item is RenamePropmtItem<T>;
13
+ export declare const isRenamePromptItem: <T extends Named>(item: RenamePropmtItem<T> | T) => item is RenamePropmtItem<T>;
14
14
  export declare class ResolveColumnSelect<T extends Named> extends Prompt<RenamePropmtItem<T> | T> {
15
15
  private readonly tableName;
16
16
  private readonly base;
@@ -19,10 +19,12 @@ export declare class ResolveColumnSelect<T extends Named> extends Prompt<RenameP
19
19
  render(status: "idle" | "submitted" | "aborted"): string;
20
20
  result(): RenamePropmtItem<T> | T;
21
21
  }
22
- export declare class ResolveTableSelect<T extends Named> extends Prompt<RenamePropmtItem<T> | T> {
22
+ export declare const tableKey: (it: NamedWithSchema) => string;
23
+ export declare class ResolveSelect<T extends NamedWithSchema> extends Prompt<RenamePropmtItem<T> | T> {
23
24
  private readonly base;
25
+ private readonly entityType;
24
26
  private readonly state;
25
- constructor(base: Named, data: (RenamePropmtItem<T> | T)[]);
27
+ constructor(base: T, data: (RenamePropmtItem<T> | T)[], entityType: "table" | "enum");
26
28
  render(status: "idle" | "submitted" | "aborted"): string;
27
29
  result(): RenamePropmtItem<T> | T;
28
30
  }
package/global.d.ts CHANGED
@@ -1,4 +1,6 @@
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
4
  export declare const mapValues: <IN, OUT>(obj: Record<string, IN>, map: (input: IN) => OUT) => Record<string, OUT>;
5
+ export declare const mapKeys: <T>(obj: Record<string, T>, map: (key: string, value: T) => string) => Record<string, T>;
6
+ export declare const mapEntries: <T>(obj: Record<string, T>, map: (key: string, value: T) => [string, T]) => Record<string, T>;
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;
@@ -1,5 +1,5 @@
1
1
  import "./@types/utils";
2
- import { ConfigIntrospectCasing } from "./cli/commands/utils";
2
+ import type { ConfigIntrospectCasing } from "./cli/validations/common";
3
3
  import { MySqlSchemaInternal } from "./serializer/mysqlSchema";
4
4
  export declare const schemaToTypeScript: (schema: MySqlSchemaInternal, casing: ConfigIntrospectCasing["casing"]) => {
5
5
  file: string;
@@ -1,9 +1,12 @@
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
- export declare const relationsToTypeScript: (schema: Record<string, Record<string, AnyPgTable<{}>>>, relations: Record<string, Relations<string, Record<string, Relation<string>>>>) => string;
6
+ export declare const relationsToTypeScriptForStudio: (schema: Record<string, Record<string, AnyPgTable<{}>>>, relations: Record<string, Relations<string, Record<string, Relation<string>>>>) => string;
7
+ export declare const relationsToTypeScript: (schema: PgSchemaInternal, casing: ConfigIntrospectCasing) => {
8
+ file: string;
9
+ };
7
10
  export declare const schemaToTypeScript: (schema: PgSchemaInternal, casing: ConfigIntrospectCasing) => {
8
11
  file: string;
9
12
  imports: string;
@@ -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"]) => {
package/jsonDiffer.d.ts CHANGED
@@ -1,25 +1,16 @@
1
1
  export function diffForRenamedTables(pairs: any): any;
2
2
  export function diffForRenamedColumn(t1: any, t2: any): any;
3
+ export function diffSchemasOrTables(left: any, right: any): {
4
+ added: any[];
5
+ deleted: any[];
6
+ };
7
+ export function diffColumns(left: any, right: any): {
8
+ [k: string]: any;
9
+ };
3
10
  export function applyJsonDiff(json1: any, json2: any): {
4
- addedTables?: undefined;
5
- deletedTables?: undefined;
6
- alteredTablesWithColumns?: undefined;
7
- addedEnums?: undefined;
8
- deletedEnums?: undefined;
9
- alteredEnums?: undefined;
10
- addedSchemas?: undefined;
11
- deletedSchemas?: undefined;
12
- } | {
13
- addedTables: any[];
14
- deletedTables: any[];
15
11
  alteredTablesWithColumns: {
16
12
  name: any;
17
- schema: {
18
- type: string;
19
- value: any;
20
- };
21
- deleted: any[];
22
- added: any[];
13
+ schema: any;
23
14
  altered: any[];
24
15
  addedIndexes: {
25
16
  [k: string]: any;
@@ -58,19 +49,13 @@ export function applyJsonDiff(json1: any, json2: any): {
58
49
  [k: string]: any;
59
50
  };
60
51
  }[];
61
- addedEnums: {
62
- name: any;
63
- values: any[];
64
- }[];
65
- deletedEnums: {
66
- name: any;
67
- values: any[];
68
- }[];
69
52
  alteredEnums: {
70
- name: string;
71
- addedValues: any[];
53
+ name: any;
54
+ schema: any;
55
+ addedValues: {
56
+ before: any;
57
+ value: any;
58
+ }[];
72
59
  deletedValues: any[];
73
60
  }[];
74
- addedSchemas: any[];
75
- deletedSchemas: any[];
76
61
  };
@@ -1,4 +1,4 @@
1
- import { CommonSquashedSchema, Dialect } from "./schemaValidator";
1
+ import { CommonSquashedSchema } from "./schemaValidator";
2
2
  import { MySqlSchema } from "./serializer/mysqlSchema";
3
3
  import { PgSchema } from "./serializer/pgSchema";
4
4
  import { AlteredColumn, Column, Table } from "./snapshotsDiffer";
@@ -34,12 +34,32 @@ export interface JsonRenameTableStatement {
34
34
  export interface JsonCreateEnumStatement {
35
35
  type: "create_type_enum";
36
36
  name: string;
37
+ schema: string;
37
38
  values: string[];
38
39
  }
40
+ export interface JsonDropEnumStatement {
41
+ type: "drop_type_enum";
42
+ name: string;
43
+ schema: string;
44
+ }
45
+ export interface JsonMoveEnumStatement {
46
+ type: "move_type_enum";
47
+ name: string;
48
+ schemaFrom: string;
49
+ schemaTo: string;
50
+ }
51
+ export interface JsonRenameEnumStatement {
52
+ type: "rename_type_enum";
53
+ nameFrom: string;
54
+ nameTo: string;
55
+ schema: string;
56
+ }
39
57
  export interface JsonAddValueToEnumStatement {
40
58
  type: "alter_type_add_value";
41
59
  name: string;
60
+ schema: string;
42
61
  value: string;
62
+ before: string;
43
63
  }
44
64
  export interface JsonDropColumnStatement {
45
65
  type: "alter_table_drop_column";
@@ -120,7 +140,8 @@ export interface JsonAlterCompositePK {
120
140
  export interface JsonAlterTableSetSchema {
121
141
  type: "alter_table_set_schema";
122
142
  tableName: string;
123
- schema: string;
143
+ schemaFrom: string;
144
+ schemaTo: string;
124
145
  }
125
146
  export interface JsonAlterTableRemoveFromSchema {
126
147
  type: "alter_table_remove_from_schema";
@@ -292,14 +313,20 @@ export interface JsonRenameSchema {
292
313
  to: string;
293
314
  }
294
315
  export type JsonAlterColumnStatement = JsonRenameColumnStatement | JsonAlterColumnTypeStatement | JsonAlterColumnSetDefaultStatement | JsonAlterColumnDropDefaultStatement | JsonAlterColumnSetNotNullStatement | JsonAlterColumnDropNotNullStatement | JsonAlterColumnDropOnUpdateStatement | JsonAlterColumnSetOnUpdateStatement | JsonAlterColumnDropAutoincrementStatement | JsonAlterColumnSetAutoincrementStatement | JsonAlterColumnSetPrimaryKeyStatement | JsonAlterColumnDropPrimaryKeyStatement;
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;
316
+ export type JsonStatement = JsonAlterColumnStatement | JsonCreateTableStatement | JsonDropTableStatement | JsonRenameTableStatement | JsonCreateEnumStatement | JsonDropEnumStatement | JsonMoveEnumStatement | JsonRenameEnumStatement | JsonAddValueToEnumStatement | JsonDropColumnStatement | JsonAddColumnStatement | JsonCreateIndexStatement | JsonCreateReferenceStatement | JsonAlterReferenceStatement | JsonDeleteReferenceStatement | JsonDropIndexStatement | JsonReferenceStatement | JsonSqliteCreateTableStatement | JsonSqliteAddColumnStatement | JsonCreateCompositePK | JsonDeleteCompositePK | JsonAlterCompositePK | JsonCreateUniqueConstraint | JsonDeleteUniqueConstraint | JsonAlterUniqueConstraint | JsonCreateSchema | JsonDropSchema | JsonRenameSchema | JsonAlterTableSetSchema | JsonAlterTableRemoveFromSchema | JsonAlterTableSetNewSchema;
296
317
  export declare const preparePgCreateTableJson: (table: Table, json2: PgSchema) => JsonCreateTableStatement;
297
- export declare const prepareMySqlCreateTableJson: (table: Table, json2: PgSchema) => JsonCreateTableStatement;
318
+ export declare const prepareMySqlCreateTableJson: (table: Table, json2: MySqlSchema) => JsonCreateTableStatement;
298
319
  export declare const prepareSQLiteCreateTable: (table: Table) => JsonSqliteCreateTableStatement;
299
320
  export declare const prepareDropTableJson: (table: Table) => JsonDropTableStatement;
300
321
  export declare const prepareRenameTableJson: (tableFrom: Table, tableTo: Table) => JsonRenameTableStatement;
301
- export declare const prepareCreateEnumJson: (name: string, values: string[]) => JsonCreateEnumStatement;
302
- export declare const prepareAddValuesToEnumJson: (name: string, values: string[]) => JsonAddValueToEnumStatement[];
322
+ export declare const prepareCreateEnumJson: (name: string, schema: string, values: string[]) => JsonCreateEnumStatement;
323
+ export declare const prepareAddValuesToEnumJson: (name: string, schema: string, values: {
324
+ value: string;
325
+ before: string;
326
+ }[]) => JsonAddValueToEnumStatement[];
327
+ export declare const prepareDropEnumJson: (name: string, schema: string) => JsonDropEnumStatement;
328
+ export declare const prepareMoveEnumJson: (name: string, schemaFrom: string, schemaTo: string) => JsonMoveEnumStatement;
329
+ export declare const prepareRenameEnumJson: (nameFrom: string, nameTo: string, schema: string) => JsonRenameEnumStatement;
303
330
  export declare const prepareCreateSchemasJson: (values: string[]) => JsonCreateSchema[];
304
331
  export declare const prepareRenameSchemasJson: (values: {
305
332
  from: string;
@@ -310,11 +337,11 @@ export declare const prepareRenameColumns: (tableName: string, schema: string, p
310
337
  from: Column;
311
338
  to: Column;
312
339
  }[]) => JsonRenameColumnStatement[];
313
- export declare const prepareAlterTableColumnsJson: (tableName: string, schema: string, deleted: Column[], added: Column[], altered: AlteredColumn[], addedFk: Record<string, string>, json2: CommonSquashedSchema, dialect?: Dialect) => {
314
- addColumns: JsonStatement[];
315
- dropColumns: JsonDropColumnStatement[];
316
- alterColumns: JsonAlterColumnStatement[];
317
- };
340
+ export declare const _prepareDropColumns: (taleName: string, schema: string, columns: Column[]) => JsonDropColumnStatement[];
341
+ export declare const _prepareAddColumns: (tableName: string, schema: string, columns: Column[]) => JsonAddColumnStatement[];
342
+ export declare const prepareAlterColumnsMysql: (tableName: string, schema: string, columns: AlteredColumn[], json2: CommonSquashedSchema) => JsonAlterColumnStatement[];
343
+ export declare const preparePgAlterColumns: (_tableName: string, schema: string, columns: AlteredColumn[], json2: CommonSquashedSchema) => JsonAlterColumnStatement[];
344
+ export declare const prepareSqliteAlterColumns: (tableName: string, schema: string, columns: AlteredColumn[], json2: CommonSquashedSchema) => JsonAlterColumnStatement[];
318
345
  export declare const prepareCreateIndexesJson: (tableName: string, schema: string, indexes: Record<string, string>) => JsonCreateIndexStatement[];
319
346
  export declare const prepareCreateReferencesJson: (tableName: string, schema: string, foreignKeys: Record<string, string>) => JsonCreateReferenceStatement[];
320
347
  export declare const prepareDropReferencesJson: (tableName: string, schema: string, foreignKeys: Record<string, string>) => JsonDeleteReferenceStatement[];