drizzle-kit 0.20.17 → 0.20.18-d190692

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/bin.cjs +101440 -53514
  2. package/index.d.mts +46 -68
  3. package/index.d.ts +46 -68
  4. package/index.js +1 -0
  5. package/package.json +31 -64
  6. package/payload.d.mts +1052 -18
  7. package/payload.d.ts +1052 -18
  8. package/payload.js +20367 -34639
  9. package/payload.mjs +20377 -34642
  10. package/utils-studio.js +4580 -805
  11. package/utils-studio.mjs +4556 -784
  12. package/utils.js +4410 -6940
  13. package/utils.mjs +4852 -7382
  14. package/@types/utils.d.ts +0 -12
  15. package/cli/commands/migrate.d.ts +0 -270
  16. package/cli/commands/mysqlIntrospect.d.ts +0 -119
  17. package/cli/commands/mysqlPushUtils.d.ts +0 -18
  18. package/cli/commands/mysqlUp.d.ts +0 -4
  19. package/cli/commands/pgConnect.d.ts +0 -5
  20. package/cli/commands/pgIntrospect.d.ts +0 -123
  21. package/cli/commands/pgPushUtils.d.ts +0 -14
  22. package/cli/commands/pgUp.d.ts +0 -4
  23. package/cli/commands/sqliteIntrospect.d.ts +0 -107
  24. package/cli/commands/sqlitePushUtils.d.ts +0 -21
  25. package/cli/commands/sqliteUtils.d.ts +0 -162
  26. package/cli/commands/upFolders.d.ts +0 -27
  27. package/cli/commands/utils.d.ts +0 -274
  28. package/cli/selector-ui.d.ts +0 -13
  29. package/cli/validations/common.d.ts +0 -13
  30. package/cli/validations/mysql.d.ts +0 -365
  31. package/cli/validations/outputs.d.ts +0 -40
  32. package/cli/validations/pg.d.ts +0 -438
  33. package/cli/views.d.ts +0 -61
  34. package/drivers/index.d.ts +0 -39
  35. package/global.d.ts +0 -4
  36. package/introspect-mysql.d.ts +0 -9
  37. package/introspect-pg.d.ts +0 -12
  38. package/introspect-sqlite.d.ts +0 -10
  39. package/jsonDiffer.d.ts +0 -76
  40. package/jsonStatements.d.ts +0 -349
  41. package/migrationPreparator.d.ts +0 -35
  42. package/schemaValidator.d.ts +0 -1313
  43. package/serializer/index.d.ts +0 -9
  44. package/serializer/mysqlImports.d.ts +0 -11
  45. package/serializer/mysqlSchema.d.ts +0 -3833
  46. package/serializer/mysqlSerializer.d.ts +0 -7
  47. package/serializer/pgImports.d.ts +0 -11
  48. package/serializer/pgSchema.d.ts +0 -4333
  49. package/serializer/pgSerializer.d.ts +0 -7
  50. package/serializer/schemaToDrizzle.d.ts +0 -7
  51. package/serializer/sqliteImports.d.ts +0 -9
  52. package/serializer/sqliteSchema.d.ts +0 -3227
  53. package/serializer/sqliteSerializer.d.ts +0 -6
  54. package/snapshotsDiffer.d.ts +0 -2660
  55. package/sqlgenerator.d.ts +0 -33
  56. package/utils/words.d.ts +0 -7
  57. package/utils-studio.d.mts +0 -5
  58. package/utils-studio.d.ts +0 -5
  59. package/utils.d.ts +0 -199
