drizzle-kit 0.20.14-6ce9d1f → 0.20.14-7965d91

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/bin.cjs +20593 -20020
  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.js +1 -0
  15. package/introspect-mysql.d.ts +1 -1
  16. package/introspect-pg.d.ts +5 -2
  17. package/introspect-sqlite.d.ts +1 -1
  18. package/jsonDiffer.d.ts +14 -29
  19. package/jsonStatements.d.ts +38 -11
  20. package/package.json +18 -50
  21. package/payload.js +8130 -8617
  22. package/payload.mjs +8252 -8745
  23. package/schemaValidator.d.ts +72 -69
  24. package/serializer/mysqlImports.d.ts +3 -7
  25. package/serializer/mysqlSchema.d.ts +1624 -493
  26. package/serializer/mysqlSerializer.d.ts +2 -2
  27. package/serializer/pgImports.d.ts +2 -2
  28. package/serializer/pgSchema.d.ts +1260 -801
  29. package/serializer/sqliteImports.d.ts +2 -4
  30. package/serializer/sqliteSchema.d.ts +144 -570
  31. package/serializer/sqliteSerializer.d.ts +1 -1
  32. package/snapshotsDiffer.d.ts +1908 -1050
  33. package/utils/words.d.ts +1 -1
  34. package/utils-studio.js +4144 -85
  35. package/utils-studio.mjs +4144 -85
  36. package/utils.d.ts +6 -140
  37. package/utils.js +3906 -7081
  38. package/utils.mjs +3983 -7158
  39. package/cli/commands/check.d.ts +0 -2
  40. package/cli/commands/drop.d.ts +0 -4
  41. package/cli/commands/mysqlUp.d.ts +0 -4
  42. package/cli/commands/pgUp.d.ts +0 -4
  43. package/cli/commands/push.d.ts +0 -6
  44. package/cli/commands/sqliteUp.d.ts +0 -2
  45. package/cli/commands/sqliteUtils.d.ts +0 -162
  46. package/cli/commands/upFolders.d.ts +0 -27
  47. package/cli/index.d.ts +0 -71
  48. package/cli/utils.d.ts +0 -12
  49. package/cli/validations/studio.d.ts +0 -593
  50. package/orm-extenstions/d1-driver/driver.d.ts +0 -8
  51. package/orm-extenstions/d1-driver/session.d.ts +0 -51
  52. package/orm-extenstions/d1-driver/wrangler-client.d.ts +0 -3
  53. package/serializer/studioUtils.d.ts +0 -65
  54. package/utils/certs.d.ts +0 -4
@@ -1,4 +1,5 @@
1
- import { CommonSchema, CommonSquashedSchema, Dialect } from "../../schemaValidator";
1
+ import { Column, ColumnsResolverInput, ColumnsResolverOutput, Enum, ResolverInput, ResolverOutput, ResolverOutputWithMoved, Table } from "../../snapshotsDiffer";
2
+ import { CommonSchema } from "../../schemaValidator";
2
3
  import { schema } from "../views";
3
4
  import { PgSchema } from "../../serializer/pgSchema";
4
5
  import { SQLiteSchema } from "../../serializer/sqliteSchema";
@@ -10,9 +11,77 @@ export type Named = {
10
11
  };
11
12
  export type NamedWithSchema = {
12
13
  name: string;
13
- schema?: string;
14
+ schema: string;
14
15
  };
16
+ export declare const schemasResolver: (input: ResolverInput<Table>) => Promise<ResolverOutput<Table>>;
17
+ export declare const tablesResolver: (input: ResolverInput<Table>) => Promise<ResolverOutputWithMoved<Table>>;
18
+ export declare const enumsResolver: (input: ResolverInput<Enum>) => Promise<ResolverOutputWithMoved<Enum>>;
19
+ export declare const columnsResolver: (input: ColumnsResolverInput<Column>) => Promise<ColumnsResolverOutput<Column>>;
15
20
  export declare const prepareAndMigratePg: (config: GenerateConfig) => Promise<void>;
