drizzle-kit 0.20.17-4e262b7 → 0.20.17-7776aba
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin.cjs +22248 -23435
- package/cli/commands/migrate.d.ts +135 -152
- package/cli/commands/mysqlIntrospect.d.ts +79 -15
- package/cli/commands/mysqlPushUtils.d.ts +8 -4
- package/cli/commands/mysqlUp.d.ts +4 -0
- package/cli/commands/pgConnect.d.ts +5 -0
- package/cli/commands/pgIntrospect.d.ts +76 -12
- package/cli/commands/pgPushUtils.d.ts +6 -3
- package/cli/commands/pgUp.d.ts +4 -0
- package/cli/commands/sqliteIntrospect.d.ts +29 -26
- package/cli/commands/sqlitePushUtils.d.ts +10 -4
- package/cli/commands/sqliteUtils.d.ts +162 -0
- package/cli/commands/upFolders.d.ts +27 -0
- package/cli/commands/utils.d.ts +255 -39
- package/cli/validations/common.d.ts +7 -208
- package/cli/validations/mysql.d.ts +337 -7
- package/cli/validations/outputs.d.ts +0 -1
- package/cli/validations/pg.d.ts +405 -4
- package/cli/views.d.ts +5 -7
- package/drivers/index.d.ts +39 -0
- package/global.d.ts +1 -3
- package/index.d.mts +6 -8
- package/index.d.ts +6 -8
- package/index.js +0 -1
- package/introspect-mysql.d.ts +9 -0
- package/introspect-pg.d.ts +12 -0
- package/introspect-sqlite.d.ts +2 -2
- package/jsonDiffer.d.ts +29 -14
- package/jsonStatements.d.ts +11 -38
- package/package.json +52 -24
- package/payload.d.mts +5 -5
- package/payload.d.ts +5 -5
- package/payload.js +24222 -26044
- package/payload.mjs +19956 -21767
- package/schemaValidator.d.ts +286 -289
- package/serializer/mysqlImports.d.ts +7 -3
- package/serializer/mysqlSchema.d.ts +1323 -2454
- package/serializer/mysqlSerializer.d.ts +6 -6
- package/serializer/pgImports.d.ts +2 -2
- package/serializer/pgSchema.d.ts +1283 -1742
- package/serializer/pgSerializer.d.ts +2 -2
- package/serializer/sqliteImports.d.ts +4 -2
- package/serializer/sqliteSchema.d.ts +979 -553
- package/serializer/sqliteSerializer.d.ts +4 -4
- package/snapshotsDiffer.d.ts +1209 -2486
- package/utils/words.d.ts +1 -1
- package/utils-studio.d.mts +1 -0
- package/utils-studio.d.ts +1 -0
- package/utils-studio.js +849 -7058
- package/utils-studio.mjs +829 -7035
- package/utils.d.ts +141 -14
- package/utils.js +7161 -4625
- package/utils.mjs +7121 -4585
- package/cli/utils.d.ts +0 -12
- package/cli/validations/cli.d.ts +0 -169
- package/cli/validations/sqlite.d.ts +0 -34
|
@@ -1,115 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { PgSchema } from "
|
|
4
|
-
import { SQLiteSchema } from "
|
|
5
|
-
import { MySqlSchema } from "
|
|
6
|
-
import { Journal } from "
|
|
1
|
+
import { CommonSchema, CommonSquashedSchema, Dialect } from "../../schemaValidator";
|
|
2
|
+
import { schema } from "../views";
|
|
3
|
+
import { PgSchema } from "src/serializer/pgSchema";
|
|
4
|
+
import { SQLiteSchema } from "src/serializer/sqliteSchema";
|
|
5
|
+
import { MySqlSchema } from "src/serializer/mysqlSchema";
|
|
6
|
+
import { Journal } from "src/utils";
|
|
7
7
|
import { GenerateConfig } from "./utils";
|
|
8
8
|
export type Named = {
|
|
9
9
|
name: string;
|
|
10
10
|
};
|
|
11
11
|
export type NamedWithSchema = {
|
|
12
12
|
name: string;
|
|
13
|
-
schema
|
|
13
|
+
schema?: string;
|
|
14
14
|
};
|
|
15
|
-
export declare const schemasResolver: (input: ResolverInput<Table>) => Promise<ResolverOutput<Table>>;
|
|
16
|
-
export declare const tablesResolver: (input: ResolverInput<Table>) => Promise<ResolverOutputWithMoved<Table>>;
|
|
17
|
-
export declare const enumsResolver: (input: ResolverInput<Enum>) => Promise<ResolverOutputWithMoved<Enum>>;
|
|
18
|
-
export declare const columnsResolver: (input: ColumnsResolverInput<Column>) => Promise<ColumnsResolverOutput<Column>>;
|
|
19
15
|
export declare const prepareAndMigratePg: (config: GenerateConfig) => Promise<void>;
|
|
20
|
-
export declare const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
squashedPrev: {
|
|
24
|
-
tables: Record<string, {
|
|
25
|
-
name: string;
|
|
26
|
-
columns: Record<string, {
|
|
27
|
-
name: string;
|
|
28
|
-
type: string;
|
|
29
|
-
primaryKey: boolean;
|
|
30
|
-
notNull: boolean;
|
|
31
|
-
isUnique?: any;
|
|
32
|
-
default?: any;
|
|
33
|
-
typeSchema?: string | undefined;
|
|
34
|
-
uniqueName?: string | undefined;
|
|
35
|
-
nullsNotDistinct?: boolean | undefined;
|
|
36
|
-
}>;
|
|
37
|
-
indexes: Record<string, string>;
|
|
38
|
-
foreignKeys: Record<string, string>;
|
|
39
|
-
schema: string;
|
|
40
|
-
compositePrimaryKeys: Record<string, string>;
|
|
41
|
-
uniqueConstraints: Record<string, string>;
|
|
42
|
-
}>;
|
|
43
|
-
version: "6";
|
|
44
|
-
dialect: "pg";
|
|
45
|
-
schemas: Record<string, string>;
|
|
46
|
-
enums: Record<string, {
|
|
47
|
-
name: string;
|
|
48
|
-
values: string[];
|
|
49
|
-
schema: string;
|
|
50
|
-
}>;
|
|
51
|
-
};
|
|
52
|
-
squashedCur: {
|
|
53
|
-
tables: Record<string, {
|
|
54
|
-
name: string;
|
|
55
|
-
columns: Record<string, {
|
|
56
|
-
name: string;
|
|
57
|
-
type: string;
|
|
58
|
-
primaryKey: boolean;
|
|
59
|
-
notNull: boolean;
|
|
60
|
-
isUnique?: any;
|
|
61
|
-
default?: any;
|
|
62
|
-
typeSchema?: string | undefined;
|
|
63
|
-
uniqueName?: string | undefined;
|
|
64
|
-
nullsNotDistinct?: boolean | undefined;
|
|
65
|
-
}>;
|
|
66
|
-
indexes: Record<string, string>;
|
|
67
|
-
foreignKeys: Record<string, string>;
|
|
68
|
-
schema: string;
|
|
69
|
-
compositePrimaryKeys: Record<string, string>;
|
|
70
|
-
uniqueConstraints: Record<string, string>;
|
|
71
|
-
}>;
|
|
72
|
-
version: "6";
|
|
73
|
-
dialect: "pg";
|
|
74
|
-
schemas: Record<string, string>;
|
|
75
|
-
enums: Record<string, {
|
|
76
|
-
name: string;
|
|
77
|
-
values: string[];
|
|
78
|
-
schema: string;
|
|
79
|
-
}>;
|
|
80
|
-
};
|
|
81
|
-
}>;
|
|
82
|
-
export declare const prepareMySQLPush: (schemaPath: string | string[], snapshot: MySqlSchema) => Promise<{
|
|
16
|
+
export declare const prepareMySQLPush: (config: {
|
|
17
|
+
schema: string | string[];
|
|
18
|
+
}, snapshot: MySqlSchema) => Promise<{
|
|
83
19
|
sqlStatements: string[];
|
|
84
20
|
statements: import("../../jsonStatements").JsonStatement[];
|
|
85
21
|
validatedCur: {
|
|
22
|
+
internal?: {
|
|
23
|
+
tables: Record<string, {
|
|
24
|
+
columns: Record<string, {
|
|
25
|
+
isDefaultAnExpression?: boolean | undefined;
|
|
26
|
+
} | undefined>;
|
|
27
|
+
} | undefined>;
|
|
28
|
+
} | undefined;
|
|
29
|
+
id: string;
|
|
30
|
+
prevId: string;
|
|
31
|
+
version: "5";
|
|
32
|
+
dialect: "mysql";
|
|
86
33
|
tables: Record<string, {
|
|
34
|
+
schema?: string | undefined;
|
|
87
35
|
name: string;
|
|
88
36
|
columns: Record<string, {
|
|
37
|
+
default?: any;
|
|
38
|
+
onUpdate?: any;
|
|
39
|
+
autoincrement?: boolean | undefined;
|
|
89
40
|
name: string;
|
|
90
41
|
type: string;
|
|
91
42
|
primaryKey: boolean;
|
|
92
43
|
notNull: boolean;
|
|
93
|
-
default?: any;
|
|
94
|
-
onUpdate?: any;
|
|
95
|
-
autoincrement?: boolean | undefined;
|
|
96
44
|
}>;
|
|
97
45
|
indexes: Record<string, {
|
|
98
|
-
name: string;
|
|
99
|
-
columns: string[];
|
|
100
|
-
isUnique: boolean;
|
|
101
46
|
using?: "btree" | "hash" | undefined;
|
|
102
47
|
algorithm?: "default" | "inplace" | "copy" | undefined;
|
|
103
48
|
lock?: "default" | "none" | "shared" | "exclusive" | undefined;
|
|
49
|
+
name: string;
|
|
50
|
+
columns: string[];
|
|
51
|
+
isUnique: boolean;
|
|
104
52
|
}>;
|
|
105
53
|
foreignKeys: Record<string, {
|
|
54
|
+
onUpdate?: string | undefined;
|
|
55
|
+
onDelete?: string | undefined;
|
|
106
56
|
name: string;
|
|
107
57
|
tableFrom: string;
|
|
108
58
|
columnsFrom: string[];
|
|
109
59
|
tableTo: string;
|
|
110
60
|
columnsTo: string[];
|
|
111
|
-
onUpdate?: string | undefined;
|
|
112
|
-
onDelete?: string | undefined;
|
|
113
61
|
}>;
|
|
114
62
|
compositePrimaryKeys: Record<string, {
|
|
115
63
|
name: string;
|
|
@@ -120,14 +68,14 @@ export declare const prepareMySQLPush: (schemaPath: string | string[], snapshot:
|
|
|
120
68
|
columns: string[];
|
|
121
69
|
}>;
|
|
122
70
|
}>;
|
|
123
|
-
|
|
124
|
-
prevId: string;
|
|
125
|
-
version: "6";
|
|
126
|
-
dialect: "mysql";
|
|
71
|
+
schemas: Record<string, string>;
|
|
127
72
|
_meta: {
|
|
128
73
|
columns: Record<string, string>;
|
|
129
74
|
tables: Record<string, string>;
|
|
75
|
+
schemas: Record<string, string>;
|
|
130
76
|
};
|
|
77
|
+
};
|
|
78
|
+
validatedPrev: {
|
|
131
79
|
internal?: {
|
|
132
80
|
tables: Record<string, {
|
|
133
81
|
columns: Record<string, {
|
|
@@ -135,35 +83,38 @@ export declare const prepareMySQLPush: (schemaPath: string | string[], snapshot:
|
|
|
135
83
|
} | undefined>;
|
|
136
84
|
} | undefined>;
|
|
137
85
|
} | undefined;
|
|
138
|
-
|
|
139
|
-
|
|
86
|
+
id: string;
|
|
87
|
+
prevId: string;
|
|
88
|
+
version: "5";
|
|
89
|
+
dialect: "mysql";
|
|
140
90
|
tables: Record<string, {
|
|
91
|
+
schema?: string | undefined;
|
|
141
92
|
name: string;
|
|
142
93
|
columns: Record<string, {
|
|
94
|
+
default?: any;
|
|
95
|
+
onUpdate?: any;
|
|
96
|
+
autoincrement?: boolean | undefined;
|
|
143
97
|
name: string;
|
|
144
98
|
type: string;
|
|
145
99
|
primaryKey: boolean;
|
|
146
100
|
notNull: boolean;
|
|
147
|
-
default?: any;
|
|
148
|
-
onUpdate?: any;
|
|
149
|
-
autoincrement?: boolean | undefined;
|
|
150
101
|
}>;
|
|
151
102
|
indexes: Record<string, {
|
|
152
|
-
name: string;
|
|
153
|
-
columns: string[];
|
|
154
|
-
isUnique: boolean;
|
|
155
103
|
using?: "btree" | "hash" | undefined;
|
|
156
104
|
algorithm?: "default" | "inplace" | "copy" | undefined;
|
|
157
105
|
lock?: "default" | "none" | "shared" | "exclusive" | undefined;
|
|
106
|
+
name: string;
|
|
107
|
+
columns: string[];
|
|
108
|
+
isUnique: boolean;
|
|
158
109
|
}>;
|
|
159
110
|
foreignKeys: Record<string, {
|
|
111
|
+
onUpdate?: string | undefined;
|
|
112
|
+
onDelete?: string | undefined;
|
|
160
113
|
name: string;
|
|
161
114
|
tableFrom: string;
|
|
162
115
|
columnsFrom: string[];
|
|
163
116
|
tableTo: string;
|
|
164
117
|
columnsTo: string[];
|
|
165
|
-
onUpdate?: string | undefined;
|
|
166
|
-
onDelete?: string | undefined;
|
|
167
118
|
}>;
|
|
168
119
|
compositePrimaryKeys: Record<string, {
|
|
169
120
|
name: string;
|
|
@@ -174,114 +125,146 @@ export declare const prepareMySQLPush: (schemaPath: string | string[], snapshot:
|
|
|
174
125
|
columns: string[];
|
|
175
126
|
}>;
|
|
176
127
|
}>;
|
|
177
|
-
|
|
178
|
-
prevId: string;
|
|
179
|
-
version: "6";
|
|
180
|
-
dialect: "mysql";
|
|
128
|
+
schemas: Record<string, string>;
|
|
181
129
|
_meta: {
|
|
182
130
|
columns: Record<string, string>;
|
|
183
131
|
tables: Record<string, string>;
|
|
132
|
+
schemas: Record<string, string>;
|
|
184
133
|
};
|
|
185
|
-
internal?: {
|
|
186
|
-
tables: Record<string, {
|
|
187
|
-
columns: Record<string, {
|
|
188
|
-
isDefaultAnExpression?: boolean | undefined;
|
|
189
|
-
} | undefined>;
|
|
190
|
-
} | undefined>;
|
|
191
|
-
} | undefined;
|
|
192
134
|
};
|
|
193
|
-
}>;
|
|
194
|
-
export declare const
|
|
195
|
-
|
|
196
|
-
|
|
135
|
+
} | undefined>;
|
|
136
|
+
export declare const prepareSQLitePush: (config: {
|
|
137
|
+
schema: string | string[];
|
|
138
|
+
}, snapshot: SQLiteSchema) => Promise<{
|
|
197
139
|
sqlStatements: string[];
|
|
198
140
|
statements: import("../../jsonStatements").JsonStatement[];
|
|
199
141
|
squashedPrev: {
|
|
142
|
+
enums?: any;
|
|
143
|
+
version: "5";
|
|
144
|
+
dialect: "sqlite";
|
|
200
145
|
tables: Record<string, {
|
|
201
146
|
name: string;
|
|
202
147
|
columns: Record<string, {
|
|
148
|
+
default?: any;
|
|
149
|
+
autoincrement?: boolean | undefined;
|
|
203
150
|
name: string;
|
|
204
151
|
type: string;
|
|
205
152
|
primaryKey: boolean;
|
|
206
153
|
notNull: boolean;
|
|
154
|
+
}>;
|
|
155
|
+
indexes: Record<string, string>;
|
|
156
|
+
foreignKeys: Record<string, string>;
|
|
157
|
+
compositePrimaryKeys: Record<string, string>;
|
|
158
|
+
uniqueConstraints: Record<string, string>;
|
|
159
|
+
}>;
|
|
160
|
+
};
|
|
161
|
+
squashedCur: {
|
|
162
|
+
enums?: any;
|
|
163
|
+
version: "5";
|
|
164
|
+
dialect: "sqlite";
|
|
165
|
+
tables: Record<string, {
|
|
166
|
+
name: string;
|
|
167
|
+
columns: Record<string, {
|
|
207
168
|
default?: any;
|
|
208
169
|
autoincrement?: boolean | undefined;
|
|
170
|
+
name: string;
|
|
171
|
+
type: string;
|
|
172
|
+
primaryKey: boolean;
|
|
173
|
+
notNull: boolean;
|
|
209
174
|
}>;
|
|
210
175
|
indexes: Record<string, string>;
|
|
211
176
|
foreignKeys: Record<string, string>;
|
|
212
177
|
compositePrimaryKeys: Record<string, string>;
|
|
213
178
|
uniqueConstraints: Record<string, string>;
|
|
214
179
|
}>;
|
|
180
|
+
};
|
|
181
|
+
meta: {
|
|
182
|
+
schemas: {};
|
|
183
|
+
tables: {};
|
|
184
|
+
columns: {};
|
|
185
|
+
} | undefined;
|
|
186
|
+
} | undefined>;
|
|
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: {
|
|
215
193
|
version: "5";
|
|
216
|
-
dialect: "
|
|
217
|
-
|
|
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
218
|
};
|
|
219
219
|
squashedCur: {
|
|
220
|
+
version: "5";
|
|
221
|
+
dialect: "pg";
|
|
220
222
|
tables: Record<string, {
|
|
221
223
|
name: string;
|
|
222
224
|
columns: Record<string, {
|
|
225
|
+
isUnique?: any;
|
|
226
|
+
default?: any;
|
|
227
|
+
uniqueName?: string | undefined;
|
|
228
|
+
nullsNotDistinct?: boolean | undefined;
|
|
223
229
|
name: string;
|
|
224
230
|
type: string;
|
|
225
231
|
primaryKey: boolean;
|
|
226
232
|
notNull: boolean;
|
|
227
|
-
default?: any;
|
|
228
|
-
autoincrement?: boolean | undefined;
|
|
229
233
|
}>;
|
|
230
234
|
indexes: Record<string, string>;
|
|
231
235
|
foreignKeys: Record<string, string>;
|
|
236
|
+
schema: string;
|
|
232
237
|
compositePrimaryKeys: Record<string, string>;
|
|
233
238
|
uniqueConstraints: Record<string, string>;
|
|
234
239
|
}>;
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
240
|
+
schemas: Record<string, string>;
|
|
241
|
+
enums: Record<string, {
|
|
242
|
+
name: string;
|
|
243
|
+
values: Record<string, string>;
|
|
244
|
+
}>;
|
|
238
245
|
};
|
|
239
|
-
|
|
246
|
+
} | undefined>;
|
|
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: {
|
|
240
253
|
schemas: {};
|
|
241
254
|
tables: {};
|
|
242
255
|
columns: {};
|
|
243
256
|
} | undefined;
|
|
244
257
|
}>;
|
|
245
|
-
export declare const promptColumnsConflicts: <T extends Named>(tableName: string, newColumns: T[], missingColumns: T[]) => Promise<{
|
|
246
|
-
created: T[];
|
|
247
|
-
renamed: {
|
|
248
|
-
from: T;
|
|
249
|
-
to: T;
|
|
250
|
-
}[];
|
|
251
|
-
deleted: T[];
|
|
252
|
-
}>;
|
|
253
|
-
export declare const promptNamedWithSchemasConflict: <T extends NamedWithSchema>(newItems: T[], missingItems: T[], entity: "table" | "enum") => Promise<{
|
|
254
|
-
created: T[];
|
|
255
|
-
renamed: {
|
|
256
|
-
from: T;
|
|
257
|
-
to: T;
|
|
258
|
-
}[];
|
|
259
|
-
moved: {
|
|
260
|
-
name: string;
|
|
261
|
-
schemaFrom: string;
|
|
262
|
-
schemaTo: string;
|
|
263
|
-
}[];
|
|
264
|
-
deleted: T[];
|
|
265
|
-
}>;
|
|
266
|
-
export declare const promptSchemasConflict: <T extends Named>(newSchemas: T[], missingSchemas: T[]) => Promise<{
|
|
267
|
-
created: T[];
|
|
268
|
-
renamed: {
|
|
269
|
-
from: T;
|
|
270
|
-
to: T;
|
|
271
|
-
}[];
|
|
272
|
-
deleted: T[];
|
|
273
|
-
}>;
|
|
274
258
|
export declare const BREAKPOINT = "--> statement-breakpoint\n";
|
|
275
|
-
export declare const writeResult: ({ cur, sqlStatements, journal, _meta, outFolder, breakpoints,
|
|
259
|
+
export declare const writeResult: ({ cur, sqlStatements, journal, _meta, outFolder, breakpoints, bundle, type, }: {
|
|
276
260
|
cur: CommonSchema;
|
|
277
261
|
sqlStatements: string[];
|
|
278
262
|
journal: Journal;
|
|
279
263
|
_meta?: any;
|
|
280
264
|
outFolder: string;
|
|
281
265
|
breakpoints: boolean;
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
type?: "introspect" | "custom" | "none";
|
|
266
|
+
bundle?: boolean | undefined;
|
|
267
|
+
type?: "none" | "custom" | "introspect" | undefined;
|
|
285
268
|
}) => void;
|
|
286
269
|
export declare const embeddedMigrations: (journal: Journal) => string;
|
|
287
270
|
export declare const prepareSnapshotFolderName: () => string;
|
|
@@ -1,38 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
export declare const connectToMySQL: (
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { MySQLConfigIntrospect, MySQLConnectionConfig } from "../validations/mysql";
|
|
2
|
+
import { DrizzleDbClient, MySQL2Client } from "src/drivers";
|
|
3
|
+
export declare const connectToMySQL: (config: MySQLConnectionConfig) => Promise<{
|
|
4
|
+
client: MySQL2Client;
|
|
5
|
+
databaseName: string;
|
|
6
6
|
}>;
|
|
7
|
-
export declare const
|
|
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";
|
|
9
13
|
tables: Record<string, {
|
|
14
|
+
schema?: string | undefined;
|
|
10
15
|
name: string;
|
|
11
16
|
columns: Record<string, {
|
|
17
|
+
default?: any;
|
|
18
|
+
onUpdate?: any;
|
|
19
|
+
autoincrement?: boolean | undefined;
|
|
12
20
|
name: string;
|
|
13
21
|
type: string;
|
|
14
22
|
primaryKey: boolean;
|
|
15
23
|
notNull: boolean;
|
|
16
|
-
default?: any;
|
|
17
|
-
onUpdate?: any;
|
|
18
|
-
autoincrement?: boolean | undefined;
|
|
19
24
|
}>;
|
|
20
25
|
indexes: Record<string, {
|
|
21
|
-
name: string;
|
|
22
|
-
columns: string[];
|
|
23
|
-
isUnique: boolean;
|
|
24
26
|
using?: "btree" | "hash" | undefined;
|
|
25
27
|
algorithm?: "default" | "inplace" | "copy" | undefined;
|
|
26
28
|
lock?: "default" | "none" | "shared" | "exclusive" | undefined;
|
|
29
|
+
name: string;
|
|
30
|
+
columns: string[];
|
|
31
|
+
isUnique: boolean;
|
|
27
32
|
}>;
|
|
28
33
|
foreignKeys: Record<string, {
|
|
34
|
+
onUpdate?: string | undefined;
|
|
35
|
+
onDelete?: string | undefined;
|
|
29
36
|
name: string;
|
|
30
37
|
tableFrom: string;
|
|
31
38
|
columnsFrom: string[];
|
|
32
39
|
tableTo: string;
|
|
33
40
|
columnsTo: string[];
|
|
34
|
-
onUpdate?: string | undefined;
|
|
35
|
-
onDelete?: string | undefined;
|
|
36
41
|
}>;
|
|
37
42
|
compositePrimaryKeys: Record<string, {
|
|
38
43
|
name: string;
|
|
@@ -43,13 +48,72 @@ export declare const mysqlPushIntrospect: (db: DB, databaseName: string, filters
|
|
|
43
48
|
columns: string[];
|
|
44
49
|
}>;
|
|
45
50
|
}>;
|
|
51
|
+
schemas: Record<string, string>;
|
|
52
|
+
_meta: {
|
|
53
|
+
columns: Record<string, string>;
|
|
54
|
+
tables: Record<string, string>;
|
|
55
|
+
schemas: Record<string, string>;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
ts: {
|
|
59
|
+
file: string;
|
|
60
|
+
imports: string;
|
|
61
|
+
decalrations: string;
|
|
62
|
+
schemaEntry: string;
|
|
63
|
+
};
|
|
64
|
+
}>;
|
|
65
|
+
export declare const mysqlPushIntrospect: (connection: {
|
|
66
|
+
client: DrizzleDbClient;
|
|
67
|
+
databaseName: string;
|
|
68
|
+
}, filters: string[]) => Promise<{
|
|
69
|
+
schema: {
|
|
46
70
|
id: string;
|
|
47
71
|
prevId: string;
|
|
48
|
-
version: "
|
|
72
|
+
version: "5";
|
|
49
73
|
dialect: "mysql";
|
|
74
|
+
tables: Record<string, {
|
|
75
|
+
schema?: string | undefined;
|
|
76
|
+
name: string;
|
|
77
|
+
columns: Record<string, {
|
|
78
|
+
default?: any;
|
|
79
|
+
onUpdate?: any;
|
|
80
|
+
autoincrement?: boolean | undefined;
|
|
81
|
+
name: string;
|
|
82
|
+
type: string;
|
|
83
|
+
primaryKey: boolean;
|
|
84
|
+
notNull: boolean;
|
|
85
|
+
}>;
|
|
86
|
+
indexes: Record<string, {
|
|
87
|
+
using?: "btree" | "hash" | undefined;
|
|
88
|
+
algorithm?: "default" | "inplace" | "copy" | undefined;
|
|
89
|
+
lock?: "default" | "none" | "shared" | "exclusive" | undefined;
|
|
90
|
+
name: string;
|
|
91
|
+
columns: string[];
|
|
92
|
+
isUnique: boolean;
|
|
93
|
+
}>;
|
|
94
|
+
foreignKeys: Record<string, {
|
|
95
|
+
onUpdate?: string | undefined;
|
|
96
|
+
onDelete?: string | undefined;
|
|
97
|
+
name: string;
|
|
98
|
+
tableFrom: string;
|
|
99
|
+
columnsFrom: string[];
|
|
100
|
+
tableTo: string;
|
|
101
|
+
columnsTo: string[];
|
|
102
|
+
}>;
|
|
103
|
+
compositePrimaryKeys: Record<string, {
|
|
104
|
+
name: string;
|
|
105
|
+
columns: string[];
|
|
106
|
+
}>;
|
|
107
|
+
uniqueConstraints: Record<string, {
|
|
108
|
+
name: string;
|
|
109
|
+
columns: string[];
|
|
110
|
+
}>;
|
|
111
|
+
}>;
|
|
112
|
+
schemas: Record<string, string>;
|
|
50
113
|
_meta: {
|
|
51
114
|
columns: Record<string, string>;
|
|
52
115
|
tables: Record<string, string>;
|
|
116
|
+
schemas: Record<string, string>;
|
|
53
117
|
};
|
|
54
118
|
};
|
|
55
119
|
}>;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { DrizzleDbClient } from "src/drivers";
|
|
2
|
+
import { JsonStatement } from "src/jsonStatements";
|
|
3
|
+
import { mysqlSchema } from "src/serializer/mysqlSchema";
|
|
3
4
|
import { TypeOf } from "zod";
|
|
4
|
-
import type { DB } from "../../utils";
|
|
5
5
|
export declare const filterStatements: (statements: JsonStatement[], currentSchema: TypeOf<typeof mysqlSchema>, prevSchema: TypeOf<typeof mysqlSchema>) => JsonStatement[];
|
|
6
|
-
export declare const logSuggestionsAndReturn: (
|
|
6
|
+
export declare const logSuggestionsAndReturn: ({ connection, statements, json2, }: {
|
|
7
|
+
statements: JsonStatement[];
|
|
8
|
+
connection: DrizzleDbClient;
|
|
9
|
+
json2: TypeOf<typeof mysqlSchema>;
|
|
10
|
+
}) => Promise<{
|
|
7
11
|
statementsToExecute: string[];
|
|
8
12
|
shouldAskForApprove: boolean;
|
|
9
13
|
infoToPrint: string[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MySqlSchema, MySqlSchemaV4 } from "src/serializer/mysqlSchema";
|
|
2
|
+
export declare const upMysqlHandler: (out: string) => void;
|
|
3
|
+
export declare const upMySqlHandlerV4toV5: (obj: MySqlSchemaV4) => MySqlSchema;
|
|
4
|
+
export declare const upMysqlHandlerV4: (out: string) => void;
|