drizzle-kit 0.20.17-9f0ea64 → 0.20.17-a1c0ab3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/bin.cjs +71994 -35815
  2. package/index.d.mts +35 -65
  3. package/index.d.ts +35 -65
  4. package/package.json +8 -16
  5. package/payload.d.mts +1052 -18
  6. package/payload.d.ts +1052 -18
  7. package/payload.js +18757 -34176
  8. package/payload.mjs +17495 -32894
  9. package/utils-studio.js +1039 -3348
  10. package/utils-studio.mjs +1012 -3321
  11. package/utils.js +864 -223
  12. package/utils.mjs +839 -198
  13. package/@types/utils.d.ts +0 -12
  14. package/cli/commands/migrate.d.ts +0 -287
  15. package/cli/commands/mysqlIntrospect.d.ts +0 -55
  16. package/cli/commands/mysqlPushUtils.d.ts +0 -14
  17. package/cli/commands/pgIntrospect.d.ts +0 -59
  18. package/cli/commands/pgPushUtils.d.ts +0 -11
  19. package/cli/commands/sqliteIntrospect.d.ts +0 -104
  20. package/cli/commands/sqlitePushUtils.d.ts +0 -15
  21. package/cli/commands/utils.d.ts +0 -58
  22. package/cli/selector-ui.d.ts +0 -13
  23. package/cli/utils.d.ts +0 -13
  24. package/cli/validations/cli.d.ts +0 -169
  25. package/cli/validations/common.d.ts +0 -214
  26. package/cli/validations/mysql.d.ts +0 -35
  27. package/cli/validations/outputs.d.ts +0 -41
  28. package/cli/validations/pg.d.ts +0 -31
  29. package/cli/validations/sqlite.d.ts +0 -34
  30. package/cli/views.d.ts +0 -63
  31. package/global.d.ts +0 -6
  32. package/introspect-sqlite.d.ts +0 -10
  33. package/jsonDiffer.d.ts +0 -61
  34. package/jsonStatements.d.ts +0 -376
  35. package/migrationPreparator.d.ts +0 -35
  36. package/schemaValidator.d.ts +0 -1316
  37. package/serializer/index.d.ts +0 -9
  38. package/serializer/mysqlImports.d.ts +0 -7
  39. package/serializer/mysqlSchema.d.ts +0 -4650
  40. package/serializer/mysqlSerializer.d.ts +0 -7
  41. package/serializer/pgImports.d.ts +0 -11
  42. package/serializer/pgSchema.d.ts +0 -4792
  43. package/serializer/pgSerializer.d.ts +0 -7
  44. package/serializer/schemaToDrizzle.d.ts +0 -7
  45. package/serializer/sqliteImports.d.ts +0 -7
  46. package/serializer/sqliteSchema.d.ts +0 -2801
  47. package/serializer/sqliteSerializer.d.ts +0 -6
  48. package/snapshotsDiffer.d.ts +0 -3937
  49. package/sqlgenerator.d.ts +0 -33
  50. package/utils/words.d.ts +0 -7
  51. package/utils-studio.d.mts +0 -4
  52. package/utils-studio.d.ts +0 -4
  53. package/utils.d.ts +0 -72