21
+ export declare const preparePgPush: (config: {
22
+ schema: string | string[];
23
+ }, snapshot: PgSchema, schemaFilter: string[]) => Promise<{
24
+ sqlStatements: string[];
25
+ statements: import("../../jsonStatements").JsonStatement[];
26
+ squashedPrev: {
27
+ tables: Record<string, {
28
+ name: string;
29
+ columns: Record<string, {
30
+ isUnique?: any;
31
+ default?: any;
32
+ typeSchema?: string | undefined;
33
+ uniqueName?: string | undefined;
34
+ nullsNotDistinct?: boolean | undefined;
35
+ name: string;
36
+ type: string;
37
+ primaryKey: boolean;
38
+ notNull: boolean;
39
+ }>;
40
+ indexes: Record<string, string>;
41
+ foreignKeys: Record<string, string>;
42
+ schema: string;
43
+ compositePrimaryKeys: Record<string, string>;
44
+ uniqueConstraints: Record<string, string>;
45
+ }>;
46
+ version: "6";
47
+ dialect: "pg";
48
+ schemas: Record<string, string>;
49
+ enums: Record<string, {
50
+ name: string;
51
+ values: string[];
52
+ schema: string;
53
+ }>;
54
+ };
55
+ squashedCur: {
56
+ tables: Record<string, {
57
+ name: string;
58
+ columns: Record<string, {
59
+ isUnique?: any;
60
+ default?: any;
61
+ typeSchema?: string | undefined;
62
+ uniqueName?: string | undefined;
63
+ nullsNotDistinct?: boolean | undefined;
64
+ name: string;
65
+ type: string;
66
+ primaryKey: boolean;
67
+ notNull: boolean;
68
+ }>;
69
+ indexes: Record<string, string>;
70
+ foreignKeys: Record<string, string>;
71
+ schema: string;
72
+ compositePrimaryKeys: Record<string, string>;
73
+ uniqueConstraints: Record<string, string>;
74
+ }>;
75
+ version: "6";
76
+ dialect: "pg";
77
+ schemas: Record<string, string>;
78
+ enums: Record<string, {
79
+ name: string;
80
+ values: string[];
81
+ schema: string;
82
+ }>;
83
+ };
84
+ }>;
16
85
  export declare const prepareMySQLPush: (config: {
17
86
  schema: string | string[];
18
87
  }, snapshot: MySqlSchema) => Promise<{
@@ -26,12 +95,7 @@ export declare const prepareMySQLPush: (config: {
26
95
  } | undefined>;
27
96
  } | undefined>;
28
97
  } | undefined;
