drizzle-kit 0.20.18-d190692 → 0.20.18
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/bin.cjs +55769 -103683
- package/cli/commands/migrate.d.ts +270 -0
- package/cli/commands/mysqlIntrospect.d.ts +119 -0
- package/cli/commands/mysqlPushUtils.d.ts +18 -0
- package/cli/commands/mysqlUp.d.ts +4 -0
- package/cli/commands/pgConnect.d.ts +5 -0
- package/cli/commands/pgIntrospect.d.ts +123 -0
- package/cli/commands/pgPushUtils.d.ts +14 -0
- package/cli/commands/pgUp.d.ts +4 -0
- package/cli/commands/sqliteIntrospect.d.ts +107 -0
- package/cli/commands/sqlitePushUtils.d.ts +21 -0
- package/cli/commands/sqliteUtils.d.ts +162 -0
- package/cli/commands/upFolders.d.ts +27 -0
- package/cli/commands/utils.d.ts +274 -0
- package/cli/selector-ui.d.ts +13 -0
- package/cli/validations/common.d.ts +13 -0
- package/cli/validations/mysql.d.ts +365 -0
- package/cli/validations/outputs.d.ts +40 -0
- package/cli/validations/pg.d.ts +438 -0
- package/cli/views.d.ts +61 -0
- package/drivers/index.d.ts +39 -0
- package/global.d.ts +4 -0
- package/index.d.mts +68 -46
- package/index.d.ts +68 -46
- package/index.js +0 -1
- package/introspect-mysql.d.ts +9 -0
- package/introspect-pg.d.ts +12 -0
- package/introspect-sqlite.d.ts +10 -0
- package/jsonDiffer.d.ts +76 -0
- package/jsonStatements.d.ts +349 -0
- package/migrationPreparator.d.ts +35 -0
- package/package.json +64 -31
- package/payload.d.mts +18 -1052
- package/payload.d.ts +18 -1052
- package/payload.js +33563 -19279
- package/payload.mjs +33457 -19180
- package/schemaValidator.d.ts +1313 -0
- package/serializer/index.d.ts +9 -0
- package/serializer/mysqlImports.d.ts +11 -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 +4333 -0
- package/serializer/pgSerializer.d.ts +7 -0
- package/serializer/schemaToDrizzle.d.ts +7 -0
- package/serializer/sqliteImports.d.ts +9 -0
- package/serializer/sqliteSchema.d.ts +3227 -0
- package/serializer/sqliteSerializer.d.ts +6 -0
- package/snapshotsDiffer.d.ts +2660 -0
- package/sqlgenerator.d.ts +33 -0
- package/utils/words.d.ts +7 -0
- package/utils-studio.d.mts +5 -0
- package/utils-studio.d.ts +5 -0
- package/utils-studio.js +809 -4584
- package/utils-studio.mjs +793 -4565
- package/utils.d.ts +199 -0
- package/utils.js +7165 -4635
- package/utils.mjs +7125 -4595
@@ -0,0 +1,270 @@
|
|
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
|
+
import { GenerateConfig } from "./utils";
|
8
|
+
export type Named = {
|
9
|
+
name: string;
|
10
|
+
};
|
11
|
+
export type NamedWithSchema = {
|
12
|
+
name: string;
|
13
|
+
schema?: string;
|
14
|
+
};
|
15
|
+
export declare const prepareAndMigratePg: (config: GenerateConfig) => Promise<void>;
|
16
|
+
export declare const prepareMySQLPush: (config: {
|
17
|
+
schema: string | string[];
|
18
|
+
}, snapshot: MySqlSchema) => Promise<{
|
19
|
+
sqlStatements: string[];
|
20
|
+
statements: import("../../jsonStatements").JsonStatement[];
|
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";
|
33
|
+
tables: Record<string, {
|
34
|
+
schema?: string | undefined;
|
35
|
+
name: string;
|
36
|
+
columns: Record<string, {
|
37
|
+
default?: any;
|
38
|
+
onUpdate?: any;
|
39
|
+
autoincrement?: boolean | undefined;
|
40
|
+
name: string;
|
41
|
+
type: string;
|
42
|
+
primaryKey: boolean;
|
43
|
+
notNull: boolean;
|
44
|
+
}>;
|
45
|
+
indexes: Record<string, {
|
46
|
+
using?: "btree" | "hash" | undefined;
|
47
|
+
algorithm?: "default" | "inplace" | "copy" | undefined;
|
48
|
+
lock?: "default" | "none" | "shared" | "exclusive" | undefined;
|
49
|
+
name: string;
|
50
|
+
columns: string[];
|
51
|
+
isUnique: boolean;
|
52
|
+
}>;
|
53
|
+
foreignKeys: Record<string, {
|
54
|
+
onUpdate?: string | undefined;
|
55
|
+
onDelete?: string | undefined;
|
56
|
+
name: string;
|
57
|
+
tableFrom: string;
|
58
|
+
columnsFrom: string[];
|
59
|
+
tableTo: string;
|
60
|
+
columnsTo: string[];
|
61
|
+
}>;
|
62
|
+
compositePrimaryKeys: Record<string, {
|
63
|
+
name: string;
|
64
|
+
columns: string[];
|
65
|
+
}>;
|
66
|
+
uniqueConstraints: Record<string, {
|
67
|
+
name: string;
|
68
|
+
columns: string[];
|
69
|
+
}>;
|
70
|
+
}>;
|
71
|
+
schemas: Record<string, string>;
|
72
|
+
_meta: {
|
73
|
+
columns: Record<string, string>;
|
74
|
+
tables: Record<string, string>;
|
75
|
+
schemas: Record<string, string>;
|
76
|
+
};
|
77
|
+
};
|
78
|
+
validatedPrev: {
|
79
|
+
internal?: {
|
80
|
+
tables: Record<string, {
|
81
|
+
columns: Record<string, {
|
82
|
+
isDefaultAnExpression?: boolean | undefined;
|
83
|
+
} | undefined>;
|
84
|
+
} | undefined>;
|
85
|
+
} | undefined;
|
86
|
+
id: string;
|
87
|
+
prevId: string;
|
88
|
+
version: "5";
|
89
|
+
dialect: "mysql";
|
90
|
+
tables: Record<string, {
|
91
|
+
schema?: string | undefined;
|
92
|
+
name: string;
|
93
|
+
columns: Record<string, {
|
94
|
+
default?: any;
|
95
|
+
onUpdate?: any;
|
96
|
+
autoincrement?: boolean | undefined;
|
97
|
+
name: string;
|
98
|
+
type: string;
|
99
|
+
primaryKey: boolean;
|
100
|
+
notNull: boolean;
|
101
|
+
}>;
|
102
|
+
indexes: Record<string, {
|
103
|
+
using?: "btree" | "hash" | undefined;
|
104
|
+
algorithm?: "default" | "inplace" | "copy" | undefined;
|
105
|
+
lock?: "default" | "none" | "shared" | "exclusive" | undefined;
|
106
|
+
name: string;
|
107
|
+
columns: string[];
|
108
|
+
isUnique: boolean;
|
109
|
+
}>;
|
110
|
+
foreignKeys: Record<string, {
|
111
|
+
onUpdate?: string | undefined;
|
112
|
+
onDelete?: string | undefined;
|
113
|
+
name: string;
|
114
|
+
tableFrom: string;
|
115
|
+
columnsFrom: string[];
|
116
|
+
tableTo: string;
|
117
|
+
columnsTo: string[];
|
118
|
+
}>;
|
119
|
+
compositePrimaryKeys: Record<string, {
|
120
|
+
name: string;
|
121
|
+
columns: string[];
|
122
|
+
}>;
|
123
|
+
uniqueConstraints: Record<string, {
|
124
|
+
name: string;
|
125
|
+
columns: string[];
|
126
|
+
}>;
|
127
|
+
}>;
|
128
|
+
schemas: Record<string, string>;
|
129
|
+
_meta: {
|
130
|
+
columns: Record<string, string>;
|
131
|
+
tables: Record<string, string>;
|
132
|
+
schemas: Record<string, string>;
|
133
|
+
};
|
134
|
+
};
|
135
|
+
} | undefined>;
|
136
|
+
export declare const prepareSQLitePush: (config: {
|
137
|
+
schema: string | string[];
|
138
|
+
}, snapshot: SQLiteSchema) => Promise<{
|
139
|
+
sqlStatements: string[];
|
140
|
+
statements: import("../../jsonStatements").JsonStatement[];
|
141
|
+
squashedPrev: {
|
142
|
+
enums?: any;
|
143
|
+
version: "5";
|
144
|
+
dialect: "sqlite";
|
145
|
+
tables: Record<string, {
|
146
|
+
name: string;
|
147
|
+
columns: Record<string, {
|
148
|
+
default?: any;
|
149
|
+
autoincrement?: boolean | undefined;
|
150
|
+
name: string;
|
151
|
+
type: string;
|
152
|
+
primaryKey: boolean;
|
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, {
|
168
|
+
default?: any;
|
169
|
+
autoincrement?: boolean | undefined;
|
170
|
+
name: string;
|
171
|
+
type: string;
|
172
|
+
primaryKey: boolean;
|
173
|
+
notNull: boolean;
|
174
|
+
}>;
|
175
|
+
indexes: Record<string, string>;
|
176
|
+
foreignKeys: Record<string, string>;
|
177
|
+
compositePrimaryKeys: Record<string, string>;
|
178
|
+
uniqueConstraints: Record<string, string>;
|
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: {
|
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
|
+
};
|
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: {
|
253
|
+
schemas: {};
|
254
|
+
tables: {};
|
255
|
+
columns: {};
|
256
|
+
} | undefined;
|
257
|
+
}>;
|
258
|
+
export declare const BREAKPOINT = "--> statement-breakpoint\n";
|
259
|
+
export declare const writeResult: ({ cur, sqlStatements, journal, _meta, outFolder, breakpoints, bundle, type, }: {
|
260
|
+
cur: CommonSchema;
|
261
|
+
sqlStatements: string[];
|
262
|
+
journal: Journal;
|
263
|
+
_meta?: any;
|
264
|
+
outFolder: string;
|
265
|
+
breakpoints: boolean;
|
266
|
+
bundle?: boolean | undefined;
|
267
|
+
type?: "none" | "custom" | "introspect" | undefined;
|
268
|
+
}) => void;
|
269
|
+
export declare const embeddedMigrations: (journal: Journal) => string;
|
270
|
+
export declare const prepareSnapshotFolderName: () => string;
|
@@ -0,0 +1,119 @@
|
|
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
|
+
}>;
|
7
|
+
export declare const mysqlIntrospect: (config: MySQLConfigIntrospect, filters: string[]) => Promise<{
|
8
|
+
schema: {
|
9
|
+
id: string;
|
10
|
+
prevId: string;
|
11
|
+
version: "5";
|
12
|
+
dialect: "mysql";
|
13
|
+
tables: Record<string, {
|
14
|
+
schema?: string | undefined;
|
15
|
+
name: string;
|
16
|
+
columns: Record<string, {
|
17
|
+
default?: any;
|
18
|
+
onUpdate?: any;
|
19
|
+
autoincrement?: boolean | undefined;
|
20
|
+
name: string;
|
21
|
+
type: string;
|
22
|
+
primaryKey: boolean;
|
23
|
+
notNull: boolean;
|
24
|
+
}>;
|
25
|
+
indexes: Record<string, {
|
26
|
+
using?: "btree" | "hash" | undefined;
|
27
|
+
algorithm?: "default" | "inplace" | "copy" | undefined;
|
28
|
+
lock?: "default" | "none" | "shared" | "exclusive" | undefined;
|
29
|
+
name: string;
|
30
|
+
columns: string[];
|
31
|
+
isUnique: boolean;
|
32
|
+
}>;
|
33
|
+
foreignKeys: Record<string, {
|
34
|
+
onUpdate?: string | undefined;
|
35
|
+
onDelete?: string | undefined;
|
36
|
+
name: string;
|
37
|
+
tableFrom: string;
|
38
|
+
columnsFrom: string[];
|
39
|
+
tableTo: string;
|
40
|
+
columnsTo: string[];
|
41
|
+
}>;
|
42
|
+
compositePrimaryKeys: Record<string, {
|
43
|
+
name: string;
|
44
|
+
columns: string[];
|
45
|
+
}>;
|
46
|
+
uniqueConstraints: Record<string, {
|
47
|
+
name: string;
|
48
|
+
columns: string[];
|
49
|
+
}>;
|
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: {
|
70
|
+
id: string;
|
71
|
+
prevId: string;
|
72
|
+
version: "5";
|
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>;
|
113
|
+
_meta: {
|
114
|
+
columns: Record<string, string>;
|
115
|
+
tables: Record<string, string>;
|
116
|
+
schemas: Record<string, string>;
|
117
|
+
};
|
118
|
+
};
|
119
|
+
}>;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { DrizzleDbClient } from "src/drivers";
|
2
|
+
import { JsonStatement } from "src/jsonStatements";
|
3
|
+
import { mysqlSchema } from "src/serializer/mysqlSchema";
|
4
|
+
import { TypeOf } from "zod";
|
5
|
+
export declare const filterStatements: (statements: JsonStatement[], currentSchema: TypeOf<typeof mysqlSchema>, prevSchema: TypeOf<typeof mysqlSchema>) => JsonStatement[];
|
6
|
+
export declare const logSuggestionsAndReturn: ({ connection, statements, json2, }: {
|
7
|
+
statements: JsonStatement[];
|
8
|
+
connection: DrizzleDbClient;
|
9
|
+
json2: TypeOf<typeof mysqlSchema>;
|
10
|
+
}) => Promise<{
|
11
|
+
statementsToExecute: string[];
|
12
|
+
shouldAskForApprove: boolean;
|
13
|
+
infoToPrint: string[];
|
14
|
+
columnsToRemove: string[];
|
15
|
+
schemasToRemove: string[];
|
16
|
+
tablesToTruncate: string[];
|
17
|
+
tablesToRemove: string[];
|
18
|
+
}>;
|
@@ -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;
|
@@ -0,0 +1,123 @@
|
|
1
|
+
import type { PgConfigIntrospect } from "../validations/pg";
|
2
|
+
import type { DrizzleDbClient } from "src/drivers";
|
3
|
+
export declare const pgSchemas: (client: DrizzleDbClient) => Promise<string[]>;
|
4
|
+
export declare const pgPushIntrospect: (connection: {
|
5
|
+
client: DrizzleDbClient;
|
6
|
+
}, filters: string[], schemaFilters: string[]) => Promise<{
|
7
|
+
schema: {
|
8
|
+
id: string;
|
9
|
+
prevId: string;
|
10
|
+
version: "5";
|
11
|
+
dialect: "pg";
|
12
|
+
tables: Record<string, {
|
13
|
+
name: string;
|
14
|
+
columns: Record<string, {
|
15
|
+
isUnique?: any;
|
16
|
+
default?: any;
|
17
|
+
uniqueName?: string | undefined;
|
18
|
+
nullsNotDistinct?: boolean | undefined;
|
19
|
+
name: string;
|
20
|
+
type: string;
|
21
|
+
primaryKey: boolean;
|
22
|
+
notNull: boolean;
|
23
|
+
}>;
|
24
|
+
indexes: Record<string, {
|
25
|
+
name: string;
|
26
|
+
columns: string[];
|
27
|
+
isUnique: boolean;
|
28
|
+
}>;
|
29
|
+
foreignKeys: Record<string, {
|
30
|
+
onUpdate?: string | undefined;
|
31
|
+
onDelete?: string | undefined;
|
32
|
+
schemaTo?: string | undefined;
|
33
|
+
name: string;
|
34
|
+
tableFrom: string;
|
35
|
+
columnsFrom: string[];
|
36
|
+
tableTo: string;
|
37
|
+
columnsTo: string[];
|
38
|
+
}>;
|
39
|
+
schema: string;
|
40
|
+
compositePrimaryKeys: Record<string, {
|
41
|
+
name: string;
|
42
|
+
columns: string[];
|
43
|
+
}>;
|
44
|
+
uniqueConstraints: Record<string, {
|
45
|
+
name: string;
|
46
|
+
columns: string[];
|
47
|
+
nullsNotDistinct: boolean;
|
48
|
+
}>;
|
49
|
+
}>;
|
50
|
+
schemas: Record<string, string>;
|
51
|
+
_meta: {
|
52
|
+
columns: Record<string, string>;
|
53
|
+
tables: Record<string, string>;
|
54
|
+
schemas: Record<string, string>;
|
55
|
+
};
|
56
|
+
enums: Record<string, {
|
57
|
+
name: string;
|
58
|
+
values: Record<string, string>;
|
59
|
+
}>;
|
60
|
+
};
|
61
|
+
}>;
|
62
|
+
export declare const pgIntrospect: (config: PgConfigIntrospect, filters: string[], schemaFilters: string[]) => Promise<{
|
63
|
+
schema: {
|
64
|
+
id: string;
|
65
|
+
prevId: string;
|
66
|
+
version: "5";
|
67
|
+
dialect: "pg";
|
68
|
+
tables: Record<string, {
|
69
|
+
name: string;
|
70
|
+
columns: Record<string, {
|
71
|
+
isUnique?: any;
|
72
|
+
default?: any;
|
73
|
+
uniqueName?: string | undefined;
|
74
|
+
nullsNotDistinct?: boolean | undefined;
|
75
|
+
name: string;
|
76
|
+
type: string;
|
77
|
+
primaryKey: boolean;
|
78
|
+
notNull: boolean;
|
79
|
+
}>;
|
80
|
+
indexes: Record<string, {
|
81
|
+
name: string;
|
82
|
+
columns: string[];
|
83
|
+
isUnique: boolean;
|
84
|
+
}>;
|
85
|
+
foreignKeys: Record<string, {
|
86
|
+
onUpdate?: string | undefined;
|
87
|
+
onDelete?: string | undefined;
|
88
|
+
schemaTo?: string | undefined;
|
89
|
+
name: string;
|
90
|
+
tableFrom: string;
|
91
|
+
columnsFrom: string[];
|
92
|
+
tableTo: string;
|
93
|
+
columnsTo: string[];
|
94
|
+
}>;
|
95
|
+
schema: string;
|
96
|
+
compositePrimaryKeys: Record<string, {
|
97
|
+
name: string;
|
98
|
+
columns: string[];
|
99
|
+
}>;
|
100
|
+
uniqueConstraints: Record<string, {
|
101
|
+
name: string;
|
102
|
+
columns: string[];
|
103
|
+
nullsNotDistinct: boolean;
|
104
|
+
}>;
|
105
|
+
}>;
|
106
|
+
schemas: Record<string, string>;
|
107
|
+
_meta: {
|
108
|
+
columns: Record<string, string>;
|
109
|
+
tables: Record<string, string>;
|
110
|
+
schemas: Record<string, string>;
|
111
|
+
};
|
112
|
+
enums: Record<string, {
|
113
|
+
name: string;
|
114
|
+
values: Record<string, string>;
|
115
|
+
}>;
|
116
|
+
};
|
117
|
+
ts: {
|
118
|
+
file: string;
|
119
|
+
imports: string;
|
120
|
+
decalrations: string;
|
121
|
+
schemaEntry: string;
|
122
|
+
};
|
123
|
+
}>;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { DrizzleDbClient } from "src/drivers";
|
2
|
+
import { JsonStatement } from "src/jsonStatements";
|
3
|
+
export declare const pgSuggestions: ({ connection, statements, }: {
|
4
|
+
statements: JsonStatement[];
|
5
|
+
connection: DrizzleDbClient;
|
6
|
+
}) => Promise<{
|
7
|
+
statementsToExecute: string[];
|
8
|
+
shouldAskForApprove: boolean;
|
9
|
+
infoToPrint: string[];
|
10
|
+
columnsToRemove: string[];
|
11
|
+
schemasToRemove: string[];
|
12
|
+
tablesToTruncate: string[];
|
13
|
+
tablesToRemove: string[];
|
14
|
+
}>;
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import type { SQLiteCliConfig, SQLiteConnectionConfig } from "./sqliteUtils";
|
2
|
+
import type { DrizzleDbClient } from "../../drivers";
|
3
|
+
export declare const connectToSQLite: (config: SQLiteConnectionConfig) => Promise<{
|
4
|
+
client: import("../../drivers").BetterSqlite;
|
5
|
+
} | {
|
6
|
+
client?: undefined;
|
7
|
+
}>;
|
8
|
+
export declare const sqliteIntrospect: (config: SQLiteCliConfig, filters: string[]) => Promise<{
|
9
|
+
schema: {
|
10
|
+
id: string;
|
11
|
+
prevId: string;
|
12
|
+
version: "5";
|
13
|
+
dialect: "sqlite";
|
14
|
+
tables: Record<string, {
|
15
|
+
name: string;
|
16
|
+
columns: Record<string, {
|
17
|
+
default?: any;
|
18
|
+
autoincrement?: boolean | undefined;
|
19
|
+
name: string;
|
20
|
+
type: string;
|
21
|
+
primaryKey: boolean;
|
22
|
+
notNull: boolean;
|
23
|
+
}>;
|
24
|
+
indexes: Record<string, {
|
25
|
+
where?: string | undefined;
|
26
|
+
name: string;
|
27
|
+
columns: string[];
|
28
|
+
isUnique: boolean;
|
29
|
+
}>;
|
30
|
+
foreignKeys: Record<string, {
|
31
|
+
onUpdate?: string | undefined;
|
32
|
+
onDelete?: string | undefined;
|
33
|
+
name: string;
|
34
|
+
tableFrom: string;
|
35
|
+
columnsFrom: string[];
|
36
|
+
tableTo: string;
|
37
|
+
columnsTo: string[];
|
38
|
+
}>;
|
39
|
+
compositePrimaryKeys: Record<string, {
|
40
|
+
name?: string | undefined;
|
41
|
+
columns: string[];
|
42
|
+
}>;
|
43
|
+
uniqueConstraints: Record<string, {
|
44
|
+
name: string;
|
45
|
+
columns: string[];
|
46
|
+
}>;
|
47
|
+
}>;
|
48
|
+
_meta: {
|
49
|
+
columns: Record<string, string>;
|
50
|
+
tables: Record<string, string>;
|
51
|
+
};
|
52
|
+
enums: {};
|
53
|
+
};
|
54
|
+
ts: {
|
55
|
+
file: string;
|
56
|
+
imports: string;
|
57
|
+
decalrations: string;
|
58
|
+
schemaEntry: string;
|
59
|
+
};
|
60
|
+
}>;
|
61
|
+
export declare const sqlitePushIntrospect: (client: DrizzleDbClient, filters: string[]) => Promise<{
|
62
|
+
schema: {
|
63
|
+
id: string;
|
64
|
+
prevId: string;
|
65
|
+
version: "5";
|
66
|
+
dialect: "sqlite";
|
67
|
+
tables: Record<string, {
|
68
|
+
name: string;
|
69
|
+
columns: Record<string, {
|
70
|
+
default?: any;
|
71
|
+
autoincrement?: boolean | undefined;
|
72
|
+
name: string;
|
73
|
+
type: string;
|
74
|
+
primaryKey: boolean;
|
75
|
+
notNull: boolean;
|
76
|
+
}>;
|
77
|
+
indexes: Record<string, {
|
78
|
+
where?: string | undefined;
|
79
|
+
name: string;
|
80
|
+
columns: string[];
|
81
|
+
isUnique: boolean;
|
82
|
+
}>;
|
83
|
+
foreignKeys: Record<string, {
|
84
|
+
onUpdate?: string | undefined;
|
85
|
+
onDelete?: string | undefined;
|
86
|
+
name: string;
|
87
|
+
tableFrom: string;
|
88
|
+
columnsFrom: string[];
|
89
|
+
tableTo: string;
|
90
|
+
columnsTo: string[];
|
91
|
+
}>;
|
92
|
+
compositePrimaryKeys: Record<string, {
|
93
|
+
name?: string | undefined;
|
94
|
+
columns: string[];
|
95
|
+
}>;
|
96
|
+
uniqueConstraints: Record<string, {
|
97
|
+
name: string;
|
98
|
+
columns: string[];
|
99
|
+
}>;
|
100
|
+
}>;
|
101
|
+
_meta: {
|
102
|
+
columns: Record<string, string>;
|
103
|
+
tables: Record<string, string>;
|
104
|
+
};
|
105
|
+
enums: {};
|
106
|
+
};
|
107
|
+
}>;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { DrizzleDbClient } from "src/drivers";
|
2
|
+
import { JsonStatement } from "src/jsonStatements";
|
3
|
+
import { SQLiteSchemaInternal, SQLiteSchemaSquashed } from "src/serializer/sqliteSchema";
|
4
|
+
export declare const _moveDataStatements: (tableName: string, json: SQLiteSchemaSquashed, dataLoss?: boolean) => string[];
|
5
|
+
export declare const getOldTableName: (tableName: string, meta: SQLiteSchemaInternal["_meta"]) => string;
|
6
|
+
export declare const getNewTableName: (tableName: string, meta: SQLiteSchemaInternal["_meta"]) => string;
|
7
|
+
export declare const logSuggestionsAndReturn: ({ connection, statements, json1, json2, meta, }: {
|
8
|
+
statements: JsonStatement[];
|
9
|
+
connection: DrizzleDbClient;
|
10
|
+
json1: SQLiteSchemaSquashed;
|
11
|
+
json2: SQLiteSchemaSquashed;
|
12
|
+
meta: SQLiteSchemaInternal["_meta"];
|
13
|
+
}) => Promise<{
|
14
|
+
statementsToExecute: string[];
|
15
|
+
shouldAskForApprove: boolean;
|
16
|
+
infoToPrint: string[];
|
17
|
+
columnsToRemove: string[];
|
18
|
+
schemasToRemove: string[];
|
19
|
+
tablesToTruncate: string[];
|
20
|
+
tablesToRemove: string[];
|
21
|
+
}>;
|