drizzle-kit 0.20.14-f5f86f6 → 0.20.14-fa7577a
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +2397 -2184
- package/cli/commands/migrate.d.ts +7 -7
- package/cli/commands/mysqlPushUtils.d.ts +2 -2
- package/cli/commands/mysqlUp.d.ts +1 -1
- package/cli/commands/pgConnect.d.ts +1 -1
- package/cli/commands/pgIntrospect.d.ts +1 -1
- package/cli/commands/pgPushUtils.d.ts +2 -2
- package/cli/commands/pgUp.d.ts +1 -1
- package/cli/commands/sqlitePushUtils.d.ts +3 -3
- package/cli/commands/upFolders.d.ts +1 -1
- package/cli/commands/utils.d.ts +2 -11
- package/cli/validations/common.d.ts +1 -1
- package/cli/views.d.ts +1 -1
- package/package.json +1 -1
- package/payload.js +68 -276
- package/payload.mjs +68 -276
- package/schemaValidator.d.ts +1 -1
- package/serializer/mysqlSerializer.d.ts +2 -2
- package/serializer/sqliteSerializer.d.ts +2 -2
- package/utils-studio.js +17 -21
- package/utils-studio.mjs +13 -17
- package/utils.js +12 -26
- package/utils.mjs +12 -26
- package/cli/commands/check.d.ts +0 -2
- package/cli/commands/drop.d.ts +0 -4
- package/cli/commands/push.d.ts +0 -6
- package/cli/commands/sqliteUp.d.ts +0 -2
- package/cli/index.d.ts +0 -71
- package/cli/utils.d.ts +0 -12
- package/cli/validations/sqlite.d.ts +0 -220
- package/cli/validations/studio.d.ts +0 -593
- package/orm-extenstions/d1-driver/driver.d.ts +0 -8
- package/orm-extenstions/d1-driver/session.d.ts +0 -51
- package/orm-extenstions/d1-driver/wrangler-client.d.ts +0 -3
- package/serializer/studioUtils.d.ts +0 -65
- package/utils/certs.d.ts +0 -4
@@ -1,9 +1,9 @@
|
|
1
1
|
import { CommonSchema, CommonSquashedSchema, Dialect } from "../../schemaValidator";
|
2
2
|
import { schema } from "../views";
|
3
|
-
import { PgSchema } from "
|
4
|
-
import { SQLiteSchema } from "
|
5
|
-
import { MySqlSchema } from "
|
6
|
-
import { Journal } from "
|
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;
|
@@ -132,7 +132,7 @@ export declare const prepareMySQLPush: (config: {
|
|
132
132
|
schemas: Record<string, string>;
|
133
133
|
};
|
134
134
|
};
|
135
|
-
}>;
|
135
|
+
} | undefined>;
|
136
136
|
export declare const prepareSQLitePush: (config: {
|
137
137
|
schema: string | string[];
|
138
138
|
}, snapshot: SQLiteSchema) => Promise<{
|
@@ -183,7 +183,7 @@ export declare const prepareSQLitePush: (config: {
|
|
183
183
|
tables: {};
|
184
184
|
columns: {};
|
185
185
|
} | undefined;
|
186
|
-
}>;
|
186
|
+
} | undefined>;
|
187
187
|
export declare const preparePgPush: (config: {
|
188
188
|
schema: string | string[];
|
189
189
|
}, snapshot: PgSchema, schemaFilter: string[]) => Promise<{
|
@@ -243,7 +243,7 @@ export declare const preparePgPush: (config: {
|
|
243
243
|
values: Record<string, string>;
|
244
244
|
}>;
|
245
245
|
};
|
246
|
-
}>;
|
246
|
+
} | undefined>;
|
247
247
|
export declare const prepareAndMigrateMySql: (config: GenerateConfig) => Promise<void>;
|
248
248
|
export declare const prepareAndMigrateSqlite: (config: GenerateConfig) => Promise<void>;
|
249
249
|
export declare const prepareSQL: (prev: CommonSquashedSchema, cur: CommonSquashedSchema, dialect: Dialect, prevFull?: any, curFull?: any) => Promise<{
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { DrizzleDbClient } from "src/drivers";
|
2
|
-
import { JsonStatement } from "
|
3
|
-
import { mysqlSchema } from "
|
2
|
+
import { JsonStatement } from "src/jsonStatements";
|
3
|
+
import { mysqlSchema } from "src/serializer/mysqlSchema";
|
4
4
|
import { TypeOf } from "zod";
|
5
5
|
export declare const filterStatements: (statements: JsonStatement[], currentSchema: TypeOf<typeof mysqlSchema>, prevSchema: TypeOf<typeof mysqlSchema>) => JsonStatement[];
|
6
6
|
export declare const logSuggestionsAndReturn: ({ connection, statements, json2, }: {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { MySqlSchema, MySqlSchemaV4 } from "
|
1
|
+
import { MySqlSchema, MySqlSchemaV4 } from "src/serializer/mysqlSchema";
|
2
2
|
export declare const upMysqlHandler: (out: string) => void;
|
3
3
|
export declare const upMySqlHandlerV4toV5: (obj: MySqlSchemaV4) => MySqlSchema;
|
4
4
|
export declare const upMysqlHandlerV4: (out: string) => void;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { PgConfigIntrospect } from "../validations/pg";
|
2
|
-
import type { DrizzleDbClient } from "
|
2
|
+
import type { DrizzleDbClient } from "src/drivers";
|
3
3
|
export declare const pgSchemas: (client: DrizzleDbClient) => Promise<string[]>;
|
4
4
|
export declare const pgPushIntrospect: (connection: {
|
5
5
|
client: DrizzleDbClient;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { DrizzleDbClient } from "
|
2
|
-
import { JsonStatement } from "
|
1
|
+
import { DrizzleDbClient } from "src/drivers";
|
2
|
+
import { JsonStatement } from "src/jsonStatements";
|
3
3
|
export declare const pgSuggestions: ({ connection, statements, }: {
|
4
4
|
statements: JsonStatement[];
|
5
5
|
connection: DrizzleDbClient;
|
package/cli/commands/pgUp.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { PgSchema, PgSchemaV4 } from "
|
1
|
+
import { PgSchema, PgSchemaV4 } from "src/serializer/pgSchema";
|
2
2
|
export declare const upPgHandlerV4toV5: (obj: PgSchemaV4) => PgSchema;
|
3
3
|
export declare const upPgHandler: (out: string) => void;
|
4
4
|
export declare const upPgHandlerV4: (out: string) => void;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { DrizzleDbClient } from "
|
2
|
-
import { JsonStatement } from "
|
3
|
-
import { SQLiteSchemaInternal, SQLiteSchemaSquashed } from "
|
1
|
+
import { DrizzleDbClient } from "src/drivers";
|
2
|
+
import { JsonStatement } from "src/jsonStatements";
|
3
|
+
import { SQLiteSchemaInternal, SQLiteSchemaSquashed } from "src/serializer/sqliteSchema";
|
4
4
|
export declare const _moveDataStatements: (tableName: string, json: SQLiteSchemaSquashed, dataLoss?: boolean) => string[];
|
5
5
|
export declare const getOldTableName: (tableName: string, meta: SQLiteSchemaInternal["_meta"]) => string;
|
6
6
|
export declare const getNewTableName: (tableName: string, meta: SQLiteSchemaInternal["_meta"]) => string;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Dialect } from "
|
1
|
+
import { Dialect } from "src/schemaValidator";
|
2
2
|
import { Named, NamedWithSchema } from "./migrate";
|
3
3
|
export declare const resolveSchemas: <T extends Named>(missingSchemas: T[], newSchemas: T[], predicate: (leftMissing: T[], created: T) => T | undefined) => {
|
4
4
|
created: T[];
|
package/cli/commands/utils.d.ts
CHANGED
@@ -1,8 +1,4 @@
|
|
1
1
|
import { TypeOf } from "zod";
|
2
|
-
import { CliParamsPush } from "..";
|
3
|
-
import { MySQLPushConfig } from "../validations/mysql";
|
4
|
-
import { PgPushConfig } from "../validations/pg";
|
5
|
-
import { SQLitePushConfig } from "../validations/sqlite";
|
6
2
|
export declare const safeRegister: () => Promise<{
|
7
3
|
unregister: () => void;
|
8
4
|
}>;
|
@@ -20,11 +16,6 @@ export declare const prepareGenerateConfig: (options: {
|
|
20
16
|
breakpoints: boolean;
|
21
17
|
custom: boolean;
|
22
18
|
}) => Promise<GenerateConfig>;
|
23
|
-
export declare const preparePushConfig: (options: CliParamsPush) => Promise<{
|
24
|
-
config: MySQLPushConfig | PgPushConfig | SQLitePushConfig;
|
25
|
-
schemaFiles: string[];
|
26
|
-
tablesFilter: string[];
|
27
|
-
}>;
|
28
19
|
export declare const assertOutFolder: (it: {
|
29
20
|
config?: string;
|
30
21
|
} | {
|
@@ -47,8 +38,8 @@ export declare const configCommonSchema: import("zod").ZodObject<{
|
|
47
38
|
schemaFilter: string | string[];
|
48
39
|
}, {
|
49
40
|
out?: string | undefined;
|
50
|
-
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
51
41
|
breakpoints?: boolean | undefined;
|
42
|
+
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
52
43
|
tablesFilter?: string | string[] | undefined;
|
53
44
|
schemaFilter?: string | string[] | undefined;
|
54
45
|
schema: string | string[];
|
@@ -190,8 +181,8 @@ export declare const mySqlCliConfigSchema: import("zod").ZodIntersection<import(
|
|
190
181
|
schemaFilter: string | string[];
|
191
182
|
}, {
|
192
183
|
out?: string | undefined;
|
193
|
-
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
194
184
|
breakpoints?: boolean | undefined;
|
185
|
+
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
195
186
|
tablesFilter?: string | string[] | undefined;
|
196
187
|
schemaFilter?: string | string[] | undefined;
|
197
188
|
schema: string | string[];
|
@@ -3,7 +3,7 @@ export type CollusionCheckOutput = {
|
|
3
3
|
message?: string;
|
4
4
|
action: "config" | "cli" | "error";
|
5
5
|
};
|
6
|
-
export type Commands = "push:sqlite" | "introspect:sqlite" | "introspect:pg" | "generate" | "check:pg" | "check:mysql" | "check:sqlite" | "up:pg" | "up:mysql" | "up:sqlite" | "drop" | "introspect:mysql" | "push:mysql" | "push:pg";
|
6
|
+
export type Commands = "push:sqlite" | "introspect:sqlite" | "introspect:pg" | "generate:pg" | "generate:sqlite" | "generate:mysql" | "check:pg" | "check:mysql" | "check:sqlite" | "up:pg" | "up:mysql" | "up:sqlite" | "drop" | "introspect:mysql" | "push:mysql" | "push:pg";
|
7
7
|
/**
|
8
8
|
* This function checks an input from a user and if there are any params together with config path - return true
|
9
9
|
* @param options - user input
|
package/cli/views.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Prompt, TaskView } from "hanji";
|
2
|
-
import type { CommonSchema } from "
|
2
|
+
import type { CommonSchema } from "src/schemaValidator";
|
3
3
|
import type { Named } from "./commands/migrate";
|
4
4
|
export declare const warning: (msg: string) => void;
|
5
5
|
export declare const err: (msg: string) => void;
|
package/package.json
CHANGED
package/payload.js
CHANGED
@@ -2090,7 +2090,7 @@ ${withStyle.errorWarning(
|
|
2090
2090
|
--end;
|
2091
2091
|
return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
|
2092
2092
|
};
|
2093
|
-
fromDatabase2 = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
|
2093
|
+
fromDatabase2 = async (db, tablesFilter = (table4) => true, schemaFilters, progressCallback) => {
|
2094
2094
|
const result = {};
|
2095
2095
|
const internals = { tables: {} };
|
2096
2096
|
const where = schemaFilters.map((t) => `table_schema = '${t}'`).join(" or ");
|
@@ -6160,226 +6160,6 @@ var init_lib = __esm({
|
|
6160
6160
|
}
|
6161
6161
|
});
|
6162
6162
|
|
6163
|
-
// src/cli/validations/common.ts
|
6164
|
-
var init_common = __esm({
|
6165
|
-
"src/cli/validations/common.ts"() {
|
6166
|
-
init_outputs();
|
6167
|
-
}
|
6168
|
-
});
|
6169
|
-
|
6170
|
-
// src/cli/validations/mysql.ts
|
6171
|
-
var mysqlConnectionCli, mysql2credentials, mysqlConnectionConfig, mysqlConfigIntrospectSchema, mysqlCliIntrospectParams, mysqlCliPushParams, mysqlConfigPushParams;
|
6172
|
-
var init_mysql = __esm({
|
6173
|
-
"src/cli/validations/mysql.ts"() {
|
6174
|
-
init_lib();
|
6175
|
-
init_utils();
|
6176
|
-
init_common();
|
6177
|
-
init_outputs();
|
6178
|
-
mysqlConnectionCli = unionType([
|
6179
|
-
objectType({
|
6180
|
-
driver: literalType("mysql2"),
|
6181
|
-
host: stringType(),
|
6182
|
-
port: coerce.number().optional(),
|
6183
|
-
user: stringType().default("mysql"),
|
6184
|
-
password: stringType().optional(),
|
6185
|
-
database: stringType()
|
6186
|
-
}),
|
6187
|
-
objectType({
|
6188
|
-
driver: literalType("mysql2"),
|
6189
|
-
uri: stringType()
|
6190
|
-
// TODO: change docs
|
6191
|
-
})
|
6192
|
-
]);
|
6193
|
-
mysql2credentials = unionType([
|
6194
|
-
objectType({
|
6195
|
-
host: stringType(),
|
6196
|
-
port: coerce.number().optional(),
|
6197
|
-
user: stringType().default("mysql"),
|
6198
|
-
password: stringType().optional(),
|
6199
|
-
database: stringType()
|
6200
|
-
}),
|
6201
|
-
objectType({
|
6202
|
-
uri: stringType()
|
6203
|
-
// TODO: change docs
|
6204
|
-
})
|
6205
|
-
]);
|
6206
|
-
mysqlConnectionConfig = objectType({
|
6207
|
-
driver: literalType("mysql2"),
|
6208
|
-
dbCredentials: mysql2credentials
|
6209
|
-
});
|
6210
|
-
mysqlConfigIntrospectSchema = intersectionType(
|
6211
|
-
configIntrospectSchema,
|
6212
|
-
mysqlConnectionConfig
|
6213
|
-
);
|
6214
|
-
mysqlCliIntrospectParams = intersectionType(
|
6215
|
-
configIntrospectCliSchema,
|
6216
|
-
mysqlConnectionCli
|
6217
|
-
);
|
6218
|
-
mysqlCliPushParams = intersectionType(
|
6219
|
-
configPushSchema,
|
6220
|
-
mysqlConnectionCli
|
6221
|
-
);
|
6222
|
-
mysqlConfigPushParams = intersectionType(
|
6223
|
-
configPushSchema,
|
6224
|
-
mysqlConnectionConfig
|
6225
|
-
);
|
6226
|
-
}
|
6227
|
-
});
|
6228
|
-
|
6229
|
-
// src/cli/validations/pg.ts
|
6230
|
-
var pgConnectionCli, pgConnectionConfig, pgConfigIntrospectSchema, pgCliIntrospectParams, pgCliPushParams, pgConfigPushParams;
|
6231
|
-
var init_pg = __esm({
|
6232
|
-
"src/cli/validations/pg.ts"() {
|
6233
|
-
init_lib();
|
6234
|
-
init_utils();
|
6235
|
-
init_common();
|
6236
|
-
init_outputs();
|
6237
|
-
pgConnectionCli = unionType([
|
6238
|
-
objectType({
|
6239
|
-
driver: literalType("pg"),
|
6240
|
-
host: stringType(),
|
6241
|
-
port: coerce.number().optional(),
|
6242
|
-
user: stringType().default("postgres"),
|
6243
|
-
password: stringType().optional(),
|
6244
|
-
database: stringType(),
|
6245
|
-
ssl: coerce.boolean().optional(),
|
6246
|
-
type: literalType("params").default("params")
|
6247
|
-
}),
|
6248
|
-
objectType({
|
6249
|
-
driver: literalType("pg"),
|
6250
|
-
connectionString: stringType(),
|
6251
|
-
type: literalType("url").default("url")
|
6252
|
-
})
|
6253
|
-
]);
|
6254
|
-
pgConnectionConfig = unionType([
|
6255
|
-
objectType({
|
6256
|
-
driver: literalType("pg"),
|
6257
|
-
dbCredentials: objectType({
|
6258
|
-
host: stringType(),
|
6259
|
-
port: coerce.number().optional(),
|
6260
|
-
user: stringType().default("postgres"),
|
6261
|
-
password: stringType().optional(),
|
6262
|
-
database: stringType(),
|
6263
|
-
ssl: coerce.boolean().optional(),
|
6264
|
-
type: literalType("params").default("params").optional()
|
6265
|
-
})
|
6266
|
-
}),
|
6267
|
-
objectType({
|
6268
|
-
driver: literalType("pg"),
|
6269
|
-
dbCredentials: objectType({
|
6270
|
-
connectionString: stringType(),
|
6271
|
-
type: literalType("url").default("url").optional()
|
6272
|
-
})
|
6273
|
-
})
|
6274
|
-
]);
|
6275
|
-
pgConfigIntrospectSchema = intersectionType(
|
6276
|
-
configIntrospectSchema,
|
6277
|
-
pgConnectionConfig
|
6278
|
-
);
|
6279
|
-
pgCliIntrospectParams = intersectionType(
|
6280
|
-
configIntrospectCliSchema,
|
6281
|
-
pgConnectionCli
|
6282
|
-
);
|
6283
|
-
pgCliPushParams = intersectionType(
|
6284
|
-
configPushSchema,
|
6285
|
-
pgConnectionCli
|
6286
|
-
);
|
6287
|
-
pgConfigPushParams = intersectionType(
|
6288
|
-
configPushSchema,
|
6289
|
-
pgConnectionConfig
|
6290
|
-
);
|
6291
|
-
}
|
6292
|
-
});
|
6293
|
-
|
6294
|
-
// src/cli/commands/sqliteUtils.ts
|
6295
|
-
var sqliteConnectionSchema, sqliteCliConfigSchema;
|
6296
|
-
var init_sqliteUtils = __esm({
|
6297
|
-
"src/cli/commands/sqliteUtils.ts"() {
|
6298
|
-
init_lib();
|
6299
|
-
init_utils();
|
6300
|
-
sqliteConnectionSchema = unionType([
|
6301
|
-
objectType({
|
6302
|
-
driver: literalType("turso"),
|
6303
|
-
dbCredentials: objectType({
|
6304
|
-
url: stringType(),
|
6305
|
-
authToken: stringType().optional()
|
6306
|
-
})
|
6307
|
-
}),
|
6308
|
-
objectType({
|
6309
|
-
driver: literalType("libsql"),
|
6310
|
-
dbCredentials: objectType({
|
6311
|
-
url: stringType()
|
6312
|
-
})
|
6313
|
-
}),
|
6314
|
-
objectType({
|
6315
|
-
driver: literalType("better-sqlite"),
|
6316
|
-
dbCredentials: objectType({
|
6317
|
-
url: stringType()
|
6318
|
-
})
|
6319
|
-
})
|
6320
|
-
]);
|
6321
|
-
sqliteCliConfigSchema = intersectionType(
|
6322
|
-
configIntrospectSchema,
|
6323
|
-
sqliteConnectionSchema
|
6324
|
-
);
|
6325
|
-
}
|
6326
|
-
});
|
6327
|
-
|
6328
|
-
// src/cli/validations/sqlite.ts
|
6329
|
-
var sqliteConnectionCli, sqliteCliIntrospectParams, sqliteCliPushParams, sqliteConfigPushParams;
|
6330
|
-
var init_sqlite = __esm({
|
6331
|
-
"src/cli/validations/sqlite.ts"() {
|
6332
|
-
init_lib();
|
6333
|
-
init_sqliteUtils();
|
6334
|
-
init_utils();
|
6335
|
-
init_common();
|
6336
|
-
init_outputs();
|
6337
|
-
sqliteConnectionCli = unionType([
|
6338
|
-
objectType({
|
6339
|
-
driver: literalType("turso"),
|
6340
|
-
url: stringType(),
|
6341
|
-
authToken: stringType()
|
6342
|
-
}),
|
6343
|
-
objectType({
|
6344
|
-
driver: literalType("better-sqlite"),
|
6345
|
-
url: stringType()
|
6346
|
-
}),
|
6347
|
-
objectType({
|
6348
|
-
driver: literalType("libsql"),
|
6349
|
-
url: stringType()
|
6350
|
-
})
|
6351
|
-
]);
|
6352
|
-
sqliteCliIntrospectParams = intersectionType(
|
6353
|
-
configIntrospectCliSchema,
|
6354
|
-
sqliteConnectionCli
|
6355
|
-
);
|
6356
|
-
sqliteCliPushParams = intersectionType(
|
6357
|
-
configPushSchema,
|
6358
|
-
sqliteConnectionCli
|
6359
|
-
);
|
6360
|
-
sqliteConfigPushParams = intersectionType(
|
6361
|
-
configPushSchema,
|
6362
|
-
sqliteConnectionSchema
|
6363
|
-
);
|
6364
|
-
}
|
6365
|
-
});
|
6366
|
-
|
6367
|
-
// src/global.ts
|
6368
|
-
var originUUID, snapshotVersion, mapValues;
|
6369
|
-
var init_global = __esm({
|
6370
|
-
"src/global.ts"() {
|
6371
|
-
originUUID = "00000000-0000-0000-0000-000000000000";
|
6372
|
-
snapshotVersion = "5";
|
6373
|
-
mapValues = (obj, map) => {
|
6374
|
-
const result = Object.keys(obj).reduce(function(result2, key) {
|
6375
|
-
result2[key] = map(obj[key]);
|
6376
|
-
return result2;
|
6377
|
-
}, {});
|
6378
|
-
return result;
|
6379
|
-
};
|
6380
|
-
}
|
6381
|
-
});
|
6382
|
-
|
6383
6163
|
// src/cli/commands/_es5.ts
|
6384
6164
|
var es5_exports = {};
|
6385
6165
|
__export(es5_exports, {
|
@@ -12007,13 +11787,6 @@ var init_utils = __esm({
|
|
12007
11787
|
init_source();
|
12008
11788
|
init_views();
|
12009
11789
|
import_hanji2 = __toESM(require_hanji());
|
12010
|
-
init_mysql();
|
12011
|
-
init_pg();
|
12012
|
-
init_sqlite();
|
12013
|
-
init_outputs();
|
12014
|
-
init_pg();
|
12015
|
-
init_sqlite();
|
12016
|
-
init_global();
|
12017
11790
|
assertES5 = async (unregister) => {
|
12018
11791
|
try {
|
12019
11792
|
init_es5();
|
@@ -12180,6 +11953,22 @@ var init_pgImports = __esm({
|
|
12180
11953
|
}
|
12181
11954
|
});
|
12182
11955
|
|
11956
|
+
// src/global.ts
|
11957
|
+
var originUUID, snapshotVersion, mapValues;
|
11958
|
+
var init_global = __esm({
|
11959
|
+
"src/global.ts"() {
|
11960
|
+
originUUID = "00000000-0000-0000-0000-000000000000";
|
11961
|
+
snapshotVersion = "5";
|
11962
|
+
mapValues = (obj, map) => {
|
11963
|
+
const result = Object.keys(obj).reduce(function(result2, key) {
|
11964
|
+
result2[key] = map(obj[key]);
|
11965
|
+
return result2;
|
11966
|
+
}, {});
|
11967
|
+
return result;
|
11968
|
+
};
|
11969
|
+
}
|
11970
|
+
});
|
11971
|
+
|
12183
11972
|
// src/serializer/pgSchema.ts
|
12184
11973
|
var indexV2, columnV2, tableV2, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, schemaHash, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaExternal, kitInternals, pgSchemaInternal, tableSquashed, tableSquashedV4, pgSchemaSquashedV4, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
|
12185
11974
|
var init_pgSchema = __esm({
|
@@ -12673,12 +12462,9 @@ var init_sqliteSchema = __esm({
|
|
12673
12462
|
const squashedPKs = mapValues(it[1].compositePrimaryKeys, (pk) => {
|
12674
12463
|
return SQLiteSquasher.squashPK(pk);
|
12675
12464
|
});
|
12676
|
-
const squashedUniqueConstraints = mapValues(
|
12677
|
-
|
12678
|
-
|
12679
|
-
return SQLiteSquasher.squashUnique(unq);
|
12680
|
-
}
|
12681
|
-
);
|
12465
|
+
const squashedUniqueConstraints = mapValues(it[1].uniqueConstraints, (unq) => {
|
12466
|
+
return SQLiteSquasher.squashUnique(unq);
|
12467
|
+
});
|
12682
12468
|
return [
|
12683
12469
|
it[0],
|
12684
12470
|
{
|
@@ -12712,11 +12498,7 @@ var init_sqliteSchema = __esm({
|
|
12712
12498
|
}
|
12713
12499
|
});
|
12714
12500
|
sqliteSchema = schema2;
|
12715
|
-
backwardCompatibleSqliteSchema = unionType([
|
12716
|
-
schemaV3,
|
12717
|
-
schemaV4,
|
12718
|
-
schema2
|
12719
|
-
]);
|
12501
|
+
backwardCompatibleSqliteSchema = unionType([schemaV3, schemaV4, schema2]);
|
12720
12502
|
}
|
12721
12503
|
});
|
12722
12504
|
|
@@ -16360,50 +16142,60 @@ var init_migrate = __esm({
|
|
16360
16142
|
return { sqlStatements, statements, validatedCur, validatedPrev };
|
16361
16143
|
} catch (e) {
|
16362
16144
|
console.error(e);
|
16363
|
-
process.exit(1);
|
16364
16145
|
}
|
16365
16146
|
};
|
16366
16147
|
prepareSQLitePush = async (config, snapshot) => {
|
16367
16148
|
const schemaPath = config.schema;
|
16368
|
-
|
16369
|
-
|
16370
|
-
|
16371
|
-
|
16372
|
-
|
16373
|
-
|
16374
|
-
|
16375
|
-
|
16376
|
-
|
16377
|
-
|
16378
|
-
|
16379
|
-
|
16380
|
-
|
16381
|
-
|
16382
|
-
|
16383
|
-
|
16384
|
-
|
16385
|
-
|
16386
|
-
|
16149
|
+
try {
|
16150
|
+
const { prev, cur } = await prepareSQLiteDbPushSnapshot(
|
16151
|
+
snapshot,
|
16152
|
+
schemaPath
|
16153
|
+
);
|
16154
|
+
const validatedPrev = sqliteSchema.parse(prev);
|
16155
|
+
const validatedCur = sqliteSchema.parse(cur);
|
16156
|
+
const squashedPrev = squashSqliteScheme(validatedPrev);
|
16157
|
+
const squashedCur = squashSqliteScheme(validatedCur);
|
16158
|
+
const { sqlStatements, statements, _meta } = await prepareSQL(
|
16159
|
+
squashedPrev,
|
16160
|
+
squashedCur,
|
16161
|
+
"sqlite",
|
16162
|
+
validatedPrev,
|
16163
|
+
validatedCur
|
16164
|
+
);
|
16165
|
+
return {
|
16166
|
+
sqlStatements,
|
16167
|
+
statements,
|
16168
|
+
squashedPrev,
|
16169
|
+
squashedCur,
|
16170
|
+
meta: _meta
|
16171
|
+
};
|
16172
|
+
} catch (e) {
|
16173
|
+
console.error(e);
|
16174
|
+
}
|
16387
16175
|
};
|
16388
16176
|
preparePgPush = async (config, snapshot, schemaFilter) => {
|
16389
16177
|
const schemaPath = config.schema;
|
16390
|
-
|
16391
|
-
|
16392
|
-
|
16393
|
-
|
16394
|
-
|
16395
|
-
|
16396
|
-
|
16397
|
-
|
16398
|
-
|
16399
|
-
|
16400
|
-
|
16401
|
-
|
16402
|
-
|
16403
|
-
|
16404
|
-
|
16405
|
-
|
16406
|
-
|
16178
|
+
try {
|
16179
|
+
const { prev, cur } = await preparePgDbPushSnapshot(
|
16180
|
+
snapshot,
|
16181
|
+
schemaPath,
|
16182
|
+
schemaFilter
|
16183
|
+
);
|
16184
|
+
const validatedPrev = pgSchema.parse(prev);
|
16185
|
+
const validatedCur = pgSchema.parse(cur);
|
16186
|
+
const squashedPrev = squashPgScheme(validatedPrev);
|
16187
|
+
const squashedCur = squashPgScheme(validatedCur);
|
16188
|
+
const { sqlStatements, statements } = await prepareSQL(
|
16189
|
+
squashedPrev,
|
16190
|
+
squashedCur,
|
16191
|
+
"pg",
|
16192
|
+
validatedPrev,
|
16193
|
+
validatedCur
|
16194
|
+
);
|
16195
|
+
return { sqlStatements, statements, squashedPrev, squashedCur };
|
16196
|
+
} catch (e) {
|
16197
|
+
console.error(e);
|
16198
|
+
}
|
16407
16199
|
};
|
16408
16200
|
prepareAndMigrateMySql = async (config) => {
|
16409
16201
|
const outFolder = config.out;
|