29
- id: string;
30
- prevId: string;
31
- version: "5";
32
- dialect: "mysql";
33
98
  tables: Record<string, {
34
- schema?: string | undefined;
35
99
  name: string;
36
100
  columns: Record<string, {
37
101
  default?: any;
@@ -68,11 +132,13 @@ export declare const prepareMySQLPush: (config: {
68
132
  columns: string[];
69
133
  }>;
70
134
  }>;
71
- schemas: Record<string, string>;
135
+ id: string;
136
+ prevId: string;
137
+ version: "6";
138
+ dialect: "mysql";
72
139
  _meta: {
73
140
  columns: Record<string, string>;
74
141
  tables: Record<string, string>;
75
- schemas: Record<string, string>;
76
142
  };
77
143
  };
78
144
  validatedPrev: {
@@ -83,12 +149,7 @@ export declare const prepareMySQLPush: (config: {
83
149
  } | undefined>;
84
150
  } | undefined>;
85
151
  } | undefined;
86
- id: string;
87
- prevId: string;
88
- version: "5";
89
- dialect: "mysql";
90
152
  tables: Record<string, {
91
- schema?: string | undefined;
92
153
  name: string;
93
154
  columns: Record<string, {
94
155
  default?: any;
@@ -125,14 +186,18 @@ export declare const prepareMySQLPush: (config: {
125
186
  columns: string[];
126
187
  }>;
127
188
  }>;
128
- schemas: Record<string, string>;
189
+ id: string;
190
+ prevId: string;
191
+ version: "6";
192
+ dialect: "mysql";
129
193
  _meta: {
130
194
  columns: Record<string, string>;
131
195
  tables: Record<string, string>;
132
- schemas: Record<string, string>;
133
196
  };
134
197
  };
135
198
  }>;
199
+ export declare const prepareAndMigrateMysql: (config: GenerateConfig) => Promise<void>;
200
+ export declare const prepareAndMigrateSqlite: (config: GenerateConfig) => Promise<void>;
136
201
  export declare const prepareSQLitePush: (config: {
137
202
  schema: string | string[];
138
203
  }, snapshot: SQLiteSchema) => Promise<{
@@ -140,8 +205,6 @@ export declare const prepareSQLitePush: (config: {
140
205
  statements: import("../../jsonStatements").JsonStatement[];
141
206
  squashedPrev: {
142
207
  enums?: any;
143
- version: "5";
144
- dialect: "sqlite";
145
208
  tables: Record<string, {
146
209
  name: string;
147
210
  columns: Record<string, {
@@ -157,11 +220,11 @@ export declare const prepareSQLitePush: (config: {
157
220
  compositePrimaryKeys: Record<string, string>;
158
221
  uniqueConstraints: Record<string, string>;
159
222
  }>;
223
+ version: "5";
224
+ dialect: "sqlite";
160
225
  };
161
226
  squashedCur: {
162
227
  enums?: any;
163
- version: "5";
164
- dialect: "sqlite";
165
228
  tables: Record<string, {
166
229
  name: string;
167
230
  columns: Record<string, {
@@ -177,6 +240,8 @@ export declare const prepareSQLitePush: (config: {
177
240
  compositePrimaryKeys: Record<string, string>;
178
241
  uniqueConstraints: Record<string, string>;
179
242
  }>;
243
+ version: "5";
244
+ dialect: "sqlite";
180
245
  };
181
246
  meta: {
182
247
  schemas: {};
@@ -184,85 +249,44 @@ export declare const prepareSQLitePush: (config: {
184
249
  columns: {};
185
250
  } | undefined;
186
251
  }>;
187
- export declare const preparePgPush: (config: {
188
- schema: string | string[];
189
- }, snapshot: PgSchema, schemaFilter: string[]) => Promise<{
190
- sqlStatements: string[];
191
- statements: import("../../jsonStatements").JsonStatement[];
192
- squashedPrev: {
193
- version: "5";
194
- dialect: "pg";
195
- tables: Record<string, {
196
- name: string;
197
- columns: Record<string, {
198
- isUnique?: any;
199
- default?: any;
200
- uniqueName?: string | undefined;
201
- nullsNotDistinct?: boolean | undefined;
202
- name: string;
203
- type: string;
204
- primaryKey: boolean;
205
- notNull: boolean;
206
- }>;
207
- indexes: Record<string, string>;
208
- foreignKeys: Record<string, string>;
209
- schema: string;
210
- compositePrimaryKeys: Record<string, string>;
211
- uniqueConstraints: Record<string, string>;
212
- }>;
213
- schemas: Record<string, string>;
214
- enums: Record<string, {
215
- name: string;
216
- values: Record<string, string>;
217
- }>;
218
- };
219
- squashedCur: {
220
- version: "5";
221
- dialect: "pg";
222
- tables: Record<string, {
223
- name: string;
224
- columns: Record<string, {
225
- isUnique?: any;
226
- default?: any;
227
- uniqueName?: string | undefined;
228
- nullsNotDistinct?: boolean | undefined;
229
- name: string;
230
- type: string;
231
- primaryKey: boolean;
232
- notNull: boolean;
233
- }>;
234
- indexes: Record<string, string>;
235
- foreignKeys: Record<string, string>;
236
- schema: string;
237
- compositePrimaryKeys: Record<string, string>;
238
- uniqueConstraints: Record<string, string>;
239
- }>;
240
- schemas: Record<string, string>;
241
- enums: Record<string, {
242
- name: string;
243
- values: Record<string, string>;
244
- }>;
245
- };
252
+ export declare const promptColumnsConflicts: <T extends Named>(tableName: string, newColumns: T[], missingColumns: T[]) => Promise<{
253
+ created: T[];
254
+ renamed: {
255
+ from: T;
256
+ to: T;
257
+ }[];
258
+ deleted: T[];
246
259
  }>;
247
- export declare const prepareAndMigrateMySql: (config: GenerateConfig) => Promise<void>;
248
- export declare const prepareAndMigrateSqlite: (config: GenerateConfig) => Promise<void>;
249
- export declare const prepareSQL: (prev: CommonSquashedSchema, cur: CommonSquashedSchema, dialect: Dialect, prevFull?: any, curFull?: any) => Promise<{
250
- statements: import("../../jsonStatements").JsonStatement[];
251
- sqlStatements: string[];
252
- _meta: {
253
- schemas: {};
254
- tables: {};
255
- columns: {};
256
- } | undefined;
260
+ export declare const promptNamedWithSchemasConflict: <T extends NamedWithSchema>(newItems: T[], missingItems: T[], entity: "table" | "enum") => Promise<{
261
+ created: T[];
262
+ renamed: {
263
+ from: T;
264
+ to: T;
265
+ }[];
266
+ moved: {
267
+ name: string;
268
+ schemaFrom: string;
269
+ schemaTo: string;
270
+ }[];
271
+ deleted: T[];
272
+ }>;
273
+ export declare const promptSchemasConflict: <T extends Named>(newSchemas: T[], missingSchemas: T[]) => Promise<{
274
+ created: T[];
275
+ renamed: {
276
+ from: T;
277
+ to: T;
278
+ }[];
279
+ deleted: T[];
257
280
  }>;
258
281
  export declare const BREAKPOINT = "--> statement-breakpoint\n";
259
- export declare const writeResult: ({ cur, sqlStatements, journal, _meta, outFolder, breakpoints, bundle, type, }: {
282
+ export declare const writeResult: ({ cur, sqlStatements, journal, _meta, outFolder, breakpoints, name, bundle, type, }: {
260
283
  cur: CommonSchema;
261
284
  sqlStatements: string[];
262
285
  journal: Journal;
263
286
  _meta?: any;
264
287
  outFolder: string;
265
288
  breakpoints: boolean;
289
+ name?: string | undefined;
266
290
  bundle?: boolean | undefined;
267
291
  type?: "none" | "custom" | "introspect" | undefined;
268
292
  }) => void;
@@ -6,12 +6,7 @@ export declare const connectToMySQL: (config: MySQLConnectionConfig) => Promise<
6
6
  }>;
7
7
  export declare const mysqlIntrospect: (config: MySQLConfigIntrospect, filters: string[]) => Promise<{
8
8
  schema: {
9
- id: string;
10
- prevId: string;
11
- version: "5";
12
- dialect: "mysql";
13
9
  tables: Record<string, {
14
- schema?: string | undefined;
15
10
  name: string;
16
11
  columns: Record<string, {
17
12
  default?: any;
@@ -48,11 +43,13 @@ export declare const mysqlIntrospect: (config: MySQLConfigIntrospect, filters: s
48
43
  columns: string[];
49
44
  }>;
50
45
  }>;
51
- schemas: Record<string, string>;
46
+ id: string;
47
+ prevId: string;
48
+ version: "6";
49
+ dialect: "mysql";
52
50
  _meta: {
53
51
  columns: Record<string, string>;
54
52
  tables: Record<string, string>;
55
- schemas: Record<string, string>;
56
53
  };
57
54
  };
58
55
  ts: {
@@ -67,12 +64,7 @@ export declare const mysqlPushIntrospect: (connection: {
67
64
  databaseName: string;
68
65
  }, filters: string[]) => Promise<{
69
66
  schema: {
70
- id: string;
71
- prevId: string;
72
- version: "5";
73
- dialect: "mysql";
74
67
  tables: Record<string, {
75
- schema?: string | undefined;
76
68
  name: string;
77
69
  columns: Record<string, {
78
70
  default?: any;
@@ -109,11 +101,13 @@ export declare const mysqlPushIntrospect: (connection: {
109
101
  columns: string[];
110
102
  }>;
111
103
  }>;
112
- schemas: Record<string, string>;
104
+ id: string;
105
+ prevId: string;
106
+ version: "6";
107
+ dialect: "mysql";
113
108
  _meta: {
114
109
  columns: Record<string, string>;
115
110
  tables: Record<string, string>;
116
- schemas: Record<string, string>;
117
111
  };
118
112
  };
119
113
  }>;
@@ -5,15 +5,12 @@ export declare const pgPushIntrospect: (connection: {
5
5
  client: DrizzleDbClient;
6
6
  }, filters: string[], schemaFilters: string[]) => Promise<{
7
7
  schema: {
8
- id: string;
9
- prevId: string;
10
- version: "5";
11
- dialect: "pg";
12
8
  tables: Record<string, {
13
9
  name: string;
14
10
  columns: Record<string, {
15
11
  isUnique?: any;
16
12
  default?: any;
13
+ typeSchema?: string | undefined;
17
14
  uniqueName?: string | undefined;
18
15
  nullsNotDistinct?: boolean | undefined;
19
16
  name: string;
@@ -47,6 +44,10 @@ export declare const pgPushIntrospect: (connection: {
47
44
  nullsNotDistinct: boolean;
48
45
  }>;
49
46
  }>;
47
+ id: string;
48
+ prevId: string;
49
+ version: "6";
50
+ dialect: "pg";
50
51
  schemas: Record<string, string>;
51
52
  _meta: {
52
53
  columns: Record<string, string>;
@@ -55,21 +56,19 @@ export declare const pgPushIntrospect: (connection: {
55
56
  };
56
57
  enums: Record<string, {
57
58
  name: string;
58
- values: Record<string, string>;
59
+ values: string[];
60
+ schema: string;
59
61
  }>;
60
62
  };
61
63
  }>;
62
64
  export declare const pgIntrospect: (config: PgConfigIntrospect, filters: string[], schemaFilters: string[]) => Promise<{
63
65
  schema: {
64
- id: string;
65
- prevId: string;
66
- version: "5";
67
- dialect: "pg";
68
66
  tables: Record<string, {
69
67
  name: string;
70
68
  columns: Record<string, {
71
69
  isUnique?: any;
72
70
  default?: any;
71
+ typeSchema?: string | undefined;
73
72
  uniqueName?: string | undefined;
74
73
  nullsNotDistinct?: boolean | undefined;
75
74
  name: string;
@@ -103,6 +102,10 @@ export declare const pgIntrospect: (config: PgConfigIntrospect, filters: string[
103
102
  nullsNotDistinct: boolean;
104
103
  }>;
105
104
  }>;
105
+ id: string;
106
+ prevId: string;
107
+ version: "6";
108
+ dialect: "pg";
106
109
  schemas: Record<string, string>;
107
110
  _meta: {
108
111
  columns: Record<string, string>;
@@ -111,7 +114,8 @@ export declare const pgIntrospect: (config: PgConfigIntrospect, filters: string[
111
114
  };
112
115
  enums: Record<string, {
113
116
  name: string;
114
- values: Record<string, string>;
117
+ values: string[];
118
+ schema: string;
115
119
  }>;
116
120
  };
117
121
  ts: {
@@ -120,4 +124,7 @@ export declare const pgIntrospect: (config: PgConfigIntrospect, filters: string[
120
124
  decalrations: string;
121
125
  schemaEntry: string;
122
126
  };
127
+ relationsTs: {
128
+ file: string;
129
+ };
123
130
  }>;
@@ -1,4 +1,4 @@
1
- import type { SQLiteCliConfig, SQLiteConnectionConfig } from "./sqliteUtils";
1
+ import type { SQLiteCliConfig, SQLiteConnectionConfig } from "../validations/sqlite";
2
2
  import type { DrizzleDbClient } from "../../drivers";
3
3
  export declare const connectToSQLite: (config: SQLiteConnectionConfig) => Promise<{
4
4
  client: import("../../drivers").BetterSqlite;
@@ -7,10 +7,6 @@ export declare const connectToSQLite: (config: SQLiteConnectionConfig) => Promis
7
7
  }>;
8
8
  export declare const sqliteIntrospect: (config: SQLiteCliConfig, filters: string[]) => Promise<{
9
9
  schema: {
10
- id: string;
11
- prevId: string;
12
- version: "5";
13
- dialect: "sqlite";
14
10
  tables: Record<string, {
15
11
  name: string;
16
12
  columns: Record<string, {
@@ -45,6 +41,10 @@ export declare const sqliteIntrospect: (config: SQLiteCliConfig, filters: string
45
41
  columns: string[];
46
42
  }>;
47
43
  }>;
44
+ id: string;
45
+ prevId: string;
46
+ version: "5";
47
+ dialect: "sqlite";
48
48
  _meta: {
49
49
  columns: Record<string, string>;
50
50
  tables: Record<string, string>;
@@ -60,10 +60,6 @@ export declare const sqliteIntrospect: (config: SQLiteCliConfig, filters: string
60
60
  }>;
61
61
  export declare const sqlitePushIntrospect: (client: DrizzleDbClient, filters: string[]) => Promise<{
62
62
  schema: {
63
- id: string;
64
- prevId: string;
65
- version: "5";
66
- dialect: "sqlite";
67
63
  tables: Record<string, {
68
64
  name: string;
69
65
  columns: Record<string, {
@@ -98,6 +94,10 @@ export declare const sqlitePushIntrospect: (client: DrizzleDbClient, filters: st
98
94
  columns: string[];
99
95
  }>;
100
96
  }>;
97
+ id: string;
98
+ prevId: string;
99
+ version: "5";
100
+ dialect: "sqlite";
101
101
  _meta: {
102
102
  columns: Record<string, string>;
103
103
  tables: Record<string, string>;