package/jsonDiffer.d.ts DELETED
@@ -1,61 +0,0 @@
1
- export function diffForRenamedTables(pairs: any): any;
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
- };
10
- export function applyJsonDiff(json1: any, json2: any): {
11
- alteredTablesWithColumns: {
12
- name: any;
13
- schema: any;
14
- altered: any[];
15
- addedIndexes: {
16
- [k: string]: any;
17
- };
18
- deletedIndexes: {
19
- [k: string]: any;
20
- };
21
- alteredIndexes: {
22
- [k: string]: any;
23
- };
24
- addedForeignKeys: {
25
- [k: string]: any;
26
- };
27
- deletedForeignKeys: {
28
- [k: string]: any;
29
- };
30
- alteredForeignKeys: {
31
- [k: string]: any;
32
- };
33
- addedCompositePKs: {
34
- [k: string]: any;
35
- };
36
- deletedCompositePKs: {
37
- [k: string]: any;
38
- };
39
- alteredCompositePKs: {
40
- [k: string]: any;
41
- };
42
- addedUniqueConstraints: {
43
- [k: string]: any;
44
- };
45
- deletedUniqueConstraints: {
46
- [k: string]: any;
47
- };
48
- alteredUniqueConstraints: {
49
- [k: string]: any;
50
- };
51
- }[];
52
- alteredEnums: {
53
- name: any;
54
- schema: any;
55
- addedValues: {
56
- before: any;
57
- value: any;
58
- }[];
59
- deletedValues: any[];
60
- }[];
61
- };
@@ -1,376 +0,0 @@
1
- import { CommonSquashedSchema } from "./schemaValidator";
2
- import { MySqlSchema } from "./serializer/mysqlSchema";
3
- import { PgSchema } from "./serializer/pgSchema";
4
- import { AlteredColumn, Column, Table } from "./snapshotsDiffer";
5
- export interface JsonSqliteCreateTableStatement {
6
- type: "sqlite_create_table";
7
- tableName: string;
8
- columns: Column[];
9
- referenceData: string[];
10
- compositePKs: string[][];
11
- uniqueConstraints?: string[];
12
- }
13
- export interface JsonCreateTableStatement {
14
- type: "create_table";
15
- tableName: string;
16
- schema: string;
17
- columns: Column[];
18
- compositePKs: string[];
19
- compositePkName?: string;
20
- uniqueConstraints?: string[];
21
- }
22
- export interface JsonDropTableStatement {
23
- type: "drop_table";
24
- tableName: string;
25
- schema: string;
26
- }
27
- export interface JsonRenameTableStatement {
28
- type: "rename_table";
29
- fromSchema: string;
30
- toSchema: string;
31
- tableNameFrom: string;
32
- tableNameTo: string;
33
- }
34
- export interface JsonCreateEnumStatement {
35
- type: "create_type_enum";
36
- name: string;
37
- schema: string;
38
- values: string[];
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
- }
57
- export interface JsonAddValueToEnumStatement {
58
- type: "alter_type_add_value";
59
- name: string;
60
- schema: string;
61
- value: string;
62
- before: string;
63
- }
64
- export interface JsonDropColumnStatement {
65
- type: "alter_table_drop_column";
66
- tableName: string;
67
- columnName: string;
68
- schema: string;
69
- }
70
- export interface JsonAddColumnStatement {
71
- type: "alter_table_add_column";
72
- tableName: string;
73
- column: Column;
74
- schema: string;
75
- }
76
- export interface JsonSqliteAddColumnStatement {
77
- type: "sqlite_alter_table_add_column";
78
- tableName: string;
79
- column: Column;
80
- referenceData?: string;
81
- }
82
- export interface JsonCreateIndexStatement {
83
- type: "create_index";
84
- tableName: string;
85
- data: string;
86
- schema: string;
87
- }
88
- export interface JsonReferenceStatement {
89
- type: "create_reference" | "alter_reference" | "delete_reference";
90
- data: string;
91
- schema: string;
92
- tableName: string;
93
- }
94
- export interface JsonCreateUniqueConstraint {
95
- type: "create_unique_constraint";
96
- tableName: string;
97
- data: string;
98
- schema?: string;
99
- constraintName?: string;
100
- }
101
- export interface JsonDeleteUniqueConstraint {
102
- type: "delete_unique_constraint";
103
- tableName: string;
104
- data: string;
105
- schema?: string;
106
- constraintName?: string;
107
- }
108
- export interface JsonAlterUniqueConstraint {
109
- type: "alter_unique_constraint";
110
- tableName: string;
111
- old: string;
112
- new: string;
113
- schema?: string;
114
- oldConstraintName?: string;
115
- newConstraintName?: string;
116
- }
117
- export interface JsonCreateCompositePK {
118
- type: "create_composite_pk";
119
- tableName: string;
120
- data: string;
121
- schema?: string;
122
- constraintName?: string;
123
- }
124
- export interface JsonDeleteCompositePK {
125
- type: "delete_composite_pk";
126
- tableName: string;
127
- data: string;
128
- schema?: string;
129
- constraintName?: string;
130
- }
131
- export interface JsonAlterCompositePK {
132
- type: "alter_composite_pk";
133
- tableName: string;
134
- old: string;
135
- new: string;
136
- schema?: string;
137
- oldConstraintName?: string;
138
- newConstraintName?: string;
139
- }
140
- export interface JsonAlterTableSetSchema {
141
- type: "alter_table_set_schema";
142
- tableName: string;
143
- schemaFrom: string;
144
- schemaTo: string;
145
- }
146
- export interface JsonAlterTableRemoveFromSchema {
147
- type: "alter_table_remove_from_schema";
148
- tableName: string;
149
- schema: string;
150
- }
151
- export interface JsonAlterTableSetNewSchema {
152
- type: "alter_table_set_new_schema";
153
- tableName: string;
154
- from: string;
155
- to: string;
156
- }
157
- export interface JsonCreateReferenceStatement extends JsonReferenceStatement {
158
- type: "create_reference";
159
- }
160
- export interface JsonAlterReferenceStatement extends JsonReferenceStatement {
161
- type: "alter_reference";
162
- oldFkey: string;
163
- }
164
- export interface JsonDeleteReferenceStatement extends JsonReferenceStatement {
165
- type: "delete_reference";
166
- }
167
- export interface JsonDropIndexStatement {
168
- type: "drop_index";
169
- tableName: string;
170
- data: string;
171
- schema: string;
172
- }
173
- export interface JsonRenameColumnStatement {
174
- type: "alter_table_rename_column";
175
- tableName: string;
176
- oldColumnName: string;
177
- newColumnName: string;
178
- schema: string;
179
- }
180
- export interface JsonAlterColumnTypeStatement {
181
- type: "alter_table_alter_column_set_type";
182
- tableName: string;
183
- columnName: string;
184
- newDataType: string;
185
- oldDataType: string;
186
- schema: string;
187
- columnDefault: string;
188
- columnOnUpdate: boolean;
189
- columnNotNull: boolean;
190
- columnAutoIncrement: boolean;
191
- columnPk: boolean;
192
- }
193
- export interface JsonAlterColumnSetPrimaryKeyStatement {
194
- type: "alter_table_alter_column_set_pk";
195
- tableName: string;
196
- schema: string;
197
- columnName: string;
198
- }
199
- export interface JsonAlterColumnDropPrimaryKeyStatement {
200
- type: "alter_table_alter_column_drop_pk";
201
- tableName: string;
202
- columnName: string;
203
- schema: string;
204
- }
205
- export interface JsonAlterColumnSetDefaultStatement {
206
- type: "alter_table_alter_column_set_default";
207
- tableName: string;
208
- columnName: string;
209
- newDefaultValue: any;
210
- oldDefaultValue?: any;
211
- schema: string;
212
- newDataType: string;
213
- columnOnUpdate: boolean;
214
- columnNotNull: boolean;
215
- columnAutoIncrement: boolean;
216
- columnPk: boolean;
217
- }
218
- export interface JsonAlterColumnDropDefaultStatement {
219
- type: "alter_table_alter_column_drop_default";
220
- tableName: string;
221
- columnName: string;
222
- schema: string;
223
- newDataType: string;
224
- columnDefault: string;
225
- columnOnUpdate: boolean;
226
- columnNotNull: boolean;
227
- columnAutoIncrement: boolean;
228
- columnPk: boolean;
229
- }
230
- export interface JsonAlterColumnSetNotNullStatement {
231
- type: "alter_table_alter_column_set_notnull";
232
- tableName: string;
233
- columnName: string;
234
- schema: string;
235
- newDataType: string;
236
- columnDefault: string;
237
- columnOnUpdate: boolean;
238
- columnNotNull: boolean;
239
- columnAutoIncrement: boolean;
240
- columnPk: boolean;
241
- }
242
- export interface JsonAlterColumnDropNotNullStatement {
243
- type: "alter_table_alter_column_drop_notnull";
244
- tableName: string;
245
- columnName: string;
246
- schema: string;
247
- newDataType: string;
248
- columnDefault: string;
249
- columnOnUpdate: boolean;
250
- columnNotNull: boolean;
251
- columnAutoIncrement: boolean;
252
- columnPk: boolean;
253
- }
254
- export interface JsonAlterColumnSetOnUpdateStatement {
255
- type: "alter_table_alter_column_set_on_update";
256
- tableName: string;
257
- columnName: string;
258
- schema: string;
259
- newDataType: string;
260
- columnDefault: string;
261
- columnOnUpdate: boolean;
262
- columnNotNull: boolean;
263
- columnAutoIncrement: boolean;
264
- columnPk: boolean;
265
- }
266
- export interface JsonAlterColumnDropOnUpdateStatement {
267
- type: "alter_table_alter_column_drop_on_update";
268
- tableName: string;
269
- columnName: string;
270
- schema: string;
271
- newDataType: string;
272
- columnDefault: string;
273
- columnOnUpdate: boolean;
274
- columnNotNull: boolean;
275
- columnAutoIncrement: boolean;
276
- columnPk: boolean;
277
- }
278
- export interface JsonAlterColumnSetAutoincrementStatement {
279
- type: "alter_table_alter_column_set_autoincrement";
280
- tableName: string;
281
- columnName: string;
282
- schema: string;
283
- newDataType: string;
284
- columnDefault: string;
285
- columnOnUpdate: boolean;
286
- columnNotNull: boolean;
287
- columnAutoIncrement: boolean;
288
- columnPk: boolean;
289
- }
290
- export interface JsonAlterColumnDropAutoincrementStatement {
291
- type: "alter_table_alter_column_drop_autoincrement";
292
- tableName: string;
293
- columnName: string;
294
- schema: string;
295
- newDataType: string;
296
- columnDefault: string;
297
- columnOnUpdate: boolean;
298
- columnNotNull: boolean;
299
- columnAutoIncrement: boolean;
300
- columnPk: boolean;
301
- }
302
- export interface JsonCreateSchema {
303
- type: "create_schema";
304
- name: string;
305
- }
306
- export interface JsonDropSchema {
307
- type: "drop_schema";
308
- name: string;
309
- }
310
- export interface JsonRenameSchema {
311
- type: "rename_schema";
312
- from: string;
313
- to: string;
314
- }
315
- export type JsonAlterColumnStatement = JsonRenameColumnStatement | JsonAlterColumnTypeStatement | JsonAlterColumnSetDefaultStatement | JsonAlterColumnDropDefaultStatement | JsonAlterColumnSetNotNullStatement | JsonAlterColumnDropNotNullStatement | JsonAlterColumnDropOnUpdateStatement | JsonAlterColumnSetOnUpdateStatement | JsonAlterColumnDropAutoincrementStatement | JsonAlterColumnSetAutoincrementStatement | JsonAlterColumnSetPrimaryKeyStatement | JsonAlterColumnDropPrimaryKeyStatement;
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;
317
- export declare const preparePgCreateTableJson: (table: Table, json2: PgSchema) => JsonCreateTableStatement;
318
- export declare const prepareMySqlCreateTableJson: (table: Table, json2: MySqlSchema) => JsonCreateTableStatement;
319
- export declare const prepareSQLiteCreateTable: (table: Table) => JsonSqliteCreateTableStatement;
320
- export declare const prepareDropTableJson: (table: Table) => JsonDropTableStatement;
321
- export declare const prepareRenameTableJson: (tableFrom: Table, tableTo: Table) => JsonRenameTableStatement;
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;
330
- export declare const prepareCreateSchemasJson: (values: string[]) => JsonCreateSchema[];
331
- export declare const prepareRenameSchemasJson: (values: {
332
- from: string;
333
- to: string;
334
- }[]) => JsonRenameSchema[];
335
- export declare const prepareDeleteSchemasJson: (values: string[]) => JsonDropSchema[];
336
- export declare const prepareRenameColumns: (tableName: string, schema: string, pairs: {
337
- from: Column;
338
- to: Column;
339
- }[]) => JsonRenameColumnStatement[];
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[];
345
- export declare const prepareCreateIndexesJson: (tableName: string, schema: string, indexes: Record<string, string>) => JsonCreateIndexStatement[];
346
- export declare const prepareCreateReferencesJson: (tableName: string, schema: string, foreignKeys: Record<string, string>) => JsonCreateReferenceStatement[];
347
- export declare const prepareDropReferencesJson: (tableName: string, schema: string, foreignKeys: Record<string, string>) => JsonDeleteReferenceStatement[];
348
- export declare const prepareAlterReferencesJson: (tableName: string, schema: string, foreignKeys: Record<string, {
349
- __old: string;
350
- __new: string;
351
- }>) => JsonReferenceStatement[];
352
- export declare const prepareDropIndexesJson: (tableName: string, schema: string, indexes: Record<string, string>) => JsonDropIndexStatement[];
353
- export declare const prepareAddCompositePrimaryKeySqlite: (tableName: string, pks: Record<string, string>) => JsonCreateCompositePK[];
354
- export declare const prepareDeleteCompositePrimaryKeySqlite: (tableName: string, pks: Record<string, string>) => JsonDeleteCompositePK[];
355
- export declare const prepareAlterCompositePrimaryKeySqlite: (tableName: string, pks: Record<string, {
356
- __old: string;
357
- __new: string;
358
- }>) => JsonAlterCompositePK[];
359
- export declare const prepareAddCompositePrimaryKeyPg: (tableName: string, schema: string, pks: Record<string, string>, json2: PgSchema) => JsonCreateCompositePK[];
360
- export declare const prepareDeleteCompositePrimaryKeyPg: (tableName: string, schema: string, pks: Record<string, string>, json1: PgSchema) => JsonDeleteCompositePK[];
361
- export declare const prepareAlterCompositePrimaryKeyPg: (tableName: string, schema: string, pks: Record<string, {
362
- __old: string;
363
- __new: string;
364
- }>, json1: PgSchema, json2: PgSchema) => JsonAlterCompositePK[];
365
- export declare const prepareAddUniqueConstraintPg: (tableName: string, schema: string, unqs: Record<string, string>) => JsonCreateUniqueConstraint[];
366
- export declare const prepareDeleteUniqueConstraintPg: (tableName: string, schema: string, unqs: Record<string, string>) => JsonDeleteUniqueConstraint[];
367
- export declare const prepareAlterUniqueConstraintPg: (tableName: string, schema: string, unqs: Record<string, {
368
- __old: string;
369
- __new: string;
370
- }>) => JsonAlterUniqueConstraint[];
371
- export declare const prepareAddCompositePrimaryKeyMySql: (tableName: string, pks: Record<string, string>, json1: MySqlSchema, json2: MySqlSchema) => JsonCreateCompositePK[];
372
- export declare const prepareDeleteCompositePrimaryKeyMySql: (tableName: string, pks: Record<string, string>, json1: MySqlSchema) => JsonDeleteCompositePK[];
373
- export declare const prepareAlterCompositePrimaryKeyMySql: (tableName: string, pks: Record<string, {
374
- __old: string;
375
- __new: string;
376
- }>, json1: MySqlSchema, json2: MySqlSchema) => JsonAlterCompositePK[];
@@ -1,35 +0,0 @@
1
- import { PgSchema, PgSchemaInternal } from "./serializer/pgSchema";
2
- import { SQLiteSchema } from "./serializer/sqliteSchema";
3
- import { MySqlSchema } from "./serializer/mysqlSchema";
4
- export declare const prepareMySqlDbPushSnapshot: (prev: MySqlSchema, schemaPath: string | string[]) => Promise<{
5
- prev: MySqlSchema;
6
- cur: MySqlSchema;
7
- }>;
8
- export declare const prepareSQLiteDbPushSnapshot: (prev: SQLiteSchema, schemaPath: string | string[]) => Promise<{
9
- prev: SQLiteSchema;
10
- cur: SQLiteSchema;
11
- }>;
12
- export declare const preparePgDbPushSnapshot: (prev: PgSchema, schemaPath: string | string[], schemaFilter?: string[]) => Promise<{
13
- prev: PgSchema;
14
- cur: PgSchema;
15
- }>;
16
- export declare const prepareMySqlMigrationSnapshot: (migrationFolders: string[], schemaPath: string | string[]) => Promise<{
17
- prev: MySqlSchema;
18
- cur: MySqlSchema;
19
- custom: MySqlSchema;
20
- }>;
21
- export declare const prepareSqliteMigrationSnapshot: (snapshots: string[], schemaPath: string | string[]) => Promise<{
22
- prev: SQLiteSchema;
23
- cur: SQLiteSchema;
24
- custom: SQLiteSchema;
25
- }>;
26
- export declare const fillPgSnapshot: ({ serialized, id, idPrev, }: {
27
- serialized: PgSchemaInternal;
28
- id: string;
29
- idPrev: string;
30
- }) => PgSchema;
31
- export declare const preparePgMigrationSnapshot: (snapshots: string[], schemaPath: string | string[]) => Promise<{
32
- prev: PgSchema;
33
- cur: PgSchema;
34
- custom: PgSchema;
35
- }>;