drizzle-kit 0.20.0-5198fb7 → 0.20.0-c31f6ba
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/commands/migrate.d.ts +1 -1
- package/cli/validations/pg.d.ts +18 -18
- package/cli/validations/studio.d.ts +14 -14
- package/index.cjs +114 -25
- package/index.d.ts +1 -0
- package/package.json +2 -2
- package/serializer/pgSchema.d.ts +16 -16
- package/serializer/pgSerializer.d.ts +2 -0
- package/serializer/studioUtils.d.ts +4 -4
- package/utils.d.ts +211 -12
- package/utils.js +138 -26
- package/utilsR.d.ts +0 -232
package/utils.js
CHANGED
|
@@ -4410,7 +4410,7 @@ var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, d
|
|
|
4410
4410
|
var init_mysqlSchema = __esm({
|
|
4411
4411
|
"src/serializer/mysqlSchema.ts"() {
|
|
4412
4412
|
init_global();
|
|
4413
|
-
|
|
4413
|
+
init_utils4();
|
|
4414
4414
|
init_lib();
|
|
4415
4415
|
index = objectType({
|
|
4416
4416
|
name: stringType(),
|
|
@@ -4660,7 +4660,7 @@ var indexV2, columnV2, tableV2, enumSchema, pgSchemaV2, references, columnV1, ta
|
|
|
4660
4660
|
var init_pgSchema = __esm({
|
|
4661
4661
|
"src/serializer/pgSchema.ts"() {
|
|
4662
4662
|
init_global();
|
|
4663
|
-
|
|
4663
|
+
init_utils4();
|
|
4664
4664
|
init_lib();
|
|
4665
4665
|
indexV2 = objectType({
|
|
4666
4666
|
name: stringType(),
|
|
@@ -4989,7 +4989,7 @@ var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dia
|
|
|
4989
4989
|
var init_sqliteSchema = __esm({
|
|
4990
4990
|
"src/serializer/sqliteSchema.ts"() {
|
|
4991
4991
|
init_global();
|
|
4992
|
-
|
|
4992
|
+
init_utils4();
|
|
4993
4993
|
init_lib();
|
|
4994
4994
|
index3 = objectType({
|
|
4995
4995
|
name: stringType(),
|
|
@@ -11726,9 +11726,10 @@ var pgSerializer_exports = {};
|
|
|
11726
11726
|
__export(pgSerializer_exports, {
|
|
11727
11727
|
fromDatabase: () => fromDatabase2,
|
|
11728
11728
|
generatePgSnapshot: () => generatePgSnapshot,
|
|
11729
|
-
indexName: () => indexName2
|
|
11729
|
+
indexName: () => indexName2,
|
|
11730
|
+
toDrizzle: () => toDrizzle
|
|
11730
11731
|
});
|
|
11731
|
-
var import_pg_core2, import_pg_core3, import_drizzle_orm5, import_drizzle_orm6, dialect4, indexName2, generatePgSnapshot, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
|
|
11732
|
+
var import_pg_core2, import_pg_core3, import_drizzle_orm5, import_drizzle_orm6, dialect4, indexName2, generatePgSnapshot, trimChar, fromDatabase2, columnToDefault, defaultForColumn, toDrizzle;
|
|
11732
11733
|
var init_pgSerializer = __esm({
|
|
11733
11734
|
"src/serializer/pgSerializer.ts"() {
|
|
11734
11735
|
import_pg_core2 = require("drizzle-orm/pg-core");
|
|
@@ -12339,6 +12340,94 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
|
12339
12340
|
}
|
|
12340
12341
|
}
|
|
12341
12342
|
};
|
|
12343
|
+
toDrizzle = (schema4) => {
|
|
12344
|
+
const tables = {};
|
|
12345
|
+
Object.values(schema4.tables).forEach((t) => {
|
|
12346
|
+
const columns = {};
|
|
12347
|
+
Object.values(t.columns).forEach((c) => {
|
|
12348
|
+
const columnName = c.name;
|
|
12349
|
+
const type = c.type;
|
|
12350
|
+
let columnBuilder;
|
|
12351
|
+
if (type === "bigint") {
|
|
12352
|
+
columnBuilder = new import_pg_core2.PgBigInt53Builder(columnName);
|
|
12353
|
+
} else if (type === "bigserial") {
|
|
12354
|
+
columnBuilder = new import_pg_core2.PgBigSerial53Builder(columnName);
|
|
12355
|
+
} else if (type === "boolean") {
|
|
12356
|
+
columnBuilder = new import_pg_core2.PgBooleanBuilder(columnName);
|
|
12357
|
+
} else if (type === "cidr") {
|
|
12358
|
+
columnBuilder = new import_pg_core2.PgCidrBuilder(columnName);
|
|
12359
|
+
} else if (type === "date") {
|
|
12360
|
+
columnBuilder = new import_pg_core2.PgDateBuilder(columnName);
|
|
12361
|
+
} else if (type === "double precision") {
|
|
12362
|
+
columnBuilder = new import_pg_core2.PgDoublePrecisionBuilder(columnName);
|
|
12363
|
+
} else if (type === "inet") {
|
|
12364
|
+
columnBuilder = new import_pg_core2.PgInetBuilder(columnName);
|
|
12365
|
+
} else if (type === "integer") {
|
|
12366
|
+
columnBuilder = new import_pg_core2.PgIntegerBuilder(columnName);
|
|
12367
|
+
} else if (type === "interval" || type.startsWith("interval ")) {
|
|
12368
|
+
columnBuilder = new import_pg_core2.PgIntervalBuilder(columnName, {});
|
|
12369
|
+
} else if (type === "json") {
|
|
12370
|
+
columnBuilder = new import_pg_core2.PgJsonBuilder(columnName);
|
|
12371
|
+
} else if (type === "jsonb") {
|
|
12372
|
+
columnBuilder = new import_pg_core2.PgJsonbBuilder(columnName);
|
|
12373
|
+
} else if (type === "macaddr") {
|
|
12374
|
+
columnBuilder = new import_pg_core2.PgMacaddrBuilder(columnName);
|
|
12375
|
+
} else if (type === "macaddr8") {
|
|
12376
|
+
columnBuilder = new import_pg_core2.PgMacaddr8Builder(columnName);
|
|
12377
|
+
} else if (type === "numeric" || type.startsWith("numeric(")) {
|
|
12378
|
+
columnBuilder = new import_pg_core2.PgNumericBuilder(columnName);
|
|
12379
|
+
} else if (type === "real") {
|
|
12380
|
+
columnBuilder = new import_pg_core2.PgRealBuilder(columnName);
|
|
12381
|
+
} else if (type === "serial") {
|
|
12382
|
+
columnBuilder = new import_pg_core2.PgSerialBuilder(columnName);
|
|
12383
|
+
} else if (type === "smallint") {
|
|
12384
|
+
columnBuilder = new import_pg_core2.PgSmallIntBuilder(columnName);
|
|
12385
|
+
} else if (type === "smallserial") {
|
|
12386
|
+
columnBuilder = new import_pg_core2.PgSmallSerialBuilder(columnName);
|
|
12387
|
+
} else if (type === "text") {
|
|
12388
|
+
columnBuilder = new import_pg_core2.PgTextBuilder(columnName, {});
|
|
12389
|
+
} else if (type === "time" || type.startsWith("time(") || type === "time with time zone") {
|
|
12390
|
+
columnBuilder = new import_pg_core2.PgTimeBuilder(columnName, false, void 0);
|
|
12391
|
+
} else if (type === "timestamp" || type.startsWith("timestamp(") || type === "timestamp with time zone") {
|
|
12392
|
+
columnBuilder = new import_pg_core2.PgTimestampBuilder(columnName, false, void 0);
|
|
12393
|
+
} else if (type === "uuid") {
|
|
12394
|
+
columnBuilder = new import_pg_core2.PgUUIDBuilder(columnName);
|
|
12395
|
+
} else if (type === "varchar" || type.startsWith("varchar(")) {
|
|
12396
|
+
columnBuilder = new import_pg_core2.PgVarcharBuilder(columnName, {});
|
|
12397
|
+
} else if (type === "char" || type.startsWith("char(")) {
|
|
12398
|
+
columnBuilder = new import_pg_core2.PgCharBuilder(columnName, {});
|
|
12399
|
+
} else {
|
|
12400
|
+
columnBuilder = (0, import_pg_core2.customType)({
|
|
12401
|
+
dataType() {
|
|
12402
|
+
return type;
|
|
12403
|
+
}
|
|
12404
|
+
})(columnName);
|
|
12405
|
+
}
|
|
12406
|
+
if (c.notNull) {
|
|
12407
|
+
columnBuilder = columnBuilder.notNull();
|
|
12408
|
+
}
|
|
12409
|
+
if (c.default) {
|
|
12410
|
+
columnBuilder = columnBuilder.default(c.default);
|
|
12411
|
+
}
|
|
12412
|
+
if (c.primaryKey) {
|
|
12413
|
+
columnBuilder = columnBuilder.primaryKey();
|
|
12414
|
+
}
|
|
12415
|
+
columns[columnName] = columnBuilder;
|
|
12416
|
+
});
|
|
12417
|
+
tables[t.name] = (0, import_pg_core2.pgTable)(t.name, columns, (cb) => {
|
|
12418
|
+
const res = {};
|
|
12419
|
+
Object.values(t.compositePrimaryKeys).forEach((cpk) => {
|
|
12420
|
+
const gh = cpk.columns.map((c) => cb[c]);
|
|
12421
|
+
res[cpk.name] = new import_pg_core2.PrimaryKeyBuilder(
|
|
12422
|
+
gh,
|
|
12423
|
+
cpk.name
|
|
12424
|
+
);
|
|
12425
|
+
});
|
|
12426
|
+
return res;
|
|
12427
|
+
});
|
|
12428
|
+
});
|
|
12429
|
+
return tables;
|
|
12430
|
+
};
|
|
12342
12431
|
}
|
|
12343
12432
|
});
|
|
12344
12433
|
|
|
@@ -12378,7 +12467,7 @@ var sqliteSerializer_exports = {};
|
|
|
12378
12467
|
__export(sqliteSerializer_exports, {
|
|
12379
12468
|
fromDatabase: () => fromDatabase3,
|
|
12380
12469
|
generateSqliteSnapshot: () => generateSqliteSnapshot,
|
|
12381
|
-
toDrizzle: () =>
|
|
12470
|
+
toDrizzle: () => toDrizzle2
|
|
12382
12471
|
});
|
|
12383
12472
|
function mapSqlToSqliteType(sqlType) {
|
|
12384
12473
|
if ([
|
|
@@ -12415,7 +12504,7 @@ function mapSqlToSqliteType(sqlType) {
|
|
|
12415
12504
|
return "numeric";
|
|
12416
12505
|
}
|
|
12417
12506
|
}
|
|
12418
|
-
var import_drizzle_orm8, import_drizzle_orm9, import_sqlite_core2, dialect5, generateSqliteSnapshot, fromDatabase3,
|
|
12507
|
+
var import_drizzle_orm8, import_drizzle_orm9, import_sqlite_core2, dialect5, generateSqliteSnapshot, fromDatabase3, toDrizzle2;
|
|
12419
12508
|
var init_sqliteSerializer = __esm({
|
|
12420
12509
|
"src/serializer/sqliteSerializer.ts"() {
|
|
12421
12510
|
import_drizzle_orm8 = require("drizzle-orm");
|
|
@@ -12784,7 +12873,7 @@ WHERE
|
|
|
12784
12873
|
}
|
|
12785
12874
|
};
|
|
12786
12875
|
};
|
|
12787
|
-
|
|
12876
|
+
toDrizzle2 = (schema4) => {
|
|
12788
12877
|
const tables = {};
|
|
12789
12878
|
Object.values(schema4.tables).forEach((t) => {
|
|
12790
12879
|
const columns = {};
|
|
@@ -14349,7 +14438,7 @@ var init_migrate = __esm({
|
|
|
14349
14438
|
init_pgSchema();
|
|
14350
14439
|
init_sqliteSchema();
|
|
14351
14440
|
init_mysqlSchema();
|
|
14352
|
-
|
|
14441
|
+
init_utils4();
|
|
14353
14442
|
init_words();
|
|
14354
14443
|
init_outputs();
|
|
14355
14444
|
prepareAndMigratePg = async (config) => {
|
|
@@ -16619,12 +16708,13 @@ var init_jsonStatements = __esm({
|
|
|
16619
16708
|
};
|
|
16620
16709
|
prepareAddCompositePrimaryKeyPg = (tableName, schema4, pks, json2) => {
|
|
16621
16710
|
return Object.values(pks).map((it) => {
|
|
16711
|
+
const unsquashed = MySqlSquasher.unsquashPK(it);
|
|
16622
16712
|
return {
|
|
16623
16713
|
type: "create_composite_pk",
|
|
16624
16714
|
tableName,
|
|
16625
16715
|
data: it,
|
|
16626
16716
|
schema: schema4,
|
|
16627
|
-
constraintName: json2.tables[tableName].compositePrimaryKeys[
|
|
16717
|
+
constraintName: json2.tables[tableName].compositePrimaryKeys[unsquashed.name].name
|
|
16628
16718
|
};
|
|
16629
16719
|
});
|
|
16630
16720
|
};
|
|
@@ -16722,7 +16812,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
16722
16812
|
init_lib();
|
|
16723
16813
|
init_jsonDiffer();
|
|
16724
16814
|
init_jsonStatements();
|
|
16725
|
-
|
|
16815
|
+
init_utils4();
|
|
16726
16816
|
init_sqliteSchema();
|
|
16727
16817
|
init_mysqlSchema();
|
|
16728
16818
|
makeChanged = (schema4) => {
|
|
@@ -17032,8 +17122,6 @@ var init_snapshotsDiffer = __esm({
|
|
|
17032
17122
|
deletedColumns = SQLiteSquasher.unsquashPK(deletedPkColumns);
|
|
17033
17123
|
}
|
|
17034
17124
|
}
|
|
17035
|
-
addedColumns.sort();
|
|
17036
|
-
deletedColumns.sort();
|
|
17037
17125
|
const doPerformDeleteAndCreate = JSON.stringify(addedColumns) !== JSON.stringify(deletedColumns);
|
|
17038
17126
|
let addedCompositePKs = [];
|
|
17039
17127
|
let deletedCompositePKs = [];
|
|
@@ -17343,7 +17431,7 @@ var init_pgUp = __esm({
|
|
|
17343
17431
|
init_source();
|
|
17344
17432
|
init_global();
|
|
17345
17433
|
init_pgSchema();
|
|
17346
|
-
|
|
17434
|
+
init_utils4();
|
|
17347
17435
|
}
|
|
17348
17436
|
});
|
|
17349
17437
|
|
|
@@ -17352,7 +17440,7 @@ var init_mysqlUp = __esm({
|
|
|
17352
17440
|
"src/cli/commands/mysqlUp.ts"() {
|
|
17353
17441
|
init_source();
|
|
17354
17442
|
init_mysqlSchema();
|
|
17355
|
-
|
|
17443
|
+
init_utils4();
|
|
17356
17444
|
}
|
|
17357
17445
|
});
|
|
17358
17446
|
|
|
@@ -17364,7 +17452,7 @@ var init_upFolders = __esm({
|
|
|
17364
17452
|
init_mysqlSchema();
|
|
17365
17453
|
init_sqliteSchema();
|
|
17366
17454
|
init_snapshotsDiffer();
|
|
17367
|
-
|
|
17455
|
+
init_utils4();
|
|
17368
17456
|
init_words();
|
|
17369
17457
|
init_pgUp();
|
|
17370
17458
|
init_pgSchema();
|
|
@@ -23471,7 +23559,7 @@ var init_drivers = __esm({
|
|
|
23471
23559
|
});
|
|
23472
23560
|
|
|
23473
23561
|
// src/cli/commands/pgIntrospect.ts
|
|
23474
|
-
var import_hanji4, import_pg, pgPushIntrospect;
|
|
23562
|
+
var import_hanji4, import_pg, connectToPg, pgPushIntrospect;
|
|
23475
23563
|
var init_pgIntrospect = __esm({
|
|
23476
23564
|
"src/cli/commands/pgIntrospect.ts"() {
|
|
23477
23565
|
import_hanji4 = __toESM(require_hanji());
|
|
@@ -23482,6 +23570,16 @@ var init_pgIntrospect = __esm({
|
|
|
23482
23570
|
init_global();
|
|
23483
23571
|
init_mjs();
|
|
23484
23572
|
init_drivers();
|
|
23573
|
+
connectToPg = async (config) => {
|
|
23574
|
+
if (config.driver === "pg") {
|
|
23575
|
+
const client = new import_pg.Client(config.dbCredentials);
|
|
23576
|
+
await client.connect();
|
|
23577
|
+
const connection = new PgPostgres(client);
|
|
23578
|
+
return { client: connection };
|
|
23579
|
+
} else {
|
|
23580
|
+
throw Error(`Only "pg" is available as a driver option for introspection`);
|
|
23581
|
+
}
|
|
23582
|
+
};
|
|
23485
23583
|
pgPushIntrospect = async (connection, filters, schemaFilters) => {
|
|
23486
23584
|
const { client } = connection;
|
|
23487
23585
|
const matchers = filters.map((it) => {
|
|
@@ -55939,9 +56037,9 @@ var init_studioUtils = __esm({
|
|
|
55939
56037
|
}
|
|
55940
56038
|
});
|
|
55941
56039
|
|
|
55942
|
-
// src/
|
|
55943
|
-
var
|
|
55944
|
-
__export(
|
|
56040
|
+
// src/utils.ts
|
|
56041
|
+
var utils_exports = {};
|
|
56042
|
+
__export(utils_exports, {
|
|
55945
56043
|
assertV1OutFolder: () => assertV1OutFolder,
|
|
55946
56044
|
columnRenameKey: () => columnRenameKey,
|
|
55947
56045
|
defineConfig: () => defineConfig,
|
|
@@ -55961,13 +56059,13 @@ __export(utilsR_exports, {
|
|
|
55961
56059
|
tableRenameKey: () => tableRenameKey,
|
|
55962
56060
|
validateWithReport: () => validateWithReport
|
|
55963
56061
|
});
|
|
55964
|
-
module.exports = __toCommonJS(
|
|
56062
|
+
module.exports = __toCommonJS(utils_exports);
|
|
55965
56063
|
function defineConfig(config) {
|
|
55966
56064
|
return config;
|
|
55967
56065
|
}
|
|
55968
56066
|
var import_fs4, import_path3, import_crypto2, assertV1OutFolder, dryJournal, snapshotsPriorV4, prepareOutFolder2, mapValues, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey, kloudMeta, statementsForDiffs, generateDrizzleJson, generateMigration, pushSchema, prepareFrom;
|
|
55969
|
-
var
|
|
55970
|
-
"src/
|
|
56067
|
+
var init_utils4 = __esm({
|
|
56068
|
+
"src/utils.ts"() {
|
|
55971
56069
|
import_fs4 = require("fs");
|
|
55972
56070
|
init_views();
|
|
55973
56071
|
init_mysqlSchema();
|
|
@@ -55986,6 +56084,7 @@ var init_utilsR = __esm({
|
|
|
55986
56084
|
init_pgPushUtils();
|
|
55987
56085
|
init_sqliteIntrospect();
|
|
55988
56086
|
init_sqliteSerializer();
|
|
56087
|
+
init_pgSerializer();
|
|
55989
56088
|
init_studioUtils();
|
|
55990
56089
|
assertV1OutFolder = (out, dialect6) => {
|
|
55991
56090
|
if (!(0, import_fs4.existsSync)(out))
|
|
@@ -56303,14 +56402,27 @@ var init_utilsR = __esm({
|
|
|
56303
56402
|
preparedConnection.client,
|
|
56304
56403
|
[]
|
|
56305
56404
|
);
|
|
56306
|
-
const models =
|
|
56405
|
+
const models = toDrizzle2(schema4);
|
|
56307
56406
|
return await drizzleDb(connection, { sqliteSchema: models }, false);
|
|
56407
|
+
} else if (connection.driver === "pg") {
|
|
56408
|
+
const preparedConnection = await connectToPg({
|
|
56409
|
+
driver: connection.driver,
|
|
56410
|
+
// @ts-ignore I don't know how to fix it yet. But will find a way
|
|
56411
|
+
dbCredentials: connection.dbCredentials
|
|
56412
|
+
});
|
|
56413
|
+
const { schema: schema4 } = await pgPushIntrospect(
|
|
56414
|
+
{ client: preparedConnection.client },
|
|
56415
|
+
[],
|
|
56416
|
+
[]
|
|
56417
|
+
);
|
|
56418
|
+
const models = toDrizzle(schema4);
|
|
56419
|
+
return await drizzleDb(connection, { pgSchema: models }, false);
|
|
56308
56420
|
}
|
|
56309
|
-
throw Error("Only sqlite is supported for now");
|
|
56421
|
+
throw Error("Only sqlite and pg is supported for now");
|
|
56310
56422
|
};
|
|
56311
56423
|
}
|
|
56312
56424
|
});
|
|
56313
|
-
|
|
56425
|
+
init_utils4();
|
|
56314
56426
|
// Annotate the CommonJS export names for ESM import in node:
|
|
56315
56427
|
0 && (module.exports = {
|
|
56316
56428
|
assertV1OutFolder,
|
package/utilsR.d.ts
DELETED
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { Dialect } from "./schemaValidator";
|
|
2
|
-
import { NamedWithSchema } from "./cli/commands/migrate";
|
|
3
|
-
import { AnyPgTable, PgDatabase } from "drizzle-orm/pg-core";
|
|
4
|
-
import { PgSchema as PgSchemaKit } from "./serializer/pgSchema";
|
|
5
|
-
import { Config, DbConnection } from "src";
|
|
6
|
-
export declare const assertV1OutFolder: (out: string, dialect: Dialect | "{dialect}") => void;
|
|
7
|
-
export type Journal = {
|
|
8
|
-
version: string;
|
|
9
|
-
dialect: Dialect;
|
|
10
|
-
entries: {
|
|
11
|
-
idx: number;
|
|
12
|
-
version: string;
|
|
13
|
-
when: number;
|
|
14
|
-
tag: string;
|
|
15
|
-
breakpoints: boolean;
|
|
16
|
-
}[];
|
|
17
|
-
};
|
|
18
|
-
export declare const dryJournal: (dialect: Dialect) => Journal;
|
|
19
|
-
export declare const snapshotsPriorV4: (out: string) => string[];
|
|
20
|
-
export declare function defineConfig(config: Config): Config;
|
|
21
|
-
export declare const prepareOutFolder: (out: string, dialect: Dialect) => {
|
|
22
|
-
meta: string;
|
|
23
|
-
snapshots: string[];
|
|
24
|
-
journal: any;
|
|
25
|
-
};
|
|
26
|
-
export declare const mapValues: <IN, OUT>(obj: Record<string, IN>, map: (input: IN) => OUT) => Record<string, OUT>;
|
|
27
|
-
export declare const validateWithReport: (snapshots: string[], dialect: Dialect) => {
|
|
28
|
-
malformed: string[];
|
|
29
|
-
nonLatest: string[];
|
|
30
|
-
idsMap: Record<string, {
|
|
31
|
-
parent: string;
|
|
32
|
-
snapshots: string[];
|
|
33
|
-
}>;
|
|
34
|
-
rawMap: Record<string, any>;
|
|
35
|
-
};
|
|
36
|
-
export declare const prepareMigrationFolder: (outFolder: string | undefined, dialect: Dialect) => {
|
|
37
|
-
snapshots: string[];
|
|
38
|
-
journal: any;
|
|
39
|
-
};
|
|
40
|
-
export declare const prepareMigrationMeta: (schemas: {
|
|
41
|
-
from: string;
|
|
42
|
-
to: string;
|
|
43
|
-
}[], tables: {
|
|
44
|
-
from: NamedWithSchema;
|
|
45
|
-
to: NamedWithSchema;
|
|
46
|
-
}[], columns: {
|
|
47
|
-
from: {
|
|
48
|
-
table: string;
|
|
49
|
-
schema: string;
|
|
50
|
-
column: string;
|
|
51
|
-
};
|
|
52
|
-
to: {
|
|
53
|
-
table: string;
|
|
54
|
-
schema: string;
|
|
55
|
-
column: string;
|
|
56
|
-
};
|
|
57
|
-
}[]) => {
|
|
58
|
-
schemas: {};
|
|
59
|
-
tables: {};
|
|
60
|
-
columns: {};
|
|
61
|
-
};
|
|
62
|
-
export declare const schemaRenameKey: (it: string) => string;
|
|
63
|
-
export declare const tableRenameKey: (it: NamedWithSchema) => string;
|
|
64
|
-
export declare const columnRenameKey: (table: string, schema: string, column: string) => string;
|
|
65
|
-
export declare const kloudMeta: () => {
|
|
66
|
-
pg: number[];
|
|
67
|
-
mysql: number[];
|
|
68
|
-
sqlite: number[];
|
|
69
|
-
};
|
|
70
|
-
export declare const statementsForDiffs: (in1: any, in2: any) => Promise<{
|
|
71
|
-
left: {
|
|
72
|
-
internal?: {
|
|
73
|
-
tables: Record<string, {
|
|
74
|
-
columns: Record<string, {
|
|
75
|
-
isArray?: boolean | undefined;
|
|
76
|
-
dimensions?: number | undefined;
|
|
77
|
-
rawType?: string | undefined;
|
|
78
|
-
} | undefined>;
|
|
79
|
-
} | undefined>;
|
|
80
|
-
} | undefined;
|
|
81
|
-
id: string;
|
|
82
|
-
prevId: string;
|
|
83
|
-
version: "5";
|
|
84
|
-
dialect: "pg";
|
|
85
|
-
tables: Record<string, {
|
|
86
|
-
name: string;
|
|
87
|
-
columns: Record<string, {
|
|
88
|
-
isUnique?: any;
|
|
89
|
-
default?: any;
|
|
90
|
-
uniqueName?: string | undefined;
|
|
91
|
-
nullsNotDistinct?: boolean | undefined;
|
|
92
|
-
name: string;
|
|
93
|
-
type: string;
|
|
94
|
-
primaryKey: boolean;
|
|
95
|
-
notNull: boolean;
|
|
96
|
-
}>;
|
|
97
|
-
indexes: Record<string, {
|
|
98
|
-
name: string;
|
|
99
|
-
columns: string[];
|
|
100
|
-
isUnique: boolean;
|
|
101
|
-
}>;
|
|
102
|
-
foreignKeys: Record<string, {
|
|
103
|
-
onUpdate?: string | undefined;
|
|
104
|
-
onDelete?: string | undefined;
|
|
105
|
-
name: string;
|
|
106
|
-
tableFrom: string;
|
|
107
|
-
columnsFrom: string[];
|
|
108
|
-
tableTo: string;
|
|
109
|
-
columnsTo: string[];
|
|
110
|
-
}>;
|
|
111
|
-
schema: string;
|
|
112
|
-
compositePrimaryKeys: Record<string, {
|
|
113
|
-
name: string;
|
|
114
|
-
columns: string[];
|
|
115
|
-
}>;
|
|
116
|
-
uniqueConstraints: Record<string, {
|
|
117
|
-
name: string;
|
|
118
|
-
columns: string[];
|
|
119
|
-
nullsNotDistinct: boolean;
|
|
120
|
-
}>;
|
|
121
|
-
}>;
|
|
122
|
-
schemas: Record<string, string>;
|
|
123
|
-
_meta: {
|
|
124
|
-
columns: Record<string, string>;
|
|
125
|
-
tables: Record<string, string>;
|
|
126
|
-
schemas: Record<string, string>;
|
|
127
|
-
};
|
|
128
|
-
enums: Record<string, {
|
|
129
|
-
name: string;
|
|
130
|
-
values: Record<string, string>;
|
|
131
|
-
}>;
|
|
132
|
-
};
|
|
133
|
-
right: {
|
|
134
|
-
internal?: {
|
|
135
|
-
tables: Record<string, {
|
|
136
|
-
columns: Record<string, {
|
|
137
|
-
isArray?: boolean | undefined;
|
|
138
|
-
dimensions?: number | undefined;
|
|
139
|
-
rawType?: string | undefined;
|
|
140
|
-
} | undefined>;
|
|
141
|
-
} | undefined>;
|
|
142
|
-
} | undefined;
|
|
143
|
-
id: string;
|
|
144
|
-
prevId: string;
|
|
145
|
-
version: "5";
|
|
146
|
-
dialect: "pg";
|
|
147
|
-
tables: Record<string, {
|
|
148
|
-
name: string;
|
|
149
|
-
columns: Record<string, {
|
|
150
|
-
isUnique?: any;
|
|
151
|
-
default?: any;
|
|
152
|
-
uniqueName?: string | undefined;
|
|
153
|
-
nullsNotDistinct?: boolean | undefined;
|
|
154
|
-
name: string;
|
|
155
|
-
type: string;
|
|
156
|
-
primaryKey: boolean;
|
|
157
|
-
notNull: boolean;
|
|
158
|
-
}>;
|
|
159
|
-
indexes: Record<string, {
|
|
160
|
-
name: string;
|
|
161
|
-
columns: string[];
|
|
162
|
-
isUnique: boolean;
|
|
163
|
-
}>;
|
|
164
|
-
foreignKeys: Record<string, {
|
|
165
|
-
onUpdate?: string | undefined;
|
|
166
|
-
onDelete?: string | undefined;
|
|
167
|
-
name: string;
|
|
168
|
-
tableFrom: string;
|
|
169
|
-
columnsFrom: string[];
|
|
170
|
-
tableTo: string;
|
|
171
|
-
columnsTo: string[];
|
|
172
|
-
}>;
|
|
173
|
-
schema: string;
|
|
174
|
-
compositePrimaryKeys: Record<string, {
|
|
175
|
-
name: string;
|
|
176
|
-
columns: string[];
|
|
177
|
-
}>;
|
|
178
|
-
uniqueConstraints: Record<string, {
|
|
179
|
-
name: string;
|
|
180
|
-
columns: string[];
|
|
181
|
-
nullsNotDistinct: boolean;
|
|
182
|
-
}>;
|
|
183
|
-
}>;
|
|
184
|
-
schemas: Record<string, string>;
|
|
185
|
-
_meta: {
|
|
186
|
-
columns: Record<string, string>;
|
|
187
|
-
tables: Record<string, string>;
|
|
188
|
-
schemas: Record<string, string>;
|
|
189
|
-
};
|
|
190
|
-
enums: Record<string, {
|
|
191
|
-
name: string;
|
|
192
|
-
values: Record<string, string>;
|
|
193
|
-
}>;
|
|
194
|
-
};
|
|
195
|
-
statements: import("./jsonStatements").JsonStatement[];
|
|
196
|
-
sqlStatements: string[];
|
|
197
|
-
_meta: {
|
|
198
|
-
schemas: {};
|
|
199
|
-
tables: {};
|
|
200
|
-
columns: {};
|
|
201
|
-
} | undefined;
|
|
202
|
-
}>;
|
|
203
|
-
export type DrizzleSnapshotJSON = PgSchemaKit;
|
|
204
|
-
export declare const generateDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => PgSchemaKit;
|
|
205
|
-
export declare const generateMigration: (prev: DrizzleSnapshotJSON, cur: DrizzleSnapshotJSON) => Promise<string[]>;
|
|
206
|
-
export declare const pushSchema: (imports: Record<string, unknown>, db: PgDatabase<any>) => Promise<{
|
|
207
|
-
hasDataLoss: boolean;
|
|
208
|
-
warnings: string[];
|
|
209
|
-
statementsToExecute: string[];
|
|
210
|
-
apply: () => Promise<void>;
|
|
211
|
-
}>;
|
|
212
|
-
export declare const prepareFrom: (connection: DbConnection) => Promise<{
|
|
213
|
-
db: import("drizzle-orm/node-postgres").NodePgDatabase<Record<string, never>>;
|
|
214
|
-
type: "pg";
|
|
215
|
-
schema: Record<string, AnyPgTable<{}> | import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
|
216
|
-
} | {
|
|
217
|
-
db: import("drizzle-orm/mysql2").MySql2Database<Record<string, never>>;
|
|
218
|
-
type: "mysql";
|
|
219
|
-
schema: Record<string, import("drizzle-orm/mysql-core").AnyMySqlTable<{}> | import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
|
220
|
-
} | {
|
|
221
|
-
db: import("./orm-extenstions/d1-driver/driver").DrizzleD1WranglerDatabase<Record<string, never>>;
|
|
222
|
-
type: "sqlite";
|
|
223
|
-
schema: Record<string, import("drizzle-orm/sqlite-core").AnySQLiteTable<{}> | import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
|
224
|
-
} | {
|
|
225
|
-
db: import("drizzle-orm/better-sqlite3").BetterSQLite3Database<Record<string, never>>;
|
|
226
|
-
type: "sqlite";
|
|
227
|
-
schema: Record<string, import("drizzle-orm/sqlite-core").AnySQLiteTable<{}> | import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
|
228
|
-
} | {
|
|
229
|
-
db: import("drizzle-orm/libsql").LibSQLDatabase<Record<string, never>>;
|
|
230
|
-
type: "sqlite";
|
|
231
|
-
schema: Record<string, import("drizzle-orm/sqlite-core").AnySQLiteTable<{}> | import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
|
232
|
-
}>;
|