@@ -1,349 +0,0 @@
1
- import { CommonSquashedSchema, Dialect } 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
- values: string[];
38
- }
39
- export interface JsonAddValueToEnumStatement {
40
- type: "alter_type_add_value";
41
- name: string;
42
- value: string;
43
- }
44
- export interface JsonDropColumnStatement {
45
- type: "alter_table_drop_column";
46
- tableName: string;
47
- columnName: string;
48
- schema: string;
49
- }
50
- export interface JsonAddColumnStatement {
51
- type: "alter_table_add_column";
52
- tableName: string;
53
- column: Column;
54
- schema: string;
55
- }
56
- export interface JsonSqliteAddColumnStatement {
57
- type: "sqlite_alter_table_add_column";
58
- tableName: string;
59
- column: Column;
60
- referenceData?: string;
61
- }
62
- export interface JsonCreateIndexStatement {
63
- type: "create_index";
64
- tableName: string;
65
- data: string;
66
- schema: string;
67
- }
68
- export interface JsonReferenceStatement {
69
- type: "create_reference" | "alter_reference" | "delete_reference";
70
- data: string;
71
- schema: string;
72
- tableName: string;
73
- }
74
- export interface JsonCreateUniqueConstraint {
75
- type: "create_unique_constraint";
76
- tableName: string;
77
- data: string;
78
- schema?: string;
79
- constraintName?: string;
80
- }
81
- export interface JsonDeleteUniqueConstraint {
82
- type: "delete_unique_constraint";
83
- tableName: string;
84
- data: string;
85
- schema?: string;
86
- constraintName?: string;
87
- }
88
- export interface JsonAlterUniqueConstraint {
89
- type: "alter_unique_constraint";
90
- tableName: string;
91
- old: string;
92
- new: string;
93
- schema?: string;
94
- oldConstraintName?: string;
95
- newConstraintName?: string;
96
- }
97
- export interface JsonCreateCompositePK {
98
- type: "create_composite_pk";
99
- tableName: string;
100
- data: string;
101
- schema?: string;
102
- constraintName?: string;
103
- }
104
- export interface JsonDeleteCompositePK {
105
- type: "delete_composite_pk";
106
- tableName: string;
107
- data: string;
108
- schema?: string;
109
- constraintName?: string;
110
- }
111
- export interface JsonAlterCompositePK {
112
- type: "alter_composite_pk";
113
- tableName: string;
114
- old: string;
115
- new: string;
116
- schema?: string;
117
- oldConstraintName?: string;
118
- newConstraintName?: string;
119
- }
120
- export interface JsonAlterTableSetSchema {
121
- type: "alter_table_set_schema";
122
- tableName: string;
123
- schema: string;
124
- }
125
- export interface JsonAlterTableRemoveFromSchema {
126
- type: "alter_table_remove_from_schema";
127
- tableName: string;
128
- schema: string;
129
- }
130
- export interface JsonAlterTableSetNewSchema {
131
- type: "alter_table_set_new_schema";
132
- tableName: string;
133
- from: string;
134
- to: string;
135
- }
136
- export interface JsonCreateReferenceStatement extends JsonReferenceStatement {
137
- type: "create_reference";
138
- }
139
- export interface JsonAlterReferenceStatement extends JsonReferenceStatement {
140
- type: "alter_reference";
141
- oldFkey: string;
142
- }
143
- export interface JsonDeleteReferenceStatement extends JsonReferenceStatement {
144
- type: "delete_reference";
145
- }
146
- export interface JsonDropIndexStatement {
147
- type: "drop_index";
148
- tableName: string;
149
- data: string;
150
- schema: string;
151
- }
152
- export interface JsonRenameColumnStatement {
153
- type: "alter_table_rename_column";
154
- tableName: string;
155
- oldColumnName: string;
156
- newColumnName: string;
157
- schema: string;
158
- }
159
- export interface JsonAlterColumnTypeStatement {
160
- type: "alter_table_alter_column_set_type";
161
- tableName: string;
162
- columnName: string;
163
- newDataType: string;
164
- oldDataType: string;
165
- schema: string;
166
- columnDefault: string;
167
- columnOnUpdate: boolean;
168
- columnNotNull: boolean;
169
- columnAutoIncrement: boolean;
170
- columnPk: boolean;
171
- }
172
- export interface JsonAlterColumnSetPrimaryKeyStatement {
173
- type: "alter_table_alter_column_set_pk";
174
- tableName: string;
175
- schema: string;
176
- columnName: string;
177
- }
178
- export interface JsonAlterColumnDropPrimaryKeyStatement {
179
- type: "alter_table_alter_column_drop_pk";
180
- tableName: string;
181
- columnName: string;
182
- schema: string;
183
- }
184
- export interface JsonAlterColumnSetDefaultStatement {
185
- type: "alter_table_alter_column_set_default";
186
- tableName: string;
187
- columnName: string;
188
- newDefaultValue: any;
189
- oldDefaultValue?: any;
190
- schema: string;
191
- newDataType: string;
192
- columnOnUpdate: boolean;
193
- columnNotNull: boolean;
194
- columnAutoIncrement: boolean;
195
- columnPk: boolean;
196
- }
197
- export interface JsonAlterColumnDropDefaultStatement {
198
- type: "alter_table_alter_column_drop_default";
199
- tableName: string;
200
- columnName: string;
201
- schema: string;
202
- newDataType: string;
203
- columnDefault: string;
204
- columnOnUpdate: boolean;
205
- columnNotNull: boolean;
206
- columnAutoIncrement: boolean;
207
- columnPk: boolean;
208
- }
209
- export interface JsonAlterColumnSetNotNullStatement {
210
- type: "alter_table_alter_column_set_notnull";
211
- tableName: string;
212
- columnName: string;
213
- schema: string;
214
- newDataType: string;
215
- columnDefault: string;
216
- columnOnUpdate: boolean;
217
- columnNotNull: boolean;
218
- columnAutoIncrement: boolean;
219
- columnPk: boolean;
220
- }
221
- export interface JsonAlterColumnDropNotNullStatement {
222
- type: "alter_table_alter_column_drop_notnull";
223
- tableName: string;
224
- columnName: string;
225
- schema: string;
226
- newDataType: string;
227
- columnDefault: string;
228
- columnOnUpdate: boolean;
229
- columnNotNull: boolean;
230
- columnAutoIncrement: boolean;
231
- columnPk: boolean;
232
- }
233
- export interface JsonAlterColumnSetOnUpdateStatement {
234
- type: "alter_table_alter_column_set_on_update";
235
- tableName: string;
236
- columnName: string;
237
- schema: string;
238
- newDataType: string;
239
- columnDefault: string;
240
- columnOnUpdate: boolean;
241
- columnNotNull: boolean;
242
- columnAutoIncrement: boolean;
243
- columnPk: boolean;
244
- }
245
- export interface JsonAlterColumnDropOnUpdateStatement {
246
- type: "alter_table_alter_column_drop_on_update";
247
- tableName: string;
248
- columnName: string;
249
- schema: string;
250
- newDataType: string;
251
- columnDefault: string;
252
- columnOnUpdate: boolean;
253
- columnNotNull: boolean;
254
- columnAutoIncrement: boolean;
255
- columnPk: boolean;
256
- }
257
- export interface JsonAlterColumnSetAutoincrementStatement {
258
- type: "alter_table_alter_column_set_autoincrement";
259
- tableName: string;
260
- columnName: string;
261
- schema: string;
262
- newDataType: string;
263
- columnDefault: string;
264
- columnOnUpdate: boolean;
265
- columnNotNull: boolean;
266
- columnAutoIncrement: boolean;
267
- columnPk: boolean;
268
- }
269
- export interface JsonAlterColumnDropAutoincrementStatement {
270
- type: "alter_table_alter_column_drop_autoincrement";
271
- tableName: string;
272
- columnName: string;
273
- schema: string;
274
- newDataType: string;
275
- columnDefault: string;
276
- columnOnUpdate: boolean;
277
- columnNotNull: boolean;
278
- columnAutoIncrement: boolean;
279
- columnPk: boolean;
280
- }
281
- export interface JsonCreateSchema {
282
- type: "create_schema";
283
- name: string;
284
- }
285
- export interface JsonDropSchema {
286
- type: "drop_schema";
287
- name: string;
288
- }
289
- export interface JsonRenameSchema {
290
- type: "rename_schema";
291
- from: string;
292
- to: string;
293
- }
294
- 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;
296
- export declare const preparePgCreateTableJson: (table: Table, json2: PgSchema) => JsonCreateTableStatement;
297
- export declare const prepareMySqlCreateTableJson: (table: Table, json2: PgSchema) => JsonCreateTableStatement;
298
- export declare const prepareSQLiteCreateTable: (table: Table) => JsonSqliteCreateTableStatement;
299
- export declare const prepareDropTableJson: (table: Table) => JsonDropTableStatement;
300
- 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[];
303
- export declare const prepareCreateSchemasJson: (values: string[]) => JsonCreateSchema[];
304
- export declare const prepareRenameSchemasJson: (values: {
305
- from: string;
306
- to: string;
307
- }[]) => JsonRenameSchema[];
308
- export declare const prepareDeleteSchemasJson: (values: string[]) => JsonDropSchema[];
309
- export declare const prepareRenameColumns: (tableName: string, schema: string, pairs: {
310
- from: Column;
311
- to: Column;
312
- }[]) => 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
- };
318
- export declare const prepareCreateIndexesJson: (tableName: string, schema: string, indexes: Record<string, string>) => JsonCreateIndexStatement[];
319
- export declare const prepareCreateReferencesJson: (tableName: string, schema: string, foreignKeys: Record<string, string>) => JsonCreateReferenceStatement[];
320
- export declare const prepareDropReferencesJson: (tableName: string, schema: string, foreignKeys: Record<string, string>) => JsonDeleteReferenceStatement[];
321
- export declare const prepareAlterReferencesJson: (tableName: string, schema: string, foreignKeys: Record<string, {
322
- __old: string;
323
- __new: string;
324
- }>) => JsonReferenceStatement[];
325
- export declare const prepareDropIndexesJson: (tableName: string, schema: string, indexes: Record<string, string>) => JsonDropIndexStatement[];
326
- export declare const prepareAddCompositePrimaryKeySqlite: (tableName: string, pks: Record<string, string>) => JsonCreateCompositePK[];
327
- export declare const prepareDeleteCompositePrimaryKeySqlite: (tableName: string, pks: Record<string, string>) => JsonDeleteCompositePK[];
328
- export declare const prepareAlterCompositePrimaryKeySqlite: (tableName: string, pks: Record<string, {
329
- __old: string;
330
- __new: string;
331
- }>) => JsonAlterCompositePK[];
332
- export declare const prepareAddCompositePrimaryKeyPg: (tableName: string, schema: string, pks: Record<string, string>, json2: PgSchema) => JsonCreateCompositePK[];
333
- export declare const prepareDeleteCompositePrimaryKeyPg: (tableName: string, schema: string, pks: Record<string, string>, json1: PgSchema) => JsonDeleteCompositePK[];
334
- export declare const prepareAlterCompositePrimaryKeyPg: (tableName: string, schema: string, pks: Record<string, {
335
- __old: string;
336
- __new: string;
337
- }>, json1: PgSchema, json2: PgSchema) => JsonAlterCompositePK[];
338
- export declare const prepareAddUniqueConstraintPg: (tableName: string, schema: string, unqs: Record<string, string>) => JsonCreateUniqueConstraint[];
339
- export declare const prepareDeleteUniqueConstraintPg: (tableName: string, schema: string, unqs: Record<string, string>) => JsonDeleteUniqueConstraint[];
340
- export declare const prepareAlterUniqueConstraintPg: (tableName: string, schema: string, unqs: Record<string, {
341
- __old: string;
342
- __new: string;
343
- }>) => JsonAlterUniqueConstraint[];
344
- export declare const prepareAddCompositePrimaryKeyMySql: (tableName: string, pks: Record<string, string>, json1: MySqlSchema, json2: MySqlSchema) => JsonCreateCompositePK[];
345
- export declare const prepareDeleteCompositePrimaryKeyMySql: (tableName: string, pks: Record<string, string>, json1: MySqlSchema) => JsonDeleteCompositePK[];
346
- export declare const prepareAlterCompositePrimaryKeyMySql: (tableName: string, pks: Record<string, {
347
- __old: string;
348
- __new: string;
349
- }>, 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
- }>;