drizzle-kit 0.19.14-039355d → 0.20.0-5198fb7
Sign up to get free protection for your applications and to get access to all the features.
- package/@types/utils.d.ts +12 -0
- package/cli/commands/migrate.d.ts +260 -0
- package/cli/commands/mysqlUp.d.ts +4 -0
- package/cli/commands/pgIntrospect.d.ts +118 -0
- package/cli/commands/pgPushUtils.d.ts +14 -0
- package/cli/commands/pgUp.d.ts +4 -0
- package/cli/commands/sqliteIntrospect.d.ts +102 -0
- package/cli/commands/sqliteUtils.d.ts +162 -0
- package/cli/commands/upFolders.d.ts +27 -0
- package/cli/commands/utils.d.ts +265 -0
- package/cli/selector-ui.d.ts +13 -0
- package/cli/validations/common.d.ts +13 -0
- package/cli/validations/mysql.d.ts +414 -0
- package/cli/validations/outputs.d.ts +40 -0
- package/cli/validations/pg.d.ts +438 -0
- package/cli/validations/sqlite.d.ts +220 -0
- package/cli/validations/studio.d.ts +548 -0
- package/cli/views.d.ts +61 -0
- package/drivers/index.d.ts +25 -0
- package/global.d.ts +2 -0
- package/index.cjs +28813 -37075
- package/index.d.ts +47 -0
- package/introspect.d.ts +4 -0
- package/jsonDiffer.d.ts +76 -0
- package/jsonStatements.d.ts +349 -0
- package/migrationPreparator.d.ts +35 -0
- package/orm-extenstions/d1-driver/driver.d.ts +8 -0
- package/orm-extenstions/d1-driver/session.d.ts +52 -0
- package/orm-extenstions/d1-driver/wrangler-client.d.ts +3 -0
- package/package.json +4 -3
- package/schemaValidator.d.ts +1306 -0
- package/serializer/index.d.ts +9 -0
- package/serializer/mysqlImports.d.ts +6 -0
- package/serializer/mysqlSchema.d.ts +3833 -0
- package/serializer/mysqlSerializer.d.ts +7 -0
- package/serializer/pgImports.d.ts +11 -0
- package/serializer/pgSchema.d.ts +4244 -0
- package/serializer/pgSerializer.d.ts +7 -0
- package/serializer/sqliteImports.d.ts +5 -0
- package/serializer/sqliteSchema.d.ts +3227 -0
- package/serializer/sqliteSerializer.d.ts +8 -0
- package/serializer/studioUtils.d.ts +35 -0
- package/snapshotsDiffer.d.ts +2660 -0
- package/sqlgenerator.d.ts +33 -0
- package/sqlite-introspect.d.ts +5 -0
- package/utils/words.d.ts +7 -0
- package/utils.d.ts +33 -0
- package/utils.js +51597 -11732
- package/utilsR.d.ts +232 -0
package/index.d.ts
CHANGED
@@ -1,3 +1,49 @@
|
|
1
|
+
export type DbConnection = {
|
2
|
+
driver: "turso";
|
3
|
+
dbCredentials: {
|
4
|
+
url: string;
|
5
|
+
authToken?: string;
|
6
|
+
};
|
7
|
+
} | {
|
8
|
+
driver: "better-sqlite";
|
9
|
+
dbCredentials: {
|
10
|
+
url: string;
|
11
|
+
};
|
12
|
+
} | {
|
13
|
+
driver: "libsql";
|
14
|
+
dbCredentials: {
|
15
|
+
url: string;
|
16
|
+
};
|
17
|
+
} | {
|
18
|
+
driver: "d1";
|
19
|
+
dbCredentials: {
|
20
|
+
wranglerConfigPath: string;
|
21
|
+
dbName: string;
|
22
|
+
};
|
23
|
+
} | {
|
24
|
+
driver: "pg";
|
25
|
+
dbCredentials: {
|
26
|
+
host: string;
|
27
|
+
port?: number;
|
28
|
+
user?: string;
|
29
|
+
password?: string;
|
30
|
+
database: string;
|
31
|
+
ssl?: boolean;
|
32
|
+
} | {
|
33
|
+
connectionString: string;
|
34
|
+
};
|
35
|
+
} | {
|
36
|
+
driver: "mysql2";
|
37
|
+
dbCredentials: {
|
38
|
+
host: string;
|
39
|
+
port?: number;
|
40
|
+
user?: string;
|
41
|
+
password?: string;
|
42
|
+
database: string;
|
43
|
+
} | {
|
44
|
+
connectionString: string;
|
45
|
+
};
|
46
|
+
};
|
1
47
|
export type Config = {
|
2
48
|
out?: string | undefined;
|
3
49
|
breakpoints?: boolean | undefined;
|
@@ -55,3 +101,4 @@ export type Config = {
|
|
55
101
|
wranglerConfigPath: string;
|
56
102
|
};
|
57
103
|
} | {});
|
104
|
+
export declare function defineConfig(config: Config): Config;
|
package/introspect.d.ts
ADDED
package/jsonDiffer.d.ts
ADDED
@@ -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
|
+
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[];
|
@@ -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
|
+
}>;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { type DrizzleConfig, QueryWithTypings, SQL } from "drizzle-orm";
|
2
|
+
import { BaseSQLiteDatabase, SQLiteAsyncDialect } from "drizzle-orm/sqlite-core";
|
3
|
+
import { D1WranglerResults } from "./session";
|
4
|
+
export type DrizzleD1WranglerDatabase<TSchema extends Record<string, unknown> = Record<string, never>> = BaseSQLiteDatabase<"async", D1WranglerResults, TSchema>;
|
5
|
+
export declare class WranglerDialect extends SQLiteAsyncDialect {
|
6
|
+
sqlToQuery(sql: SQL): QueryWithTypings;
|
7
|
+
}
|
8
|
+
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(client: (query: string, configPath: string, dbName: string) => Promise<any>, configPath: string, dbName: string, config?: DrizzleConfig<TSchema>): DrizzleD1WranglerDatabase<TSchema>;
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import { entityKind } from "drizzle-orm";
|
2
|
+
import type { Logger } from "drizzle-orm";
|
3
|
+
import { type RelationalSchemaConfig, type TablesRelationalConfig } from "drizzle-orm";
|
4
|
+
import { type Query } from "drizzle-orm";
|
5
|
+
import type { SQLiteAsyncDialect, SQLiteExecuteMethod } from "drizzle-orm/sqlite-core";
|
6
|
+
import type { SelectedFieldsOrdered } from "drizzle-orm/sqlite-core";
|
7
|
+
import { type PreparedQueryConfig as PreparedQueryConfigBase, type SQLiteTransactionConfig } from "drizzle-orm/sqlite-core";
|
8
|
+
import { PreparedQuery as PreparedQueryBase, SQLiteSession } from "drizzle-orm/sqlite-core";
|
9
|
+
export interface SQLiteD1SessionOptions {
|
10
|
+
logger?: Logger;
|
11
|
+
}
|
12
|
+
type PreparedQueryConfig = Omit<PreparedQueryConfigBase, "statement" | "run">;
|
13
|
+
export type D1WranglerResults<T = unknown> = {
|
14
|
+
results?: T[];
|
15
|
+
};
|
16
|
+
export declare class SQLiteWranglerD1Session<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends SQLiteSession<"async", D1WranglerResults, TFullSchema, TSchema> {
|
17
|
+
private client;
|
18
|
+
private configPath;
|
19
|
+
private dbName;
|
20
|
+
private schema;
|
21
|
+
private options;
|
22
|
+
static readonly [entityKind]: string;
|
23
|
+
private logger;
|
24
|
+
constructor(client: (query: string, configPath: string, dbName: string) => Promise<any>, configPath: string, dbName: string, dialect: SQLiteAsyncDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options?: SQLiteD1SessionOptions);
|
25
|
+
prepareQuery(query: Query, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, customResultMapper?: (rows: unknown[][]) => unknown): PreparedQuery;
|
26
|
+
transaction<T>(transaction: (tx: any) => T | Promise<T>, config?: SQLiteTransactionConfig): Promise<T>;
|
27
|
+
}
|
28
|
+
export declare class PreparedQuery<T extends PreparedQueryConfig = PreparedQueryConfig> extends PreparedQueryBase<{
|
29
|
+
type: "async";
|
30
|
+
run: D1WranglerResults;
|
31
|
+
all: T["all"];
|
32
|
+
get: T["get"];
|
33
|
+
values: T["values"];
|
34
|
+
execute: T["execute"];
|
35
|
+
}> {
|
36
|
+
private stmt;
|
37
|
+
private configPath;
|
38
|
+
private dbName;
|
39
|
+
private queryString;
|
40
|
+
private params;
|
41
|
+
private logger;
|
42
|
+
private fields;
|
43
|
+
private customResultMapper?;
|
44
|
+
static readonly [entityKind]: string;
|
45
|
+
constructor(stmt: (query: string, configPath: string, dbName: string) => Promise<any>, configPath: string, dbName: string, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, customResultMapper?: ((rows: unknown[][]) => unknown) | undefined);
|
46
|
+
run(placeholderValues?: Record<string, unknown>): Promise<D1WranglerResults>;
|
47
|
+
all(placeholderValues?: Record<string, unknown>): Promise<T["all"]>;
|
48
|
+
get(placeholderValues?: Record<string, unknown>): Promise<T["get"]>;
|
49
|
+
private d1ToRawMapping;
|
50
|
+
values(placeholderValues?: Record<string, unknown>): Promise<unknown[][]>;
|
51
|
+
}
|
52
|
+
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "drizzle-kit",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.20.0-5198fb7",
|
4
4
|
"repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
|
5
5
|
"author": "Drizzle Team",
|
6
6
|
"license": "MIT",
|
@@ -9,6 +9,7 @@
|
|
9
9
|
},
|
10
10
|
"scripts": {
|
11
11
|
"test:pg:push": "drizzle-kit push:pg",
|
12
|
+
"payload": "tsx ./dev/payload.ts",
|
12
13
|
"migrate:old": "drizzle-kit generate:pg --out ./dev/migrations-pg --schema ./dev/migrations-pg/schema.ts",
|
13
14
|
"push": "node -r esbuild-register ./src/cli/index.ts push:mysql",
|
14
15
|
"push:sqlite": "node -r ./src/loader.mjs ./src/cli/index.ts push:sqlite",
|
@@ -36,7 +37,7 @@
|
|
36
37
|
"test": "ava test --timeout=60s",
|
37
38
|
"build": "rm -rf ./dist && tsx build.ts && tsc -p tsconfig.cli-types.json",
|
38
39
|
"build:dev": "rm -rf ./dist && tsx build.dev.ts && tsc -p tsconfig.cli-types.json && chmod +x ./dist/index.cjs",
|
39
|
-
"
|
40
|
+
"packit": "pnpm build && cp package.json dist/ && cd dist && pnpm pack",
|
40
41
|
"tsc": "tsc -p tsconfig.build.json",
|
41
42
|
"pub": "cp package.json readme.md dist/ && cd dist && npm publish",
|
42
43
|
"studio": "./dist/index.cjs studio --verbose"
|
@@ -82,7 +83,7 @@
|
|
82
83
|
"better-sqlite3": "^8.4.0",
|
83
84
|
"dockerode": "^3.3.4",
|
84
85
|
"dotenv": "^16.0.3",
|
85
|
-
"drizzle-orm": "0.28.
|
86
|
+
"drizzle-orm": "0.28.7-4e094f0",
|
86
87
|
"eslint": "^8.29.0",
|
87
88
|
"eslint-config-prettier": "^8.5.0",
|
88
89
|
"eslint-plugin-prettier": "^4.2.1",
|