drizzle-kit 0.20.14-a77266f → 0.20.14-f5f86f6
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +2188 -2401
- package/cli/commands/check.d.ts +2 -0
- package/cli/commands/drop.d.ts +4 -0
- 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/push.d.ts +6 -0
- package/cli/commands/sqlitePushUtils.d.ts +3 -3
- package/cli/commands/sqliteUp.d.ts +2 -0
- package/cli/commands/upFolders.d.ts +1 -1
- package/cli/commands/utils.d.ts +11 -2
- package/cli/index.d.ts +71 -0
- package/cli/utils.d.ts +12 -0
- package/cli/validations/common.d.ts +1 -1
- package/cli/validations/sqlite.d.ts +220 -0
- package/cli/validations/studio.d.ts +593 -0
- package/cli/views.d.ts +1 -1
- package/orm-extenstions/d1-driver/driver.d.ts +8 -0
- package/orm-extenstions/d1-driver/session.d.ts +51 -0
- package/orm-extenstions/d1-driver/wrangler-client.d.ts +3 -0
- package/package.json +1 -1
- package/payload.js +276 -68
- package/payload.mjs +276 -68
- package/schemaValidator.d.ts +1 -1
- package/serializer/mysqlSerializer.d.ts +2 -2
- package/serializer/sqliteSerializer.d.ts +2 -2
- package/serializer/studioUtils.d.ts +65 -0
- package/utils/certs.d.ts +4 -0
- package/utils-studio.js +11 -6
- package/utils-studio.mjs +11 -6
- package/utils.js +26 -12
- package/utils.mjs +26 -12
package/payload.mjs
CHANGED
@@ -2103,7 +2103,7 @@ ${withStyle.errorWarning(
|
|
2103
2103
|
--end;
|
2104
2104
|
return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
|
2105
2105
|
};
|
2106
|
-
fromDatabase2 = async (db, tablesFilter = (
|
2106
|
+
fromDatabase2 = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
|
2107
2107
|
const result = {};
|
2108
2108
|
const internals = { tables: {} };
|
2109
2109
|
const where = schemaFilters.map((t) => `table_schema = '${t}'`).join(" or ");
|
@@ -6178,6 +6178,226 @@ var init_lib = __esm({
|
|
6178
6178
|
}
|
6179
6179
|
});
|
6180
6180
|
|
6181
|
+
// src/cli/validations/common.ts
|
6182
|
+
var init_common = __esm({
|
6183
|
+
"src/cli/validations/common.ts"() {
|
6184
|
+
init_outputs();
|
6185
|
+
}
|
6186
|
+
});
|
6187
|
+
|
6188
|
+
// src/cli/validations/mysql.ts
|
6189
|
+
var mysqlConnectionCli, mysql2credentials, mysqlConnectionConfig, mysqlConfigIntrospectSchema, mysqlCliIntrospectParams, mysqlCliPushParams, mysqlConfigPushParams;
|
6190
|
+
var init_mysql = __esm({
|
6191
|
+
"src/cli/validations/mysql.ts"() {
|
6192
|
+
init_lib();
|
6193
|
+
init_utils();
|
6194
|
+
init_common();
|
6195
|
+
init_outputs();
|
6196
|
+
mysqlConnectionCli = unionType([
|
6197
|
+
objectType({
|
6198
|
+
driver: literalType("mysql2"),
|
6199
|
+
host: stringType(),
|
6200
|
+
port: coerce.number().optional(),
|
6201
|
+
user: stringType().default("mysql"),
|
6202
|
+
password: stringType().optional(),
|
6203
|
+
database: stringType()
|
6204
|
+
}),
|
6205
|
+
objectType({
|
6206
|
+
driver: literalType("mysql2"),
|
6207
|
+
uri: stringType()
|
6208
|
+
// TODO: change docs
|
6209
|
+
})
|
6210
|
+
]);
|
6211
|
+
mysql2credentials = unionType([
|
6212
|
+
objectType({
|
6213
|
+
host: stringType(),
|
6214
|
+
port: coerce.number().optional(),
|
6215
|
+
user: stringType().default("mysql"),
|
6216
|
+
password: stringType().optional(),
|
6217
|
+
database: stringType()
|
6218
|
+
}),
|
6219
|
+
objectType({
|
6220
|
+
uri: stringType()
|
6221
|
+
// TODO: change docs
|
6222
|
+
})
|
6223
|
+
]);
|
6224
|
+
mysqlConnectionConfig = objectType({
|
6225
|
+
driver: literalType("mysql2"),
|
6226
|
+
dbCredentials: mysql2credentials
|
6227
|
+
});
|
6228
|
+
mysqlConfigIntrospectSchema = intersectionType(
|
6229
|
+
configIntrospectSchema,
|
6230
|
+
mysqlConnectionConfig
|
6231
|
+
);
|
6232
|
+
mysqlCliIntrospectParams = intersectionType(
|
6233
|
+
configIntrospectCliSchema,
|
6234
|
+
mysqlConnectionCli
|
6235
|
+
);
|
6236
|
+
mysqlCliPushParams = intersectionType(
|
6237
|
+
configPushSchema,
|
6238
|
+
mysqlConnectionCli
|
6239
|
+
);
|
6240
|
+
mysqlConfigPushParams = intersectionType(
|
6241
|
+
configPushSchema,
|
6242
|
+
mysqlConnectionConfig
|
6243
|
+
);
|
6244
|
+
}
|
6245
|
+
});
|
6246
|
+
|
6247
|
+
// src/cli/validations/pg.ts
|
6248
|
+
var pgConnectionCli, pgConnectionConfig, pgConfigIntrospectSchema, pgCliIntrospectParams, pgCliPushParams, pgConfigPushParams;
|
6249
|
+
var init_pg = __esm({
|
6250
|
+
"src/cli/validations/pg.ts"() {
|
6251
|
+
init_lib();
|
6252
|
+
init_utils();
|
6253
|
+
init_common();
|
6254
|
+
init_outputs();
|
6255
|
+
pgConnectionCli = unionType([
|
6256
|
+
objectType({
|
6257
|
+
driver: literalType("pg"),
|
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")
|
6265
|
+
}),
|
6266
|
+
objectType({
|
6267
|
+
driver: literalType("pg"),
|
6268
|
+
connectionString: stringType(),
|
6269
|
+
type: literalType("url").default("url")
|
6270
|
+
})
|
6271
|
+
]);
|
6272
|
+
pgConnectionConfig = unionType([
|
6273
|
+
objectType({
|
6274
|
+
driver: literalType("pg"),
|
6275
|
+
dbCredentials: objectType({
|
6276
|
+
host: stringType(),
|
6277
|
+
port: coerce.number().optional(),
|
6278
|
+
user: stringType().default("postgres"),
|
6279
|
+
password: stringType().optional(),
|
6280
|
+
database: stringType(),
|
6281
|
+
ssl: coerce.boolean().optional(),
|
6282
|
+
type: literalType("params").default("params").optional()
|
6283
|
+
})
|
6284
|
+
}),
|
6285
|
+
objectType({
|
6286
|
+
driver: literalType("pg"),
|
6287
|
+
dbCredentials: objectType({
|
6288
|
+
connectionString: stringType(),
|
6289
|
+
type: literalType("url").default("url").optional()
|
6290
|
+
})
|
6291
|
+
})
|
6292
|
+
]);
|
6293
|
+
pgConfigIntrospectSchema = intersectionType(
|
6294
|
+
configIntrospectSchema,
|
6295
|
+
pgConnectionConfig
|
6296
|
+
);
|
6297
|
+
pgCliIntrospectParams = intersectionType(
|
6298
|
+
configIntrospectCliSchema,
|
6299
|
+
pgConnectionCli
|
6300
|
+
);
|
6301
|
+
pgCliPushParams = intersectionType(
|
6302
|
+
configPushSchema,
|
6303
|
+
pgConnectionCli
|
6304
|
+
);
|
6305
|
+
pgConfigPushParams = intersectionType(
|
6306
|
+
configPushSchema,
|
6307
|
+
pgConnectionConfig
|
6308
|
+
);
|
6309
|
+
}
|
6310
|
+
});
|
6311
|
+
|
6312
|
+
// src/cli/commands/sqliteUtils.ts
|
6313
|
+
var sqliteConnectionSchema, sqliteCliConfigSchema;
|
6314
|
+
var init_sqliteUtils = __esm({
|
6315
|
+
"src/cli/commands/sqliteUtils.ts"() {
|
6316
|
+
init_lib();
|
6317
|
+
init_utils();
|
6318
|
+
sqliteConnectionSchema = unionType([
|
6319
|
+
objectType({
|
6320
|
+
driver: literalType("turso"),
|
6321
|
+
dbCredentials: objectType({
|
6322
|
+
url: stringType(),
|
6323
|
+
authToken: stringType().optional()
|
6324
|
+
})
|
6325
|
+
}),
|
6326
|
+
objectType({
|
6327
|
+
driver: literalType("libsql"),
|
6328
|
+
dbCredentials: objectType({
|
6329
|
+
url: stringType()
|
6330
|
+
})
|
6331
|
+
}),
|
6332
|
+
objectType({
|
6333
|
+
driver: literalType("better-sqlite"),
|
6334
|
+
dbCredentials: objectType({
|
6335
|
+
url: stringType()
|
6336
|
+
})
|
6337
|
+
})
|
6338
|
+
]);
|
6339
|
+
sqliteCliConfigSchema = intersectionType(
|
6340
|
+
configIntrospectSchema,
|
6341
|
+
sqliteConnectionSchema
|
6342
|
+
);
|
6343
|
+
}
|
6344
|
+
});
|
6345
|
+
|
6346
|
+
// src/cli/validations/sqlite.ts
|
6347
|
+
var sqliteConnectionCli, sqliteCliIntrospectParams, sqliteCliPushParams, sqliteConfigPushParams;
|
6348
|
+
var init_sqlite = __esm({
|
6349
|
+
"src/cli/validations/sqlite.ts"() {
|
6350
|
+
init_lib();
|
6351
|
+
init_sqliteUtils();
|
6352
|
+
init_utils();
|
6353
|
+
init_common();
|
6354
|
+
init_outputs();
|
6355
|
+
sqliteConnectionCli = unionType([
|
6356
|
+
objectType({
|
6357
|
+
driver: literalType("turso"),
|
6358
|
+
url: stringType(),
|
6359
|
+
authToken: stringType()
|
6360
|
+
}),
|
6361
|
+
objectType({
|
6362
|
+
driver: literalType("better-sqlite"),
|
6363
|
+
url: stringType()
|
6364
|
+
}),
|
6365
|
+
objectType({
|
6366
|
+
driver: literalType("libsql"),
|
6367
|
+
url: stringType()
|
6368
|
+
})
|
6369
|
+
]);
|
6370
|
+
sqliteCliIntrospectParams = intersectionType(
|
6371
|
+
configIntrospectCliSchema,
|
6372
|
+
sqliteConnectionCli
|
6373
|
+
);
|
6374
|
+
sqliteCliPushParams = intersectionType(
|
6375
|
+
configPushSchema,
|
6376
|
+
sqliteConnectionCli
|
6377
|
+
);
|
6378
|
+
sqliteConfigPushParams = intersectionType(
|
6379
|
+
configPushSchema,
|
6380
|
+
sqliteConnectionSchema
|
6381
|
+
);
|
6382
|
+
}
|
6383
|
+
});
|
6384
|
+
|
6385
|
+
// src/global.ts
|
6386
|
+
var originUUID, snapshotVersion, mapValues;
|
6387
|
+
var init_global = __esm({
|
6388
|
+
"src/global.ts"() {
|
6389
|
+
originUUID = "00000000-0000-0000-0000-000000000000";
|
6390
|
+
snapshotVersion = "5";
|
6391
|
+
mapValues = (obj, map) => {
|
6392
|
+
const result = Object.keys(obj).reduce(function(result2, key) {
|
6393
|
+
result2[key] = map(obj[key]);
|
6394
|
+
return result2;
|
6395
|
+
}, {});
|
6396
|
+
return result;
|
6397
|
+
};
|
6398
|
+
}
|
6399
|
+
});
|
6400
|
+
|
6181
6401
|
// src/cli/commands/_es5.ts
|
6182
6402
|
var es5_exports = {};
|
6183
6403
|
__export(es5_exports, {
|
@@ -11805,6 +12025,13 @@ var init_utils = __esm({
|
|
11805
12025
|
init_source();
|
11806
12026
|
init_views();
|
11807
12027
|
import_hanji2 = __toESM(require_hanji());
|
12028
|
+
init_mysql();
|
12029
|
+
init_pg();
|
12030
|
+
init_sqlite();
|
12031
|
+
init_outputs();
|
12032
|
+
init_pg();
|
12033
|
+
init_sqlite();
|
12034
|
+
init_global();
|
11808
12035
|
assertES5 = async (unregister) => {
|
11809
12036
|
try {
|
11810
12037
|
init_es5();
|
@@ -11975,22 +12202,6 @@ var init_pgImports = __esm({
|
|
11975
12202
|
}
|
11976
12203
|
});
|
11977
12204
|
|
11978
|
-
// src/global.ts
|
11979
|
-
var originUUID, snapshotVersion, mapValues;
|
11980
|
-
var init_global = __esm({
|
11981
|
-
"src/global.ts"() {
|
11982
|
-
originUUID = "00000000-0000-0000-0000-000000000000";
|
11983
|
-
snapshotVersion = "5";
|
11984
|
-
mapValues = (obj, map) => {
|
11985
|
-
const result = Object.keys(obj).reduce(function(result2, key) {
|
11986
|
-
result2[key] = map(obj[key]);
|
11987
|
-
return result2;
|
11988
|
-
}, {});
|
11989
|
-
return result;
|
11990
|
-
};
|
11991
|
-
}
|
11992
|
-
});
|
11993
|
-
|
11994
12205
|
// src/serializer/pgSchema.ts
|
11995
12206
|
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;
|
11996
12207
|
var init_pgSchema = __esm({
|
@@ -12484,9 +12695,12 @@ var init_sqliteSchema = __esm({
|
|
12484
12695
|
const squashedPKs = mapValues(it[1].compositePrimaryKeys, (pk) => {
|
12485
12696
|
return SQLiteSquasher.squashPK(pk);
|
12486
12697
|
});
|
12487
|
-
const squashedUniqueConstraints = mapValues(
|
12488
|
-
|
12489
|
-
|
12698
|
+
const squashedUniqueConstraints = mapValues(
|
12699
|
+
it[1].uniqueConstraints,
|
12700
|
+
(unq) => {
|
12701
|
+
return SQLiteSquasher.squashUnique(unq);
|
12702
|
+
}
|
12703
|
+
);
|
12490
12704
|
return [
|
12491
12705
|
it[0],
|
12492
12706
|
{
|
@@ -12520,7 +12734,11 @@ var init_sqliteSchema = __esm({
|
|
12520
12734
|
}
|
12521
12735
|
});
|
12522
12736
|
sqliteSchema = schema2;
|
12523
|
-
backwardCompatibleSqliteSchema = unionType([
|
12737
|
+
backwardCompatibleSqliteSchema = unionType([
|
12738
|
+
schemaV3,
|
12739
|
+
schemaV4,
|
12740
|
+
schema2
|
12741
|
+
]);
|
12524
12742
|
}
|
12525
12743
|
});
|
12526
12744
|
|
@@ -16170,60 +16388,50 @@ var init_migrate = __esm({
|
|
16170
16388
|
return { sqlStatements, statements, validatedCur, validatedPrev };
|
16171
16389
|
} catch (e) {
|
16172
16390
|
console.error(e);
|
16391
|
+
process.exit(1);
|
16173
16392
|
}
|
16174
16393
|
};
|
16175
16394
|
prepareSQLitePush = async (config, snapshot) => {
|
16176
16395
|
const schemaPath = config.schema;
|
16177
|
-
|
16178
|
-
|
16179
|
-
|
16180
|
-
|
16181
|
-
|
16182
|
-
|
16183
|
-
|
16184
|
-
|
16185
|
-
|
16186
|
-
|
16187
|
-
|
16188
|
-
|
16189
|
-
|
16190
|
-
|
16191
|
-
|
16192
|
-
|
16193
|
-
|
16194
|
-
|
16195
|
-
|
16196
|
-
squashedPrev,
|
16197
|
-
squashedCur,
|
16198
|
-
meta: _meta
|
16199
|
-
};
|
16200
|
-
} catch (e) {
|
16201
|
-
console.error(e);
|
16202
|
-
}
|
16396
|
+
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath);
|
16397
|
+
const validatedPrev = sqliteSchema.parse(prev);
|
16398
|
+
const validatedCur = sqliteSchema.parse(cur);
|
16399
|
+
const squashedPrev = squashSqliteScheme(validatedPrev);
|
16400
|
+
const squashedCur = squashSqliteScheme(validatedCur);
|
16401
|
+
const { sqlStatements, statements, _meta } = await prepareSQL(
|
16402
|
+
squashedPrev,
|
16403
|
+
squashedCur,
|
16404
|
+
"sqlite",
|
16405
|
+
validatedPrev,
|
16406
|
+
validatedCur
|
16407
|
+
);
|
16408
|
+
return {
|
16409
|
+
sqlStatements,
|
16410
|
+
statements,
|
16411
|
+
squashedPrev,
|
16412
|
+
squashedCur,
|
16413
|
+
meta: _meta
|
16414
|
+
};
|
16203
16415
|
};
|
16204
16416
|
preparePgPush = async (config, snapshot, schemaFilter) => {
|
16205
16417
|
const schemaPath = config.schema;
|
16206
|
-
|
16207
|
-
|
16208
|
-
|
16209
|
-
|
16210
|
-
|
16211
|
-
|
16212
|
-
|
16213
|
-
|
16214
|
-
|
16215
|
-
|
16216
|
-
|
16217
|
-
|
16218
|
-
|
16219
|
-
|
16220
|
-
|
16221
|
-
|
16222
|
-
|
16223
|
-
return { sqlStatements, statements, squashedPrev, squashedCur };
|
16224
|
-
} catch (e) {
|
16225
|
-
console.error(e);
|
16226
|
-
}
|
16418
|
+
const { prev, cur } = await preparePgDbPushSnapshot(
|
16419
|
+
snapshot,
|
16420
|
+
schemaPath,
|
16421
|
+
schemaFilter
|
16422
|
+
);
|
16423
|
+
const validatedPrev = pgSchema.parse(prev);
|
16424
|
+
const validatedCur = pgSchema.parse(cur);
|
16425
|
+
const squashedPrev = squashPgScheme(validatedPrev);
|
16426
|
+
const squashedCur = squashPgScheme(validatedCur);
|
16427
|
+
const { sqlStatements, statements } = await prepareSQL(
|
16428
|
+
squashedPrev,
|
16429
|
+
squashedCur,
|
16430
|
+
"pg",
|
16431
|
+
validatedPrev,
|
16432
|
+
validatedCur
|
16433
|
+
);
|
16434
|
+
return { sqlStatements, statements, squashedPrev, squashedCur };
|
16227
16435
|
};
|
16228
16436
|
prepareAndMigrateMySql = async (config) => {
|
16229
16437
|
const outFolder = config.out;
|
package/schemaValidator.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { TypeOf } from "zod";
|
2
|
-
declare const dialect: import("zod").ZodEnum<["pg", "mysql", "sqlite"]>;
|
2
|
+
export declare const dialect: import("zod").ZodEnum<["pg", "mysql", "sqlite"]>;
|
3
3
|
export type Dialect = TypeOf<typeof dialect>;
|
4
4
|
declare const commonSquashedSchema: import("zod").ZodUnion<[import("zod").ZodObject<{
|
5
5
|
version: import("zod").ZodLiteral<"5">;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { AnyMySqlTable, MySqlSchema } from "drizzle-orm/mysql-core";
|
2
|
-
import { MySqlSchemaInternal } from "
|
3
|
-
import { IntrospectStage, IntrospectStatus } from "
|
2
|
+
import { MySqlSchemaInternal } from "../serializer/mysqlSchema";
|
3
|
+
import { IntrospectStage, IntrospectStatus } from "../cli/views";
|
4
4
|
import { DrizzleDbClient } from "src/drivers";
|
5
5
|
export declare const indexName: (tableName: string, columns: string[]) => string;
|
6
6
|
export declare const generateMySqlSnapshot: (tables: AnyMySqlTable[], enums: any[], mysqlSchemas: MySqlSchema[]) => MySqlSchemaInternal;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { SQLiteSchemaInternal } from "../serializer/sqliteSchema";
|
2
2
|
import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
3
|
-
import type { IntrospectStage, IntrospectStatus } from "
|
4
|
-
import type { DrizzleDbClient } from "
|
3
|
+
import type { IntrospectStage, IntrospectStatus } from "../cli/views";
|
4
|
+
import type { DrizzleDbClient } from "../drivers";
|
5
5
|
export declare const generateSqliteSnapshot: (tables: AnySQLiteTable[], enums: any[]) => SQLiteSchemaInternal;
|
6
6
|
export declare const fromDatabase: (db: DrizzleDbClient, tablesFilter?: (table: string) => boolean, progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<SQLiteSchemaInternal>;
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import type { Setup } from "@drizzle-team/studio";
|
2
|
+
import { Relations } from "drizzle-orm";
|
3
|
+
import { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
4
|
+
import { AnyPgTable } from "drizzle-orm/pg-core";
|
5
|
+
import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
6
|
+
import { MySQLConnectionConfig } from "../cli/validations/mysql";
|
7
|
+
import { PgConnectionConfig } from "../cli/validations/pg";
|
8
|
+
import { StudioConfigConnections, StudioSqliteConnectionConfig as StudioSQLiteConnectionConfig } from "../cli/validations/studio";
|
9
|
+
export declare const preparePgSchema: (path: string | string[]) => Promise<{
|
10
|
+
schema: Record<string, Record<string, AnyPgTable<{}>>>;
|
11
|
+
relations: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
12
|
+
}>;
|
13
|
+
export declare const prepareMySqlSchema: (path: string | string[]) => Promise<{
|
14
|
+
schema: Record<string, Record<string, AnyMySqlTable<{}>>>;
|
15
|
+
relations: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
16
|
+
}>;
|
17
|
+
export declare const prepareSQLiteSchema: (path: string | string[]) => Promise<{
|
18
|
+
schema: Record<string, Record<string, AnySQLiteTable<{}>>>;
|
19
|
+
relations: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
20
|
+
}>;
|
21
|
+
export declare const prepareModels: (path: string | string[]) => Promise<{
|
22
|
+
pgSchema: Record<string, AnyPgTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
23
|
+
mysqlSchema: Record<string, AnyMySqlTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
24
|
+
sqliteSchema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>>;
|
25
|
+
}>;
|
26
|
+
export declare const drizzleForPostgres: (connectionConfig: PgConnectionConfig, pgSchema: Record<string, Record<string, AnyPgTable>>, relations: Record<string, Relations>, ts: {
|
27
|
+
imports: string;
|
28
|
+
declarations: string;
|
29
|
+
schemaEntry: string;
|
30
|
+
}, verbose: boolean) => Promise<Setup>;
|
31
|
+
export declare const drizzleForMySQL: (config: MySQLConnectionConfig, mysqlSchema: Record<string, Record<string, AnyMySqlTable>>, relations: Record<string, Relations>, ts: {
|
32
|
+
imports: string;
|
33
|
+
declarations: string;
|
34
|
+
schemaEntry: string;
|
35
|
+
}, verbose: boolean) => Promise<Setup>;
|
36
|
+
export declare const drizzleForSQLite: (config: StudioSQLiteConnectionConfig, sqliteSchema: Record<string, Record<string, AnySQLiteTable>>, relations: Record<string, Relations>, ts: {
|
37
|
+
imports: string;
|
38
|
+
declarations: string;
|
39
|
+
schemaEntry: string;
|
40
|
+
}, verbose: boolean) => Promise<Setup>;
|
41
|
+
export declare const drizzleDb: (drizzleConfig: StudioConfigConnections, models: {
|
42
|
+
pgSchema?: Record<string, AnyPgTable | Relations>;
|
43
|
+
mysqlSchema?: Record<string, AnyMySqlTable | Relations>;
|
44
|
+
sqliteSchema?: Record<string, AnySQLiteTable | Relations>;
|
45
|
+
}, logger: boolean) => Promise<{
|
46
|
+
db: import("drizzle-orm/node-postgres").NodePgDatabase<Record<string, never>>;
|
47
|
+
type: "pg";
|
48
|
+
schema: Record<string, AnyPgTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
49
|
+
} | {
|
50
|
+
db: import("drizzle-orm/mysql2").MySql2Database<Record<string, never>>;
|
51
|
+
type: "mysql";
|
52
|
+
schema: Record<string, AnyMySqlTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
53
|
+
} | {
|
54
|
+
db: import("../orm-extenstions/d1-driver/driver").DrizzleD1WranglerDatabase<Record<string, never>>;
|
55
|
+
type: "sqlite";
|
56
|
+
schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
|
57
|
+
} | {
|
58
|
+
db: import("drizzle-orm/better-sqlite3").BetterSQLite3Database<Record<string, never>>;
|
59
|
+
type: "sqlite";
|
60
|
+
schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
|
61
|
+
} | {
|
62
|
+
db: import("drizzle-orm/libsql").LibSQLDatabase<Record<string, never>>;
|
63
|
+
type: "sqlite";
|
64
|
+
schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
|
65
|
+
}>;
|
package/utils/certs.d.ts
ADDED
package/utils-studio.js
CHANGED
@@ -1081,6 +1081,14 @@ var init_views = __esm({
|
|
1081
1081
|
}
|
1082
1082
|
});
|
1083
1083
|
|
1084
|
+
// src/global.ts
|
1085
|
+
var originUUID;
|
1086
|
+
var init_global = __esm({
|
1087
|
+
"src/global.ts"() {
|
1088
|
+
originUUID = "00000000-0000-0000-0000-000000000000";
|
1089
|
+
}
|
1090
|
+
});
|
1091
|
+
|
1084
1092
|
// src/serializer/index.ts
|
1085
1093
|
var glob;
|
1086
1094
|
var init_serializer = __esm({
|
@@ -1571,7 +1579,7 @@ var init_pgSerializer = __esm({
|
|
1571
1579
|
--end;
|
1572
1580
|
return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
|
1573
1581
|
};
|
1574
|
-
fromDatabase2 = async (db, tablesFilter = (
|
1582
|
+
fromDatabase2 = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
|
1575
1583
|
const result = {};
|
1576
1584
|
const internals = { tables: {} };
|
1577
1585
|
const where = schemaFilters.map((t) => `table_schema = '${t}'`).join(" or ");
|
@@ -2166,11 +2174,7 @@ var sqliteSchemaToDrizzle = (schema) => {
|
|
2166
2174
|
|
2167
2175
|
// src/cli/commands/sqliteIntrospect.ts
|
2168
2176
|
init_views();
|
2169
|
-
|
2170
|
-
// src/global.ts
|
2171
|
-
var originUUID = "00000000-0000-0000-0000-000000000000";
|
2172
|
-
|
2173
|
-
// src/cli/commands/sqliteIntrospect.ts
|
2177
|
+
init_global();
|
2174
2178
|
init_sqliteSerializer();
|
2175
2179
|
|
2176
2180
|
// node_modules/.pnpm/camelcase@7.0.1/node_modules/camelcase/index.js
|
@@ -3356,6 +3360,7 @@ var import_relations = require("drizzle-orm/relations");
|
|
3356
3360
|
init_pgSerializer();
|
3357
3361
|
|
3358
3362
|
// src/cli/commands/pgIntrospect.ts
|
3363
|
+
init_global();
|
3359
3364
|
var pgPushIntrospect = async (connection, filters, schemaFilters) => {
|
3360
3365
|
const { client } = connection;
|
3361
3366
|
const matchers = filters.map((it) => {
|
package/utils-studio.mjs
CHANGED
@@ -1083,6 +1083,14 @@ var init_views = __esm({
|
|
1083
1083
|
}
|
1084
1084
|
});
|
1085
1085
|
|
1086
|
+
// src/global.ts
|
1087
|
+
var originUUID;
|
1088
|
+
var init_global = __esm({
|
1089
|
+
"src/global.ts"() {
|
1090
|
+
originUUID = "00000000-0000-0000-0000-000000000000";
|
1091
|
+
}
|
1092
|
+
});
|
1093
|
+
|
1086
1094
|
// src/serializer/index.ts
|
1087
1095
|
import * as glob from "glob";
|
1088
1096
|
var init_serializer = __esm({
|
@@ -1580,7 +1588,7 @@ var init_pgSerializer = __esm({
|
|
1580
1588
|
--end;
|
1581
1589
|
return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
|
1582
1590
|
};
|
1583
|
-
fromDatabase2 = async (db, tablesFilter = (
|
1591
|
+
fromDatabase2 = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
|
1584
1592
|
const result = {};
|
1585
1593
|
const internals = { tables: {} };
|
1586
1594
|
const where = schemaFilters.map((t) => `table_schema = '${t}'`).join(" or ");
|
@@ -2200,11 +2208,7 @@ var sqliteSchemaToDrizzle = (schema) => {
|
|
2200
2208
|
|
2201
2209
|
// src/cli/commands/sqliteIntrospect.ts
|
2202
2210
|
init_views();
|
2203
|
-
|
2204
|
-
// src/global.ts
|
2205
|
-
var originUUID = "00000000-0000-0000-0000-000000000000";
|
2206
|
-
|
2207
|
-
// src/cli/commands/sqliteIntrospect.ts
|
2211
|
+
init_global();
|
2208
2212
|
init_sqliteSerializer();
|
2209
2213
|
|
2210
2214
|
// node_modules/.pnpm/camelcase@7.0.1/node_modules/camelcase/index.js
|
@@ -3395,6 +3399,7 @@ import {
|
|
3395
3399
|
init_pgSerializer();
|
3396
3400
|
|
3397
3401
|
// src/cli/commands/pgIntrospect.ts
|
3402
|
+
init_global();
|
3398
3403
|
var pgPushIntrospect = async (connection, filters, schemaFilters) => {
|
3399
3404
|
const { client } = connection;
|
3400
3405
|
const matchers = filters.map((it) => {
|
package/utils.js
CHANGED
@@ -1086,6 +1086,22 @@ var init_views = __esm({
|
|
1086
1086
|
}
|
1087
1087
|
});
|
1088
1088
|
|
1089
|
+
// src/global.ts
|
1090
|
+
var originUUID, snapshotVersion, mapValues;
|
1091
|
+
var init_global = __esm({
|
1092
|
+
"src/global.ts"() {
|
1093
|
+
originUUID = "00000000-0000-0000-0000-000000000000";
|
1094
|
+
snapshotVersion = "5";
|
1095
|
+
mapValues = (obj, map) => {
|
1096
|
+
const result = Object.keys(obj).reduce(function(result2, key) {
|
1097
|
+
result2[key] = map(obj[key]);
|
1098
|
+
return result2;
|
1099
|
+
}, {});
|
1100
|
+
return result;
|
1101
|
+
};
|
1102
|
+
}
|
1103
|
+
});
|
1104
|
+
|
1089
1105
|
// node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
|
1090
1106
|
function getErrorMap() {
|
1091
1107
|
return overrideErrorMap;
|
@@ -4262,18 +4278,8 @@ module.exports = __toCommonJS(utils_exports);
|
|
4262
4278
|
var import_fs = require("fs");
|
4263
4279
|
init_views();
|
4264
4280
|
|
4265
|
-
// src/global.ts
|
4266
|
-
var originUUID = "00000000-0000-0000-0000-000000000000";
|
4267
|
-
var snapshotVersion = "5";
|
4268
|
-
var mapValues = (obj, map) => {
|
4269
|
-
const result = Object.keys(obj).reduce(function(result2, key) {
|
4270
|
-
result2[key] = map(obj[key]);
|
4271
|
-
return result2;
|
4272
|
-
}, {});
|
4273
|
-
return result;
|
4274
|
-
};
|
4275
|
-
|
4276
4281
|
// src/serializer/mysqlSchema.ts
|
4282
|
+
init_global();
|
4277
4283
|
init_lib();
|
4278
4284
|
var index = objectType({
|
4279
4285
|
name: stringType(),
|
@@ -4478,6 +4484,7 @@ var dryMySql = mysqlSchema.parse({
|
|
4478
4484
|
});
|
4479
4485
|
|
4480
4486
|
// src/serializer/pgSchema.ts
|
4487
|
+
init_global();
|
4481
4488
|
init_lib();
|
4482
4489
|
var indexV2 = objectType({
|
4483
4490
|
name: stringType(),
|
@@ -4804,6 +4811,7 @@ var dryPg = pgSchema.parse({
|
|
4804
4811
|
});
|
4805
4812
|
|
4806
4813
|
// src/serializer/sqliteSchema.ts
|
4814
|
+
init_global();
|
4807
4815
|
init_lib();
|
4808
4816
|
var index3 = objectType({
|
4809
4817
|
name: stringType(),
|
@@ -4960,11 +4968,16 @@ var drySQLite = schema2.parse({
|
|
4960
4968
|
columns: {}
|
4961
4969
|
}
|
4962
4970
|
});
|
4963
|
-
var backwardCompatibleSqliteSchema = unionType([
|
4971
|
+
var backwardCompatibleSqliteSchema = unionType([
|
4972
|
+
schemaV32,
|
4973
|
+
schemaV42,
|
4974
|
+
schema2
|
4975
|
+
]);
|
4964
4976
|
|
4965
4977
|
// src/utils.ts
|
4966
4978
|
init_source();
|
4967
4979
|
var import_path = require("path");
|
4980
|
+
init_global();
|
4968
4981
|
|
4969
4982
|
// src/jsonDiffer.js
|
4970
4983
|
var import_json_diff = require("json-diff");
|
@@ -7711,6 +7724,7 @@ var applySnapshotsDiff = async (json1, json2, dialect3, schemasResolver, tablesR
|
|
7711
7724
|
|
7712
7725
|
// src/cli/commands/pgUp.ts
|
7713
7726
|
init_source();
|
7727
|
+
init_global();
|
7714
7728
|
|
7715
7729
|
// src/cli/commands/mysqlUp.ts
|
7716
7730
|
init_source();
|