drizzle-kit 0.19.13-e7108b7 → 0.19.13-e99bac1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/@types/utils.d.ts +12 -0
  2. package/cli/commands/migrate.d.ts +141 -0
  3. package/cli/commands/mysqlUp.d.ts +4 -0
  4. package/cli/commands/pgIntrospect.d.ts +118 -0
  5. package/cli/commands/pgPushUtils.d.ts +14 -0
  6. package/cli/commands/pgUp.d.ts +4 -0
  7. package/cli/commands/sqliteIntrospect.d.ts +102 -0
  8. package/cli/commands/sqliteUtils.d.ts +162 -0
  9. package/cli/commands/upFolders.d.ts +27 -0
  10. package/cli/commands/utils.d.ts +265 -0
  11. package/cli/selector-ui.d.ts +13 -0
  12. package/cli/validations/common.d.ts +13 -0
  13. package/cli/validations/mysql.d.ts +414 -0
  14. package/cli/validations/outputs.d.ts +39 -0
  15. package/cli/validations/pg.d.ts +438 -0
  16. package/cli/validations/sqlite.d.ts +220 -0
  17. package/cli/validations/studio.d.ts +469 -0
  18. package/cli/views.d.ts +61 -0
  19. package/drivers/index.d.ts +26 -0
  20. package/global.d.ts +2 -0
  21. package/index.cjs +127 -8668
  22. package/introspect.d.ts +4 -0
  23. package/jsonDiffer.d.ts +76 -0
  24. package/jsonStatements.d.ts +349 -0
  25. package/migrationPreparator.d.ts +35 -0
  26. package/package.json +1 -1
  27. package/schemaValidator.d.ts +1236 -0
  28. package/serializer/index.d.ts +9 -0
  29. package/serializer/mysqlImports.d.ts +6 -0
  30. package/serializer/mysqlSchema.d.ts +3833 -0
  31. package/serializer/mysqlSerializer.d.ts +7 -0
  32. package/serializer/pgImports.d.ts +11 -0
  33. package/serializer/pgSchema.d.ts +4000 -0
  34. package/serializer/pgSerializer.d.ts +7 -0
  35. package/serializer/sqliteImports.d.ts +5 -0
  36. package/serializer/sqliteSchema.d.ts +3162 -0
  37. package/serializer/sqliteSerializer.d.ts +8 -0
  38. package/serializer/studioUtils.d.ts +31 -0
  39. package/snapshotsDiffer.d.ts +2660 -0
  40. package/sqlgenerator.d.ts +33 -0
  41. package/sqlite-introspect.d.ts +5 -0
  42. package/utils/words.d.ts +7 -0
  43. package/utils.d.ts +10 -6
  44. package/utils.js +117 -8658
  45. package/utilsR.d.ts +209 -0
@@ -0,0 +1,4 @@
1
+ import "./@types/utils";
2
+ import { ConfigIntrospectCasing } from "./cli/commands/utils";
3
+ import { PgSchema } from "./serializer/pgSchema";
4
+ export declare const schemaToTypeScript: (schema: PgSchema, casing: ConfigIntrospectCasing) => string;
@@ -0,0 +1,76 @@
1
+ export function diffForRenamedTables(pairs: any): any;
2
+ export function diffForRenamedColumn(t1: any, t2: any): any;
3
+ 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
+ alteredTablesWithColumns: {
16
+ name: any;
17
+ schema: {
18
+ type: string;
19
+ value: any;
20
+ };
21
+ deleted: any[];
22
+ added: any[];
23
+ altered: any[];
24
+ addedIndexes: {
25
+ [k: string]: any;
26
+ };
27
+ deletedIndexes: {
28
+ [k: string]: any;
29
+ };
30
+ alteredIndexes: {
31
+ [k: string]: any;
32
+ };
33
+ addedForeignKeys: {
34
+ [k: string]: any;
35
+ };
36
+ deletedForeignKeys: {
37
+ [k: string]: any;
38
+ };
39
+ alteredForeignKeys: {
40
+ [k: string]: any;
41
+ };
42
+ addedCompositePKs: {
43
+ [k: string]: any;
44
+ };
45
+ deletedCompositePKs: {
46
+ [k: string]: any;
47
+ };
48
+ alteredCompositePKs: {
49
+ [k: string]: any;
50
+ };
51
+ addedUniqueConstraints: {
52
+ [k: string]: any;
53
+ };
54
+ deletedUniqueConstraints: {
55
+ [k: string]: any;
56
+ };
57
+ alteredUniqueConstraints: {
58
+ [k: string]: any;
59
+ };
60
+ }[];
61
+ addedEnums: {
62
+ name: any;
63
+ values: any[];
64
+ }[];
65
+ deletedEnums: {
66
+ name: any;
67
+ values: any[];
68
+ }[];
69
+ alteredEnums: {
70
+ name: string;
71
+ addedValues: any[];
72
+ deletedValues: any[];
73
+ }[];
74
+ addedSchemas: any[];
75
+ deletedSchemas: any[];
76
+ };
@@ -0,0 +1,349 @@
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
+ }
73
+ export interface JsonCreateUniqueConstraint {
74
+ type: "create_unique_constraint";
75
+ tableName: string;
76
+ data: string;
77
+ schema?: string;
78
+ constraintName?: string;
79
+ }
80
+ export interface JsonDeleteUniqueConstraint {
81
+ type: "delete_unique_constraint";
82
+ tableName: string;
83
+ data: string;
84
+ schema?: string;
85
+ constraintName?: string;
86
+ }
87
+ export interface JsonAlterUniqueConstraint {
88
+ type: "alter_unique_constraint";
89
+ tableName: string;
90
+ old: string;
91
+ new: string;
92
+ schema?: string;
93
+ oldConstraintName?: string;
94
+ newConstraintName?: string;
95
+ }
96
+ export interface JsonCreateCompositePK {
97
+ type: "create_composite_pk";
98
+ tableName: string;
99
+ data: string;
100
+ schema?: string;
101
+ constraintName?: string;
102
+ }
103
+ export interface JsonDeleteCompositePK {
104
+ type: "delete_composite_pk";
105
+ tableName: string;
106
+ data: string;
107
+ schema?: string;
108
+ constraintName?: string;
109
+ }
110
+ export interface JsonAlterCompositePK {
111
+ type: "alter_composite_pk";
112
+ tableName: string;
113
+ old: string;
114
+ new: string;
115
+ schema?: string;
116
+ oldConstraintName?: string;
117
+ newConstraintName?: string;
118
+ }
119
+ export interface JsonAlterTableSetSchema {
120
+ type: "alter_table_set_schema";
121
+ tableName: string;
122
+ schema: string;
123
+ }
124
+ export interface JsonAlterTableRemoveFromSchema {
125
+ type: "alter_table_remove_from_schema";
126
+ tableName: string;
127
+ schema: string;
128
+ }
129
+ export interface JsonAlterTableSetNewSchema {
130
+ type: "alter_table_set_new_schema";
131
+ tableName: string;
132
+ from: string;
133
+ to: string;
134
+ }
135
+ export interface JsonCreateReferenceStatement extends JsonReferenceStatement {
136
+ type: "create_reference";
137
+ }
138
+ export interface JsonAlterReferenceStatement extends JsonReferenceStatement {
139
+ type: "alter_reference";
140
+ oldFkey: string;
141
+ }
142
+ export interface JsonDeleteReferenceStatement extends JsonReferenceStatement {
143
+ type: "delete_reference";
144
+ tableName: string;
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[];
@@ -0,0 +1,35 @@
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
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.19.13-e7108b7",
3
+ "version": "0.19.13-e99bac1",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",