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
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 = () => true, schemaFilters, progressCallback) => {
|
2106
|
+
fromDatabase2 = async (db, tablesFilter = (table4) => 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,226 +6178,6 @@ 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
|
-
|
6401
6181
|
// src/cli/commands/_es5.ts
|
6402
6182
|
var es5_exports = {};
|
6403
6183
|
__export(es5_exports, {
|
@@ -12025,13 +11805,6 @@ var init_utils = __esm({
|
|
12025
11805
|
init_source();
|
12026
11806
|
init_views();
|
12027
11807
|
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();
|
12035
11808
|
assertES5 = async (unregister) => {
|
12036
11809
|
try {
|
12037
11810
|
init_es5();
|
@@ -12202,6 +11975,22 @@ var init_pgImports = __esm({
|
|
12202
11975
|
}
|
12203
11976
|
});
|
12204
11977
|
|
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
|
+
|
12205
11994
|
// src/serializer/pgSchema.ts
|
12206
11995
|
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;
|
12207
11996
|
var init_pgSchema = __esm({
|
@@ -12695,12 +12484,9 @@ var init_sqliteSchema = __esm({
|
|
12695
12484
|
const squashedPKs = mapValues(it[1].compositePrimaryKeys, (pk) => {
|
12696
12485
|
return SQLiteSquasher.squashPK(pk);
|
12697
12486
|
});
|
12698
|
-
const squashedUniqueConstraints = mapValues(
|
12699
|
-
|
12700
|
-
|
12701
|
-
return SQLiteSquasher.squashUnique(unq);
|
12702
|
-
}
|
12703
|
-
);
|
12487
|
+
const squashedUniqueConstraints = mapValues(it[1].uniqueConstraints, (unq) => {
|
12488
|
+
return SQLiteSquasher.squashUnique(unq);
|
12489
|
+
});
|
12704
12490
|
return [
|
12705
12491
|
it[0],
|
12706
12492
|
{
|
@@ -12734,11 +12520,7 @@ var init_sqliteSchema = __esm({
|
|
12734
12520
|
}
|
12735
12521
|
});
|
12736
12522
|
sqliteSchema = schema2;
|
12737
|
-
backwardCompatibleSqliteSchema = unionType([
|
12738
|
-
schemaV3,
|
12739
|
-
schemaV4,
|
12740
|
-
schema2
|
12741
|
-
]);
|
12523
|
+
backwardCompatibleSqliteSchema = unionType([schemaV3, schemaV4, schema2]);
|
12742
12524
|
}
|
12743
12525
|
});
|
12744
12526
|
|
@@ -16388,50 +16170,60 @@ var init_migrate = __esm({
|
|
16388
16170
|
return { sqlStatements, statements, validatedCur, validatedPrev };
|
16389
16171
|
} catch (e) {
|
16390
16172
|
console.error(e);
|
16391
|
-
process.exit(1);
|
16392
16173
|
}
|
16393
16174
|
};
|
16394
16175
|
prepareSQLitePush = async (config, snapshot) => {
|
16395
16176
|
const schemaPath = config.schema;
|
16396
|
-
|
16397
|
-
|
16398
|
-
|
16399
|
-
|
16400
|
-
|
16401
|
-
|
16402
|
-
|
16403
|
-
|
16404
|
-
|
16405
|
-
|
16406
|
-
|
16407
|
-
|
16408
|
-
|
16409
|
-
|
16410
|
-
|
16411
|
-
|
16412
|
-
|
16413
|
-
|
16414
|
-
|
16177
|
+
try {
|
16178
|
+
const { prev, cur } = await prepareSQLiteDbPushSnapshot(
|
16179
|
+
snapshot,
|
16180
|
+
schemaPath
|
16181
|
+
);
|
16182
|
+
const validatedPrev = sqliteSchema.parse(prev);
|
16183
|
+
const validatedCur = sqliteSchema.parse(cur);
|
16184
|
+
const squashedPrev = squashSqliteScheme(validatedPrev);
|
16185
|
+
const squashedCur = squashSqliteScheme(validatedCur);
|
16186
|
+
const { sqlStatements, statements, _meta } = await prepareSQL(
|
16187
|
+
squashedPrev,
|
16188
|
+
squashedCur,
|
16189
|
+
"sqlite",
|
16190
|
+
validatedPrev,
|
16191
|
+
validatedCur
|
16192
|
+
);
|
16193
|
+
return {
|
16194
|
+
sqlStatements,
|
16195
|
+
statements,
|
16196
|
+
squashedPrev,
|
16197
|
+
squashedCur,
|
16198
|
+
meta: _meta
|
16199
|
+
};
|
16200
|
+
} catch (e) {
|
16201
|
+
console.error(e);
|
16202
|
+
}
|
16415
16203
|
};
|
16416
16204
|
preparePgPush = async (config, snapshot, schemaFilter) => {
|
16417
16205
|
const schemaPath = config.schema;
|
16418
|
-
|
16419
|
-
|
16420
|
-
|
16421
|
-
|
16422
|
-
|
16423
|
-
|
16424
|
-
|
16425
|
-
|
16426
|
-
|
16427
|
-
|
16428
|
-
|
16429
|
-
|
16430
|
-
|
16431
|
-
|
16432
|
-
|
16433
|
-
|
16434
|
-
|
16206
|
+
try {
|
16207
|
+
const { prev, cur } = await preparePgDbPushSnapshot(
|
16208
|
+
snapshot,
|
16209
|
+
schemaPath,
|
16210
|
+
schemaFilter
|
16211
|
+
);
|
16212
|
+
const validatedPrev = pgSchema.parse(prev);
|
16213
|
+
const validatedCur = pgSchema.parse(cur);
|
16214
|
+
const squashedPrev = squashPgScheme(validatedPrev);
|
16215
|
+
const squashedCur = squashPgScheme(validatedCur);
|
16216
|
+
const { sqlStatements, statements } = await prepareSQL(
|
16217
|
+
squashedPrev,
|
16218
|
+
squashedCur,
|
16219
|
+
"pg",
|
16220
|
+
validatedPrev,
|
16221
|
+
validatedCur
|
16222
|
+
);
|
16223
|
+
return { sqlStatements, statements, squashedPrev, squashedCur };
|
16224
|
+
} catch (e) {
|
16225
|
+
console.error(e);
|
16226
|
+
}
|
16435
16227
|
};
|
16436
16228
|
prepareAndMigrateMySql = async (config) => {
|
16437
16229
|
const outFolder = config.out;
|
package/schemaValidator.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { TypeOf } from "zod";
|
2
|
-
|
2
|
+
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 "src/serializer/mysqlSchema";
|
3
|
+
import { IntrospectStage, IntrospectStatus } from "src/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 "src/cli/views";
|
4
|
+
import type { DrizzleDbClient } from "src/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>;
|
package/utils-studio.js
CHANGED
@@ -1081,14 +1081,6 @@ 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
|
-
|
1092
1084
|
// src/serializer/index.ts
|
1093
1085
|
var glob;
|
1094
1086
|
var init_serializer = __esm({
|
@@ -1142,10 +1134,10 @@ function mapSqlToSqliteType(sqlType) {
|
|
1142
1134
|
return "numeric";
|
1143
1135
|
}
|
1144
1136
|
}
|
1145
|
-
var
|
1137
|
+
var import_drizzle_orm2, import_sqlite_core2, dialect, fromDatabase;
|
1146
1138
|
var init_sqliteSerializer = __esm({
|
1147
1139
|
"src/serializer/sqliteSerializer.ts"() {
|
1148
|
-
|
1140
|
+
import_drizzle_orm2 = require("drizzle-orm");
|
1149
1141
|
import_sqlite_core2 = require("drizzle-orm/sqlite-core");
|
1150
1142
|
init_serializer();
|
1151
1143
|
init_outputs();
|
@@ -1560,12 +1552,12 @@ var require_brace_expansion = __commonJS({
|
|
1560
1552
|
});
|
1561
1553
|
|
1562
1554
|
// src/serializer/pgSerializer.ts
|
1563
|
-
var import_pg_core2, import_pg_core3,
|
1555
|
+
var import_pg_core2, import_pg_core3, import_drizzle_orm3, dialect2, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
|
1564
1556
|
var init_pgSerializer = __esm({
|
1565
1557
|
"src/serializer/pgSerializer.ts"() {
|
1566
1558
|
import_pg_core2 = require("drizzle-orm/pg-core");
|
1567
1559
|
import_pg_core3 = require("drizzle-orm/pg-core");
|
1568
|
-
|
1560
|
+
import_drizzle_orm3 = require("drizzle-orm");
|
1569
1561
|
init_serializer();
|
1570
1562
|
init_source();
|
1571
1563
|
init_outputs();
|
@@ -1579,7 +1571,7 @@ var init_pgSerializer = __esm({
|
|
1579
1571
|
--end;
|
1580
1572
|
return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
|
1581
1573
|
};
|
1582
|
-
fromDatabase2 = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
|
1574
|
+
fromDatabase2 = async (db, tablesFilter = (table) => true, schemaFilters, progressCallback) => {
|
1583
1575
|
const result = {};
|
1584
1576
|
const internals = { tables: {} };
|
1585
1577
|
const where = schemaFilters.map((t) => `table_schema = '${t}'`).join(" or ");
|
@@ -1979,10 +1971,10 @@ var init_pgSerializer = __esm({
|
|
1979
1971
|
});
|
1980
1972
|
|
1981
1973
|
// src/drivers/index.ts
|
1982
|
-
var
|
1974
|
+
var import_drizzle_orm5, DrizzleDbClient, DrizzleORMPgClient, TursoSqlite;
|
1983
1975
|
var init_drivers = __esm({
|
1984
1976
|
"src/drivers/index.ts"() {
|
1985
|
-
|
1977
|
+
import_drizzle_orm5 = require("drizzle-orm");
|
1986
1978
|
DrizzleDbClient = class {
|
1987
1979
|
constructor(db) {
|
1988
1980
|
this.db = db;
|
@@ -1990,11 +1982,11 @@ var init_drivers = __esm({
|
|
1990
1982
|
};
|
1991
1983
|
DrizzleORMPgClient = class extends DrizzleDbClient {
|
1992
1984
|
async query(query, values) {
|
1993
|
-
const res = await this.db.execute(
|
1985
|
+
const res = await this.db.execute(import_drizzle_orm5.sql.raw(query));
|
1994
1986
|
return res.rows;
|
1995
1987
|
}
|
1996
1988
|
async run(query) {
|
1997
|
-
const res = await this.db.execute(
|
1989
|
+
const res = await this.db.execute(import_drizzle_orm5.sql.raw(query));
|
1998
1990
|
return res.rows;
|
1999
1991
|
}
|
2000
1992
|
};
|
@@ -2023,6 +2015,7 @@ __export(utils_studio_exports, {
|
|
2023
2015
|
module.exports = __toCommonJS(utils_studio_exports);
|
2024
2016
|
|
2025
2017
|
// src/serializer/schemaToDrizzle.ts
|
2018
|
+
var import_drizzle_orm = require("drizzle-orm");
|
2026
2019
|
var import_pg_core = require("drizzle-orm/pg-core");
|
2027
2020
|
var import_sqlite_core = require("drizzle-orm/sqlite-core");
|
2028
2021
|
var pgSchemaToDrizzle = (schema, schemaName) => {
|
@@ -2150,7 +2143,7 @@ var sqliteSchemaToDrizzle = (schema) => {
|
|
2150
2143
|
columnBuilder = columnBuilder.notNull();
|
2151
2144
|
}
|
2152
2145
|
if (c.default) {
|
2153
|
-
columnBuilder = columnBuilder.default(c.default);
|
2146
|
+
columnBuilder = columnBuilder.default(import_drizzle_orm.sql.raw(`${c.default}`));
|
2154
2147
|
}
|
2155
2148
|
if (c.primaryKey) {
|
2156
2149
|
columnBuilder = columnBuilder.primaryKey();
|
@@ -2174,7 +2167,11 @@ var sqliteSchemaToDrizzle = (schema) => {
|
|
2174
2167
|
|
2175
2168
|
// src/cli/commands/sqliteIntrospect.ts
|
2176
2169
|
init_views();
|
2177
|
-
|
2170
|
+
|
2171
|
+
// src/global.ts
|
2172
|
+
var originUUID = "00000000-0000-0000-0000-000000000000";
|
2173
|
+
|
2174
|
+
// src/cli/commands/sqliteIntrospect.ts
|
2178
2175
|
init_sqliteSerializer();
|
2179
2176
|
|
2180
2177
|
// node_modules/.pnpm/camelcase@7.0.1/node_modules/camelcase/index.js
|
@@ -3355,12 +3352,11 @@ init_views();
|
|
3355
3352
|
init_pgSerializer();
|
3356
3353
|
|
3357
3354
|
// src/introspect-pg.ts
|
3358
|
-
var
|
3355
|
+
var import_drizzle_orm4 = require("drizzle-orm");
|
3359
3356
|
var import_relations = require("drizzle-orm/relations");
|
3360
3357
|
init_pgSerializer();
|
3361
3358
|
|
3362
3359
|
// src/cli/commands/pgIntrospect.ts
|
3363
|
-
init_global();
|
3364
3360
|
var pgPushIntrospect = async (connection, filters, schemaFilters) => {
|
3365
3361
|
const { client } = connection;
|
3366
3362
|
const matchers = filters.map((it) => {
|
package/utils-studio.mjs
CHANGED
@@ -1083,14 +1083,6 @@ 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
|
-
|
1094
1086
|
// src/serializer/index.ts
|
1095
1087
|
import * as glob from "glob";
|
1096
1088
|
var init_serializer = __esm({
|
@@ -1108,7 +1100,7 @@ var init_outputs = __esm({
|
|
1108
1100
|
});
|
1109
1101
|
|
1110
1102
|
// src/serializer/sqliteSerializer.ts
|
1111
|
-
import { getTableName, is, SQL } from "drizzle-orm";
|
1103
|
+
import { getTableName, is, SQL as SQL2 } from "drizzle-orm";
|
1112
1104
|
import {
|
1113
1105
|
getTableConfig,
|
1114
1106
|
SQLiteBaseInteger,
|
@@ -1571,7 +1563,7 @@ import {
|
|
1571
1563
|
uniqueKeyName as uniqueKeyName2
|
1572
1564
|
} from "drizzle-orm/pg-core";
|
1573
1565
|
import { getTableConfig as getTableConfig2 } from "drizzle-orm/pg-core";
|
1574
|
-
import { is as is2, SQL as
|
1566
|
+
import { is as is2, SQL as SQL3, getTableName as getTableName2 } from "drizzle-orm";
|
1575
1567
|
var dialect2, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
|
1576
1568
|
var init_pgSerializer = __esm({
|
1577
1569
|
"src/serializer/pgSerializer.ts"() {
|
@@ -1588,7 +1580,7 @@ var init_pgSerializer = __esm({
|
|
1588
1580
|
--end;
|
1589
1581
|
return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
|
1590
1582
|
};
|
1591
|
-
fromDatabase2 = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
|
1583
|
+
fromDatabase2 = async (db, tablesFilter = (table) => true, schemaFilters, progressCallback) => {
|
1592
1584
|
const result = {};
|
1593
1585
|
const internals = { tables: {} };
|
1594
1586
|
const where = schemaFilters.map((t) => `table_schema = '${t}'`).join(" or ");
|
@@ -1988,7 +1980,7 @@ var init_pgSerializer = __esm({
|
|
1988
1980
|
});
|
1989
1981
|
|
1990
1982
|
// src/drivers/index.ts
|
1991
|
-
import { sql } from "drizzle-orm";
|
1983
|
+
import { sql as sql2 } from "drizzle-orm";
|
1992
1984
|
var DrizzleDbClient, DrizzleORMPgClient, TursoSqlite;
|
1993
1985
|
var init_drivers = __esm({
|
1994
1986
|
"src/drivers/index.ts"() {
|
@@ -1999,11 +1991,11 @@ var init_drivers = __esm({
|
|
1999
1991
|
};
|
2000
1992
|
DrizzleORMPgClient = class extends DrizzleDbClient {
|
2001
1993
|
async query(query, values) {
|
2002
|
-
const res = await this.db.execute(
|
1994
|
+
const res = await this.db.execute(sql2.raw(query));
|
2003
1995
|
return res.rows;
|
2004
1996
|
}
|
2005
1997
|
async run(query) {
|
2006
|
-
const res = await this.db.execute(
|
1998
|
+
const res = await this.db.execute(sql2.raw(query));
|
2007
1999
|
return res.rows;
|
2008
2000
|
}
|
2009
2001
|
};
|
@@ -2020,6 +2012,7 @@ var init_drivers = __esm({
|
|
2020
2012
|
});
|
2021
2013
|
|
2022
2014
|
// src/serializer/schemaToDrizzle.ts
|
2015
|
+
import { sql } from "drizzle-orm";
|
2023
2016
|
import {
|
2024
2017
|
customType,
|
2025
2018
|
PgBigInt53Builder,
|
@@ -2184,7 +2177,7 @@ var sqliteSchemaToDrizzle = (schema) => {
|
|
2184
2177
|
columnBuilder = columnBuilder.notNull();
|
2185
2178
|
}
|
2186
2179
|
if (c.default) {
|
2187
|
-
columnBuilder = columnBuilder.default(c.default);
|
2180
|
+
columnBuilder = columnBuilder.default(sql.raw(`${c.default}`));
|
2188
2181
|
}
|
2189
2182
|
if (c.primaryKey) {
|
2190
2183
|
columnBuilder = columnBuilder.primaryKey();
|
@@ -2208,7 +2201,11 @@ var sqliteSchemaToDrizzle = (schema) => {
|
|
2208
2201
|
|
2209
2202
|
// src/cli/commands/sqliteIntrospect.ts
|
2210
2203
|
init_views();
|
2211
|
-
|
2204
|
+
|
2205
|
+
// src/global.ts
|
2206
|
+
var originUUID = "00000000-0000-0000-0000-000000000000";
|
2207
|
+
|
2208
|
+
// src/cli/commands/sqliteIntrospect.ts
|
2212
2209
|
init_sqliteSerializer();
|
2213
2210
|
|
2214
2211
|
// node_modules/.pnpm/camelcase@7.0.1/node_modules/camelcase/index.js
|
@@ -3399,7 +3396,6 @@ import {
|
|
3399
3396
|
init_pgSerializer();
|
3400
3397
|
|
3401
3398
|
// src/cli/commands/pgIntrospect.ts
|
3402
|
-
init_global();
|
3403
3399
|
var pgPushIntrospect = async (connection, filters, schemaFilters) => {
|
3404
3400
|
const { client } = connection;
|
3405
3401
|
const matchers = filters.map((it) => {
|