drizzle-kit 0.20.15 → 0.20.16
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/bin.cjs +360 -345
- package/package.json +1 -1
package/bin.cjs
CHANGED
@@ -82,27 +82,27 @@ function floatSafeRemainder(val, step) {
|
|
82
82
|
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
83
83
|
return valInt % stepInt / Math.pow(10, decCount);
|
84
84
|
}
|
85
|
-
function deepPartialify(
|
86
|
-
if (
|
85
|
+
function deepPartialify(schema5) {
|
86
|
+
if (schema5 instanceof ZodObject) {
|
87
87
|
const newShape = {};
|
88
|
-
for (const key in
|
89
|
-
const fieldSchema =
|
88
|
+
for (const key in schema5.shape) {
|
89
|
+
const fieldSchema = schema5.shape[key];
|
90
90
|
newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
|
91
91
|
}
|
92
92
|
return new ZodObject({
|
93
|
-
...
|
93
|
+
...schema5._def,
|
94
94
|
shape: () => newShape
|
95
95
|
});
|
96
|
-
} else if (
|
97
|
-
return ZodArray.create(deepPartialify(
|
98
|
-
} else if (
|
99
|
-
return ZodOptional.create(deepPartialify(
|
100
|
-
} else if (
|
101
|
-
return ZodNullable.create(deepPartialify(
|
102
|
-
} else if (
|
103
|
-
return ZodTuple.create(
|
96
|
+
} else if (schema5 instanceof ZodArray) {
|
97
|
+
return ZodArray.create(deepPartialify(schema5.element));
|
98
|
+
} else if (schema5 instanceof ZodOptional) {
|
99
|
+
return ZodOptional.create(deepPartialify(schema5.unwrap()));
|
100
|
+
} else if (schema5 instanceof ZodNullable) {
|
101
|
+
return ZodNullable.create(deepPartialify(schema5.unwrap()));
|
102
|
+
} else if (schema5 instanceof ZodTuple) {
|
103
|
+
return ZodTuple.create(schema5.items.map((item) => deepPartialify(item)));
|
104
104
|
} else {
|
105
|
-
return
|
105
|
+
return schema5;
|
106
106
|
}
|
107
107
|
}
|
108
108
|
function mergeValues(a, b) {
|
@@ -1728,9 +1728,9 @@ var init_lib = __esm({
|
|
1728
1728
|
return this.min(1, message);
|
1729
1729
|
}
|
1730
1730
|
};
|
1731
|
-
ZodArray.create = (
|
1731
|
+
ZodArray.create = (schema5, params) => {
|
1732
1732
|
return new ZodArray({
|
1733
|
-
type:
|
1733
|
+
type: schema5,
|
1734
1734
|
minLength: null,
|
1735
1735
|
maxLength: null,
|
1736
1736
|
exactLength: null,
|
@@ -1892,8 +1892,8 @@ var init_lib = __esm({
|
|
1892
1892
|
unknownKeys: "passthrough"
|
1893
1893
|
});
|
1894
1894
|
}
|
1895
|
-
setKey(key,
|
1896
|
-
return this.augment({ [key]:
|
1895
|
+
setKey(key, schema5) {
|
1896
|
+
return this.augment({ [key]: schema5 });
|
1897
1897
|
}
|
1898
1898
|
/**
|
1899
1899
|
* Prior to zod@1.0.12 there was a bug in the
|
@@ -2301,10 +2301,10 @@ var init_lib = __esm({
|
|
2301
2301
|
status.dirty();
|
2302
2302
|
}
|
2303
2303
|
const items = ctx.data.map((item, itemIndex) => {
|
2304
|
-
const
|
2305
|
-
if (!
|
2304
|
+
const schema5 = this._def.items[itemIndex] || this._def.rest;
|
2305
|
+
if (!schema5)
|
2306
2306
|
return null;
|
2307
|
-
return
|
2307
|
+
return schema5._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
|
2308
2308
|
}).filter((x) => !!x);
|
2309
2309
|
if (ctx.common.async) {
|
2310
2310
|
return Promise.all(items).then((results) => {
|
@@ -2790,9 +2790,9 @@ var init_lib = __esm({
|
|
2790
2790
|
}));
|
2791
2791
|
}
|
2792
2792
|
};
|
2793
|
-
ZodPromise.create = (
|
2793
|
+
ZodPromise.create = (schema5, params) => {
|
2794
2794
|
return new ZodPromise({
|
2795
|
-
type:
|
2795
|
+
type: schema5,
|
2796
2796
|
typeName: ZodFirstPartyTypeKind.ZodPromise,
|
2797
2797
|
...processCreateParams(params)
|
2798
2798
|
});
|
@@ -2899,17 +2899,17 @@ var init_lib = __esm({
|
|
2899
2899
|
util.assertNever(effect);
|
2900
2900
|
}
|
2901
2901
|
};
|
2902
|
-
ZodEffects.create = (
|
2902
|
+
ZodEffects.create = (schema5, effect, params) => {
|
2903
2903
|
return new ZodEffects({
|
2904
|
-
schema:
|
2904
|
+
schema: schema5,
|
2905
2905
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
2906
2906
|
effect,
|
2907
2907
|
...processCreateParams(params)
|
2908
2908
|
});
|
2909
2909
|
};
|
2910
|
-
ZodEffects.createWithPreprocess = (preprocess,
|
2910
|
+
ZodEffects.createWithPreprocess = (preprocess, schema5, params) => {
|
2911
2911
|
return new ZodEffects({
|
2912
|
-
schema:
|
2912
|
+
schema: schema5,
|
2913
2913
|
effect: { type: "preprocess", transform: preprocess },
|
2914
2914
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
2915
2915
|
...processCreateParams(params)
|
@@ -4375,8 +4375,8 @@ var init_views = __esm({
|
|
4375
4375
|
error = (error2, greyMsg = "") => {
|
4376
4376
|
return `${source_default.red.bold("Err:")} ${error2} ${greyMsg ? source_default.grey(greyMsg) : ""}`.trim();
|
4377
4377
|
};
|
4378
|
-
schema = (
|
4379
|
-
const tables = Object.values(
|
4378
|
+
schema = (schema5) => {
|
4379
|
+
const tables = Object.values(schema5.tables);
|
4380
4380
|
let msg = source_default.bold(`${tables.length} tables
|
4381
4381
|
`);
|
4382
4382
|
msg += tables.map((t) => {
|
@@ -4388,7 +4388,7 @@ var init_views = __esm({
|
|
4388
4388
|
)}`;
|
4389
4389
|
}).join("\n");
|
4390
4390
|
msg += "\n";
|
4391
|
-
const enums = Object.values(
|
4391
|
+
const enums = Object.values(schema5["enums"] || {});
|
4392
4392
|
if (enums.length > 0) {
|
4393
4393
|
msg += "\n";
|
4394
4394
|
msg += source_default.bold(`${enums.length} enums
|
@@ -5625,22 +5625,22 @@ var init_jsonDiffer = __esm({
|
|
5625
5625
|
import_json_diff = require("json-diff");
|
5626
5626
|
findAlternationsInTable = (table4, tableSchema) => {
|
5627
5627
|
const columns = table4.columns ?? {};
|
5628
|
-
let
|
5628
|
+
let schema5 = {
|
5629
5629
|
type: "none",
|
5630
5630
|
value: tableSchema
|
5631
5631
|
};
|
5632
5632
|
if ("schema" in table4) {
|
5633
5633
|
if (table4.schema.__new) {
|
5634
|
-
|
5634
|
+
schema5 = { type: "changed", old: table4.schema.__old, new: table4.schema.__new };
|
5635
5635
|
} else {
|
5636
|
-
|
5636
|
+
schema5 = { type: "deleted", value: table4.schema.__old };
|
5637
5637
|
}
|
5638
5638
|
}
|
5639
5639
|
if ("schema__added" in table4) {
|
5640
|
-
|
5640
|
+
schema5 = { type: "added", value: table4.schema__added };
|
5641
5641
|
}
|
5642
5642
|
if ("schema__deleted" in table4) {
|
5643
|
-
|
5643
|
+
schema5 = { type: "deleted", value: table4.schema__deleted };
|
5644
5644
|
}
|
5645
5645
|
const added = Object.keys(columns).filter((it) => it.includes("__added")).map((it) => {
|
5646
5646
|
return { ...columns[it] };
|
@@ -5688,7 +5688,7 @@ var init_jsonDiffer = __esm({
|
|
5688
5688
|
const mappedAltered = altered.map((it) => alternationsInColumn(it));
|
5689
5689
|
return {
|
5690
5690
|
name: table4.name,
|
5691
|
-
schema:
|
5691
|
+
schema: schema5,
|
5692
5692
|
deleted,
|
5693
5693
|
added,
|
5694
5694
|
altered: mappedAltered,
|
@@ -6370,7 +6370,7 @@ var require_node = __commonJS({
|
|
6370
6370
|
"node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/node.js"(exports, module2) {
|
6371
6371
|
var tty2 = require("tty");
|
6372
6372
|
var util2 = require("util");
|
6373
|
-
exports.init =
|
6373
|
+
exports.init = init2;
|
6374
6374
|
exports.log = log2;
|
6375
6375
|
exports.formatArgs = formatArgs;
|
6376
6376
|
exports.save = save;
|
@@ -6519,7 +6519,7 @@ var require_node = __commonJS({
|
|
6519
6519
|
function load() {
|
6520
6520
|
return process.env.DEBUG;
|
6521
6521
|
}
|
6522
|
-
function
|
6522
|
+
function init2(debug) {
|
6523
6523
|
debug.inspectOpts = {};
|
6524
6524
|
const keys = Object.keys(exports.inspectOpts);
|
6525
6525
|
for (let i = 0; i < keys.length; i++) {
|
@@ -11460,8 +11460,8 @@ var init_utils = __esm({
|
|
11460
11460
|
return res;
|
11461
11461
|
};
|
11462
11462
|
prepareGenerateConfig = async (options) => {
|
11463
|
-
const { schema:
|
11464
|
-
if (!(
|
11463
|
+
const { schema: schema5, out, config, breakpoints, custom: custom2 } = options;
|
11464
|
+
if (!(schema5 && out)) {
|
11465
11465
|
const drizzleConfig = await drizzleConfigFromFile(config);
|
11466
11466
|
if (!drizzleConfig.out) {
|
11467
11467
|
console.log("You must specify 'out' param in config file");
|
@@ -11475,20 +11475,20 @@ var init_utils = __esm({
|
|
11475
11475
|
bundle: drizzleConfig.driver === "expo"
|
11476
11476
|
};
|
11477
11477
|
}
|
11478
|
-
if (!
|
11478
|
+
if (!schema5) {
|
11479
11479
|
console.error(`'schema' param must be set`);
|
11480
11480
|
process.exit(1);
|
11481
11481
|
}
|
11482
|
-
const fileNames = prepareFilenames(
|
11482
|
+
const fileNames = prepareFilenames(schema5);
|
11483
11483
|
if (fileNames.length === 0) {
|
11484
|
-
(0, import_hanji2.render)(`[${source_default.blue("i")}] No schema file in ${
|
11484
|
+
(0, import_hanji2.render)(`[${source_default.blue("i")}] No schema file in ${schema5} was found`);
|
11485
11485
|
process.exit(0);
|
11486
11486
|
}
|
11487
11487
|
if (!out) {
|
11488
11488
|
console.error(`'out' param must be set`);
|
11489
11489
|
process.exit(1);
|
11490
11490
|
}
|
11491
|
-
return { schema:
|
11491
|
+
return { schema: schema5, out, breakpoints, custom: custom2, bundle: false };
|
11492
11492
|
};
|
11493
11493
|
assertOutFolder = async (it) => {
|
11494
11494
|
if ("out" in it)
|
@@ -11793,7 +11793,7 @@ var init_mysqlSerializer = __esm({
|
|
11793
11793
|
columns,
|
11794
11794
|
indexes,
|
11795
11795
|
foreignKeys,
|
11796
|
-
schema:
|
11796
|
+
schema: schema5,
|
11797
11797
|
primaryKeys,
|
11798
11798
|
uniqueConstraints
|
11799
11799
|
} = (0, import_mysql_core3.getTableConfig)(table4);
|
@@ -11991,7 +11991,7 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
11991
11991
|
});
|
11992
11992
|
result[tableName] = {
|
11993
11993
|
name: tableName,
|
11994
|
-
schema:
|
11994
|
+
schema: schema5,
|
11995
11995
|
columns: columnsObject,
|
11996
11996
|
indexes: indexesObject,
|
11997
11997
|
foreignKeys: foreignKeysObject,
|
@@ -12038,9 +12038,9 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
12038
12038
|
if (progressCallback) {
|
12039
12039
|
progressCallback("columns", columnsCount, "fetching");
|
12040
12040
|
}
|
12041
|
-
const
|
12041
|
+
const schema5 = column7["TABLE_SCHEMA"];
|
12042
12042
|
const tableName = column7["TABLE_NAME"];
|
12043
|
-
tablesCount.add(`${
|
12043
|
+
tablesCount.add(`${schema5}.${tableName}`);
|
12044
12044
|
if (progressCallback) {
|
12045
12045
|
progressCallback("columns", tablesCount.size, "fetching");
|
12046
12046
|
}
|
@@ -12059,8 +12059,8 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
12059
12059
|
isAutoincrement = column7["EXTRA"] === "auto_increment";
|
12060
12060
|
isDefaultAnExpression = column7["EXTRA"].includes("DEFAULT_GENERATED");
|
12061
12061
|
}
|
12062
|
-
if (
|
12063
|
-
schemas.push(
|
12062
|
+
if (schema5 !== inputSchema) {
|
12063
|
+
schemas.push(schema5);
|
12064
12064
|
}
|
12065
12065
|
const table4 = result[tableName];
|
12066
12066
|
let changedType = columnType;
|
@@ -12110,7 +12110,7 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
12110
12110
|
if (!table4) {
|
12111
12111
|
result[tableName] = {
|
12112
12112
|
name: tableName,
|
12113
|
-
schema:
|
12113
|
+
schema: schema5 !== inputSchema ? schema5 : void 0,
|
12114
12114
|
columns: {
|
12115
12115
|
[columnName]: newColumn
|
12116
12116
|
},
|
@@ -12353,11 +12353,11 @@ var init_pgSerializer = __esm({
|
|
12353
12353
|
indexes,
|
12354
12354
|
foreignKeys,
|
12355
12355
|
checks,
|
12356
|
-
schema:
|
12356
|
+
schema: schema5,
|
12357
12357
|
primaryKeys,
|
12358
12358
|
uniqueConstraints
|
12359
12359
|
} = (0, import_pg_core3.getTableConfig)(table4);
|
12360
|
-
if (schemaFilter && !schemaFilter.includes(
|
12360
|
+
if (schemaFilter && !schemaFilter.includes(schema5 ?? "public")) {
|
12361
12361
|
continue;
|
12362
12362
|
}
|
12363
12363
|
const columnsObject = {};
|
@@ -12499,13 +12499,13 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
12499
12499
|
return it.name;
|
12500
12500
|
}
|
12501
12501
|
});
|
12502
|
-
if (typeof indexesInSchema[
|
12503
|
-
if (indexesInSchema[
|
12502
|
+
if (typeof indexesInSchema[schema5 ?? "public"] !== "undefined") {
|
12503
|
+
if (indexesInSchema[schema5 ?? "public"].includes(name)) {
|
12504
12504
|
console.log(
|
12505
12505
|
`
|
12506
12506
|
${withStyle.errorWarning(
|
12507
12507
|
`We've found duplicated index name across ${source_default.underline.blue(
|
12508
|
-
|
12508
|
+
schema5 ?? "public"
|
12509
12509
|
)} schema. Please rename your index in either the ${source_default.underline.blue(
|
12510
12510
|
tableName
|
12511
12511
|
)} table or the table with the duplicated index name`
|
@@ -12513,9 +12513,9 @@ ${withStyle.errorWarning(
|
|
12513
12513
|
);
|
12514
12514
|
process.exit(1);
|
12515
12515
|
}
|
12516
|
-
indexesInSchema[
|
12516
|
+
indexesInSchema[schema5 ?? "public"].push(name);
|
12517
12517
|
} else {
|
12518
|
-
indexesInSchema[
|
12518
|
+
indexesInSchema[schema5 ?? "public"] = [name];
|
12519
12519
|
}
|
12520
12520
|
indexesObject[name] = {
|
12521
12521
|
name,
|
@@ -12525,7 +12525,7 @@ ${withStyle.errorWarning(
|
|
12525
12525
|
});
|
12526
12526
|
result[tableName] = {
|
12527
12527
|
name: tableName,
|
12528
|
-
schema:
|
12528
|
+
schema: schema5 ?? "",
|
12529
12529
|
columns: columnsObject,
|
12530
12530
|
indexes: indexesObject,
|
12531
12531
|
foreignKeys: foreignKeysObject,
|
@@ -15508,9 +15508,9 @@ var init_sqlgenerator = __esm({
|
|
15508
15508
|
return statement.type === "create_table" && dialect6 === "pg";
|
15509
15509
|
}
|
15510
15510
|
convert(st) {
|
15511
|
-
const { tableName, schema:
|
15511
|
+
const { tableName, schema: schema5, columns, compositePKs, uniqueConstraints } = st;
|
15512
15512
|
let statement = "";
|
15513
|
-
const name =
|
15513
|
+
const name = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
|
15514
15514
|
statement += `CREATE TABLE IF NOT EXISTS ${name} (
|
15515
15515
|
`;
|
15516
15516
|
for (let i = 0; i < columns.length; i++) {
|
@@ -15547,9 +15547,9 @@ var init_sqlgenerator = __esm({
|
|
15547
15547
|
return statement.type === "create_table" && dialect6 === "mysql";
|
15548
15548
|
}
|
15549
15549
|
convert(st) {
|
15550
|
-
const { tableName, columns, schema:
|
15550
|
+
const { tableName, columns, schema: schema5, compositePKs, uniqueConstraints } = st;
|
15551
15551
|
let statement = "";
|
15552
|
-
const tName =
|
15552
|
+
const tName = schema5 ? `\`${schema5}\`.\`${tableName}\`` : `\`${tableName}\``;
|
15553
15553
|
statement += `CREATE TABLE ${tName} (
|
15554
15554
|
`;
|
15555
15555
|
for (let i = 0; i < columns.length; i++) {
|
@@ -15746,8 +15746,8 @@ var init_sqlgenerator = __esm({
|
|
15746
15746
|
return statement.type === "drop_table" && dialect6 === "pg";
|
15747
15747
|
}
|
15748
15748
|
convert(statement) {
|
15749
|
-
const { tableName, schema:
|
15750
|
-
const tableNameWithSchema =
|
15749
|
+
const { tableName, schema: schema5 } = statement;
|
15750
|
+
const tableNameWithSchema = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
|
15751
15751
|
return `DROP TABLE ${tableNameWithSchema};`;
|
15752
15752
|
}
|
15753
15753
|
};
|
@@ -15805,8 +15805,8 @@ var init_sqlgenerator = __esm({
|
|
15805
15805
|
return statement.type === "alter_table_rename_column" && dialect6 === "pg";
|
15806
15806
|
}
|
15807
15807
|
convert(statement) {
|
15808
|
-
const { tableName, oldColumnName, newColumnName, schema:
|
15809
|
-
const tableNameWithSchema =
|
15808
|
+
const { tableName, oldColumnName, newColumnName, schema: schema5 } = statement;
|
15809
|
+
const tableNameWithSchema = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
|
15810
15810
|
return `ALTER TABLE ${tableNameWithSchema} RENAME COLUMN "${oldColumnName}" TO "${newColumnName}";`;
|
15811
15811
|
}
|
15812
15812
|
};
|
@@ -15833,8 +15833,8 @@ var init_sqlgenerator = __esm({
|
|
15833
15833
|
return statement.type === "alter_table_drop_column" && dialect6 === "pg";
|
15834
15834
|
}
|
15835
15835
|
convert(statement) {
|
15836
|
-
const { tableName, columnName, schema:
|
15837
|
-
const tableNameWithSchema =
|
15836
|
+
const { tableName, columnName, schema: schema5 } = statement;
|
15837
|
+
const tableNameWithSchema = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
|
15838
15838
|
return `ALTER TABLE ${tableNameWithSchema} DROP COLUMN IF EXISTS "${columnName}";`;
|
15839
15839
|
}
|
15840
15840
|
};
|
@@ -15861,9 +15861,9 @@ var init_sqlgenerator = __esm({
|
|
15861
15861
|
return statement.type === "alter_table_add_column" && dialect6 === "pg";
|
15862
15862
|
}
|
15863
15863
|
convert(statement) {
|
15864
|
-
const { tableName, column: column7, schema:
|
15864
|
+
const { tableName, column: column7, schema: schema5 } = statement;
|
15865
15865
|
const { name, type, notNull } = column7;
|
15866
|
-
const tableNameWithSchema =
|
15866
|
+
const tableNameWithSchema = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
|
15867
15867
|
const defaultStatement = `${column7.default !== void 0 ? ` DEFAULT ${column7.default}` : ""}`;
|
15868
15868
|
const fixedType = isPgNativeType(column7.type) ? column7.type : `"${column7.type}"`;
|
15869
15869
|
const notNullStatement = `${notNull ? " NOT NULL" : ""}`;
|
@@ -15905,8 +15905,8 @@ var init_sqlgenerator = __esm({
|
|
15905
15905
|
return statement.type === "alter_table_alter_column_set_type" && dialect6 === "pg";
|
15906
15906
|
}
|
15907
15907
|
convert(statement) {
|
15908
|
-
const { tableName, columnName, newDataType, schema:
|
15909
|
-
const tableNameWithSchema =
|
15908
|
+
const { tableName, columnName, newDataType, schema: schema5 } = statement;
|
15909
|
+
const tableNameWithSchema = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
|
15910
15910
|
return `ALTER TABLE ${tableNameWithSchema} ALTER COLUMN "${columnName}" SET DATA TYPE ${newDataType};`;
|
15911
15911
|
}
|
15912
15912
|
};
|
@@ -15930,8 +15930,8 @@ var init_sqlgenerator = __esm({
|
|
15930
15930
|
return statement.type === "alter_table_alter_column_set_default" && dialect6 === "pg";
|
15931
15931
|
}
|
15932
15932
|
convert(statement) {
|
15933
|
-
const { tableName, columnName, schema:
|
15934
|
-
const tableNameWithSchema =
|
15933
|
+
const { tableName, columnName, schema: schema5 } = statement;
|
15934
|
+
const tableNameWithSchema = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
|
15935
15935
|
return `ALTER TABLE ${tableNameWithSchema} ALTER COLUMN "${columnName}" SET DEFAULT ${statement.newDefaultValue};`;
|
15936
15936
|
}
|
15937
15937
|
};
|
@@ -15955,8 +15955,8 @@ var init_sqlgenerator = __esm({
|
|
15955
15955
|
return statement.type === "alter_table_alter_column_drop_default" && dialect6 === "pg";
|
15956
15956
|
}
|
15957
15957
|
convert(statement) {
|
15958
|
-
const { tableName, columnName, schema:
|
15959
|
-
const tableNameWithSchema =
|
15958
|
+
const { tableName, columnName, schema: schema5 } = statement;
|
15959
|
+
const tableNameWithSchema = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
|
15960
15960
|
return `ALTER TABLE ${tableNameWithSchema} ALTER COLUMN "${columnName}" DROP DEFAULT;`;
|
15961
15961
|
}
|
15962
15962
|
};
|
@@ -16220,7 +16220,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
16220
16220
|
return statement.type === "alter_table_alter_column_drop_pk" && dialect6 === "pg";
|
16221
16221
|
}
|
16222
16222
|
convert(statement) {
|
16223
|
-
const { tableName, columnName, schema:
|
16223
|
+
const { tableName, columnName, schema: schema5 } = statement;
|
16224
16224
|
return `/*
|
16225
16225
|
Unfortunately in current drizzle-kit version we can't automatically get name for primary key.
|
16226
16226
|
We are working on making it available!
|
@@ -16228,7 +16228,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
16228
16228
|
Meanwhile you can:
|
16229
16229
|
1. Check pk name in your database, by running
|
16230
16230
|
SELECT constraint_name FROM information_schema.table_constraints
|
16231
|
-
WHERE table_schema = '${typeof
|
16231
|
+
WHERE table_schema = '${typeof schema5 === "undefined" || schema5 === "" ? "public" : schema5}'
|
16232
16232
|
AND table_name = '${tableName}'
|
16233
16233
|
AND constraint_type = 'PRIMARY KEY';
|
16234
16234
|
2. Uncomment code below and paste pk name manually
|
@@ -16543,8 +16543,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
16543
16543
|
return statement.type === "alter_table_set_schema" && dialect6 === "pg";
|
16544
16544
|
}
|
16545
16545
|
convert(statement) {
|
16546
|
-
const { tableName, schema:
|
16547
|
-
return `ALTER TABLE "${tableName}" SET SCHEMA "${
|
16546
|
+
const { tableName, schema: schema5 } = statement;
|
16547
|
+
return `ALTER TABLE "${tableName}" SET SCHEMA "${schema5}";
|
16548
16548
|
`;
|
16549
16549
|
}
|
16550
16550
|
};
|
@@ -16564,8 +16564,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
16564
16564
|
return statement.type === "alter_table_remove_from_schema" && dialect6 === "pg";
|
16565
16565
|
}
|
16566
16566
|
convert(statement) {
|
16567
|
-
const { tableName, schema:
|
16568
|
-
const tableNameWithSchema =
|
16567
|
+
const { tableName, schema: schema5 } = statement;
|
16568
|
+
const tableNameWithSchema = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
|
16569
16569
|
return `ALTER TABLE ${tableNameWithSchema} SET SCHEMA public;
|
16570
16570
|
`;
|
16571
16571
|
}
|
@@ -16604,9 +16604,9 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
16604
16604
|
return statement.type === "alter_table_set_schema" && dialect6 === "mysql";
|
16605
16605
|
}
|
16606
16606
|
convert(statement) {
|
16607
|
-
const { tableName, schema:
|
16607
|
+
const { tableName, schema: schema5 } = statement;
|
16608
16608
|
const nameFrom = `\`${tableName}\``;
|
16609
|
-
const nameTo = `\`${
|
16609
|
+
const nameTo = `\`${schema5}\`.\`${tableName}\``;
|
16610
16610
|
return `RENAME TABLE ${nameFrom} TO ${nameTo};
|
16611
16611
|
`;
|
16612
16612
|
}
|
@@ -16628,8 +16628,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
16628
16628
|
return statement.type === "alter_table_remove_from_schema" && dialect6 === "mysql";
|
16629
16629
|
}
|
16630
16630
|
convert(statement) {
|
16631
|
-
const { tableName, schema:
|
16632
|
-
const nameFrom = `\`${
|
16631
|
+
const { tableName, schema: schema5 } = statement;
|
16632
|
+
const nameFrom = `\`${schema5}\`.\`${tableName}\``;
|
16633
16633
|
const nameTo = `\`${tableName}\``;
|
16634
16634
|
return `RENAME TABLE ${nameFrom} TO ${nameTo};
|
16635
16635
|
`;
|
@@ -16771,11 +16771,11 @@ var init_jsonStatements = __esm({
|
|
16771
16771
|
init_pgSchema();
|
16772
16772
|
init_sqliteSchema();
|
16773
16773
|
preparePgCreateTableJson = (table4, json2) => {
|
16774
|
-
const { name, schema:
|
16774
|
+
const { name, schema: schema5, columns, compositePrimaryKeys, uniqueConstraints } = table4;
|
16775
16775
|
return {
|
16776
16776
|
type: "create_table",
|
16777
16777
|
tableName: name,
|
16778
|
-
schema:
|
16778
|
+
schema: schema5,
|
16779
16779
|
columns: Object.values(columns),
|
16780
16780
|
compositePKs: Object.values(compositePrimaryKeys),
|
16781
16781
|
compositePkName: Object.values(compositePrimaryKeys).length > 0 ? json2.tables[name].compositePrimaryKeys[`${PgSquasher.unsquashPK(
|
@@ -16785,11 +16785,11 @@ var init_jsonStatements = __esm({
|
|
16785
16785
|
};
|
16786
16786
|
};
|
16787
16787
|
prepareMySqlCreateTableJson = (table4, json2) => {
|
16788
|
-
const { name, schema:
|
16788
|
+
const { name, schema: schema5, columns, compositePrimaryKeys, uniqueConstraints } = table4;
|
16789
16789
|
return {
|
16790
16790
|
type: "create_table",
|
16791
16791
|
tableName: name,
|
16792
|
-
schema:
|
16792
|
+
schema: schema5,
|
16793
16793
|
columns: Object.values(columns),
|
16794
16794
|
compositePKs: Object.values(compositePrimaryKeys),
|
16795
16795
|
compositePkName: Object.values(compositePrimaryKeys).length > 0 ? json2.tables[name].compositePrimaryKeys[MySqlSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name].name : "",
|
@@ -16868,21 +16868,21 @@ var init_jsonStatements = __esm({
|
|
16868
16868
|
};
|
16869
16869
|
});
|
16870
16870
|
};
|
16871
|
-
prepareRenameColumns = (tableName,
|
16871
|
+
prepareRenameColumns = (tableName, schema5, pairs) => {
|
16872
16872
|
return pairs.map((it) => {
|
16873
16873
|
return {
|
16874
16874
|
type: "alter_table_rename_column",
|
16875
16875
|
tableName,
|
16876
16876
|
oldColumnName: it.from.name,
|
16877
16877
|
newColumnName: it.to.name,
|
16878
|
-
schema:
|
16878
|
+
schema: schema5
|
16879
16879
|
};
|
16880
16880
|
});
|
16881
16881
|
};
|
16882
|
-
prepareAlterTableColumnsJson = (tableName,
|
16882
|
+
prepareAlterTableColumnsJson = (tableName, schema5, deleted, added, altered, addedFk, json2, dialect6) => {
|
16883
16883
|
const addColumns = [];
|
16884
|
-
const dropColumns = _prepareDropColumns(tableName,
|
16885
|
-
const alterColumns = _prepareAlterColumns(tableName,
|
16884
|
+
const dropColumns = _prepareDropColumns(tableName, schema5, deleted);
|
16885
|
+
const alterColumns = _prepareAlterColumns(tableName, schema5, altered, json2);
|
16886
16886
|
if (dialect6 === "sqlite") {
|
16887
16887
|
let jsonCreateFKStatements = Object.values(addedFk);
|
16888
16888
|
const sqliteAddColumns = _prepareSQLiteAddColumns(
|
@@ -16892,27 +16892,27 @@ var init_jsonStatements = __esm({
|
|
16892
16892
|
);
|
16893
16893
|
addColumns.push(...sqliteAddColumns);
|
16894
16894
|
} else {
|
16895
|
-
addColumns.push(..._prepareAddColumns(tableName,
|
16895
|
+
addColumns.push(..._prepareAddColumns(tableName, schema5, added));
|
16896
16896
|
}
|
16897
16897
|
return { addColumns, dropColumns, alterColumns };
|
16898
16898
|
};
|
16899
|
-
_prepareDropColumns = (taleName,
|
16899
|
+
_prepareDropColumns = (taleName, schema5, columns) => {
|
16900
16900
|
return columns.map((it) => {
|
16901
16901
|
return {
|
16902
16902
|
type: "alter_table_drop_column",
|
16903
16903
|
tableName: taleName,
|
16904
16904
|
columnName: it.name,
|
16905
|
-
schema:
|
16905
|
+
schema: schema5
|
16906
16906
|
};
|
16907
16907
|
});
|
16908
16908
|
};
|
16909
|
-
_prepareAddColumns = (tableName,
|
16909
|
+
_prepareAddColumns = (tableName, schema5, columns) => {
|
16910
16910
|
return columns.map((it) => {
|
16911
16911
|
return {
|
16912
16912
|
type: "alter_table_add_column",
|
16913
16913
|
tableName,
|
16914
16914
|
column: it,
|
16915
|
-
schema:
|
16915
|
+
schema: schema5
|
16916
16916
|
};
|
16917
16917
|
});
|
16918
16918
|
};
|
@@ -16932,7 +16932,7 @@ var init_jsonStatements = __esm({
|
|
16932
16932
|
};
|
16933
16933
|
});
|
16934
16934
|
};
|
16935
|
-
_prepareAlterColumns = (tableName,
|
16935
|
+
_prepareAlterColumns = (tableName, schema5, columns, json2) => {
|
16936
16936
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
16937
16937
|
let statements = [];
|
16938
16938
|
let dropPkStatements = [];
|
@@ -16950,7 +16950,7 @@ var init_jsonStatements = __esm({
|
|
16950
16950
|
type: "alter_table_alter_column_set_autoincrement",
|
16951
16951
|
tableName,
|
16952
16952
|
columnName,
|
16953
|
-
schema:
|
16953
|
+
schema: schema5,
|
16954
16954
|
newDataType: columnType,
|
16955
16955
|
columnDefault,
|
16956
16956
|
columnOnUpdate,
|
@@ -16965,7 +16965,7 @@ var init_jsonStatements = __esm({
|
|
16965
16965
|
type,
|
16966
16966
|
tableName,
|
16967
16967
|
columnName,
|
16968
|
-
schema:
|
16968
|
+
schema: schema5,
|
16969
16969
|
newDataType: columnType,
|
16970
16970
|
columnDefault,
|
16971
16971
|
columnOnUpdate,
|
@@ -16979,7 +16979,7 @@ var init_jsonStatements = __esm({
|
|
16979
16979
|
type: "alter_table_alter_column_drop_autoincrement",
|
16980
16980
|
tableName,
|
16981
16981
|
columnName,
|
16982
|
-
schema:
|
16982
|
+
schema: schema5,
|
16983
16983
|
newDataType: columnType,
|
16984
16984
|
columnDefault,
|
16985
16985
|
columnOnUpdate,
|
@@ -17004,7 +17004,7 @@ var init_jsonStatements = __esm({
|
|
17004
17004
|
tableName,
|
17005
17005
|
oldColumnName: column7.name.old,
|
17006
17006
|
newColumnName: column7.name.new,
|
17007
|
-
schema:
|
17007
|
+
schema: schema5
|
17008
17008
|
});
|
17009
17009
|
}
|
17010
17010
|
if (((_d = column7.type) == null ? void 0 : _d.type) === "changed") {
|
@@ -17014,7 +17014,7 @@ var init_jsonStatements = __esm({
|
|
17014
17014
|
columnName,
|
17015
17015
|
newDataType: column7.type.new,
|
17016
17016
|
oldDataType: column7.type.old,
|
17017
|
-
schema:
|
17017
|
+
schema: schema5,
|
17018
17018
|
columnDefault,
|
17019
17019
|
columnOnUpdate,
|
17020
17020
|
columnNotNull,
|
@@ -17028,7 +17028,7 @@ var init_jsonStatements = __esm({
|
|
17028
17028
|
type: "alter_table_alter_column_drop_pk",
|
17029
17029
|
tableName,
|
17030
17030
|
columnName,
|
17031
|
-
schema:
|
17031
|
+
schema: schema5
|
17032
17032
|
});
|
17033
17033
|
}
|
17034
17034
|
if (((_g = column7.default) == null ? void 0 : _g.type) === "added") {
|
@@ -17037,7 +17037,7 @@ var init_jsonStatements = __esm({
|
|
17037
17037
|
tableName,
|
17038
17038
|
columnName,
|
17039
17039
|
newDefaultValue: column7.default.value,
|
17040
|
-
schema:
|
17040
|
+
schema: schema5,
|
17041
17041
|
columnOnUpdate,
|
17042
17042
|
columnNotNull,
|
17043
17043
|
columnAutoIncrement,
|
@@ -17052,7 +17052,7 @@ var init_jsonStatements = __esm({
|
|
17052
17052
|
columnName,
|
17053
17053
|
newDefaultValue: column7.default.new,
|
17054
17054
|
oldDefaultValue: column7.default.old,
|
17055
|
-
schema:
|
17055
|
+
schema: schema5,
|
17056
17056
|
columnOnUpdate,
|
17057
17057
|
columnNotNull,
|
17058
17058
|
columnAutoIncrement,
|
@@ -17065,7 +17065,7 @@ var init_jsonStatements = __esm({
|
|
17065
17065
|
type: "alter_table_alter_column_drop_default",
|
17066
17066
|
tableName,
|
17067
17067
|
columnName,
|
17068
|
-
schema:
|
17068
|
+
schema: schema5,
|
17069
17069
|
columnDefault,
|
17070
17070
|
columnOnUpdate,
|
17071
17071
|
columnNotNull,
|
@@ -17079,7 +17079,7 @@ var init_jsonStatements = __esm({
|
|
17079
17079
|
type: "alter_table_alter_column_set_notnull",
|
17080
17080
|
tableName,
|
17081
17081
|
columnName,
|
17082
|
-
schema:
|
17082
|
+
schema: schema5,
|
17083
17083
|
newDataType: columnType,
|
17084
17084
|
columnDefault,
|
17085
17085
|
columnOnUpdate,
|
@@ -17094,7 +17094,7 @@ var init_jsonStatements = __esm({
|
|
17094
17094
|
type,
|
17095
17095
|
tableName,
|
17096
17096
|
columnName,
|
17097
|
-
schema:
|
17097
|
+
schema: schema5,
|
17098
17098
|
newDataType: columnType,
|
17099
17099
|
columnDefault,
|
17100
17100
|
columnOnUpdate,
|
@@ -17108,7 +17108,7 @@ var init_jsonStatements = __esm({
|
|
17108
17108
|
type: "alter_table_alter_column_drop_notnull",
|
17109
17109
|
tableName,
|
17110
17110
|
columnName,
|
17111
|
-
schema:
|
17111
|
+
schema: schema5,
|
17112
17112
|
newDataType: columnType,
|
17113
17113
|
columnDefault,
|
17114
17114
|
columnOnUpdate,
|
@@ -17125,7 +17125,7 @@ var init_jsonStatements = __esm({
|
|
17125
17125
|
setPkStatements.push({
|
17126
17126
|
type: "alter_table_alter_column_set_pk",
|
17127
17127
|
tableName,
|
17128
|
-
schema:
|
17128
|
+
schema: schema5,
|
17129
17129
|
columnName
|
17130
17130
|
});
|
17131
17131
|
}
|
@@ -17135,7 +17135,7 @@ var init_jsonStatements = __esm({
|
|
17135
17135
|
type: "alter_table_alter_column_set_on_update",
|
17136
17136
|
tableName,
|
17137
17137
|
columnName,
|
17138
|
-
schema:
|
17138
|
+
schema: schema5,
|
17139
17139
|
newDataType: columnType,
|
17140
17140
|
columnDefault,
|
17141
17141
|
columnOnUpdate,
|
@@ -17149,7 +17149,7 @@ var init_jsonStatements = __esm({
|
|
17149
17149
|
type: "alter_table_alter_column_drop_on_update",
|
17150
17150
|
tableName,
|
17151
17151
|
columnName,
|
17152
|
-
schema:
|
17152
|
+
schema: schema5,
|
17153
17153
|
newDataType: columnType,
|
17154
17154
|
columnDefault,
|
17155
17155
|
columnOnUpdate,
|
@@ -17161,60 +17161,60 @@ var init_jsonStatements = __esm({
|
|
17161
17161
|
}
|
17162
17162
|
return [...dropPkStatements, ...setPkStatements, ...statements];
|
17163
17163
|
};
|
17164
|
-
prepareCreateIndexesJson = (tableName,
|
17164
|
+
prepareCreateIndexesJson = (tableName, schema5, indexes) => {
|
17165
17165
|
return Object.values(indexes).map((indexData) => {
|
17166
17166
|
return {
|
17167
17167
|
type: "create_index",
|
17168
17168
|
tableName,
|
17169
17169
|
data: indexData,
|
17170
|
-
schema:
|
17170
|
+
schema: schema5
|
17171
17171
|
};
|
17172
17172
|
});
|
17173
17173
|
};
|
17174
|
-
prepareCreateReferencesJson = (tableName,
|
17174
|
+
prepareCreateReferencesJson = (tableName, schema5, foreignKeys) => {
|
17175
17175
|
return Object.values(foreignKeys).map((fkData) => {
|
17176
17176
|
return {
|
17177
17177
|
type: "create_reference",
|
17178
17178
|
tableName,
|
17179
17179
|
data: fkData,
|
17180
|
-
schema:
|
17180
|
+
schema: schema5
|
17181
17181
|
};
|
17182
17182
|
});
|
17183
17183
|
};
|
17184
|
-
prepareDropReferencesJson = (tableName,
|
17184
|
+
prepareDropReferencesJson = (tableName, schema5, foreignKeys) => {
|
17185
17185
|
return Object.values(foreignKeys).map((fkData) => {
|
17186
17186
|
return {
|
17187
17187
|
type: "delete_reference",
|
17188
17188
|
tableName,
|
17189
17189
|
data: fkData,
|
17190
|
-
schema:
|
17190
|
+
schema: schema5
|
17191
17191
|
};
|
17192
17192
|
});
|
17193
17193
|
};
|
17194
|
-
prepareAlterReferencesJson = (tableName,
|
17194
|
+
prepareAlterReferencesJson = (tableName, schema5, foreignKeys) => {
|
17195
17195
|
const keys = Object.keys(foreignKeys);
|
17196
17196
|
const stmts = [];
|
17197
17197
|
if (keys.length > 0) {
|
17198
17198
|
stmts.push(
|
17199
|
-
...prepareDropReferencesJson(tableName,
|
17199
|
+
...prepareDropReferencesJson(tableName, schema5, {
|
17200
17200
|
[keys[0]]: foreignKeys[keys[0]].__old
|
17201
17201
|
})
|
17202
17202
|
);
|
17203
17203
|
stmts.push(
|
17204
|
-
...prepareCreateReferencesJson(tableName,
|
17204
|
+
...prepareCreateReferencesJson(tableName, schema5, {
|
17205
17205
|
[keys[0]]: foreignKeys[keys[0]].__new
|
17206
17206
|
})
|
17207
17207
|
);
|
17208
17208
|
}
|
17209
17209
|
return stmts;
|
17210
17210
|
};
|
17211
|
-
prepareDropIndexesJson = (tableName,
|
17211
|
+
prepareDropIndexesJson = (tableName, schema5, indexes) => {
|
17212
17212
|
return Object.values(indexes).map((indexData) => {
|
17213
17213
|
return {
|
17214
17214
|
type: "drop_index",
|
17215
17215
|
tableName,
|
17216
17216
|
data: indexData,
|
17217
|
-
schema:
|
17217
|
+
schema: schema5
|
17218
17218
|
};
|
17219
17219
|
});
|
17220
17220
|
};
|
@@ -17246,59 +17246,59 @@ var init_jsonStatements = __esm({
|
|
17246
17246
|
};
|
17247
17247
|
});
|
17248
17248
|
};
|
17249
|
-
prepareAddCompositePrimaryKeyPg = (tableName,
|
17249
|
+
prepareAddCompositePrimaryKeyPg = (tableName, schema5, pks, json2) => {
|
17250
17250
|
return Object.values(pks).map((it) => {
|
17251
17251
|
const unsquashed = PgSquasher.unsquashPK(it);
|
17252
17252
|
return {
|
17253
17253
|
type: "create_composite_pk",
|
17254
17254
|
tableName,
|
17255
17255
|
data: it,
|
17256
|
-
schema:
|
17256
|
+
schema: schema5,
|
17257
17257
|
constraintName: json2.tables[tableName].compositePrimaryKeys[unsquashed.name].name
|
17258
17258
|
};
|
17259
17259
|
});
|
17260
17260
|
};
|
17261
|
-
prepareDeleteCompositePrimaryKeyPg = (tableName,
|
17261
|
+
prepareDeleteCompositePrimaryKeyPg = (tableName, schema5, pks, json1) => {
|
17262
17262
|
return Object.values(pks).map((it) => {
|
17263
17263
|
return {
|
17264
17264
|
type: "delete_composite_pk",
|
17265
17265
|
tableName,
|
17266
17266
|
data: it,
|
17267
|
-
schema:
|
17267
|
+
schema: schema5,
|
17268
17268
|
constraintName: json1.tables[tableName].compositePrimaryKeys[PgSquasher.unsquashPK(it).name].name
|
17269
17269
|
};
|
17270
17270
|
});
|
17271
17271
|
};
|
17272
|
-
prepareAlterCompositePrimaryKeyPg = (tableName,
|
17272
|
+
prepareAlterCompositePrimaryKeyPg = (tableName, schema5, pks, json1, json2) => {
|
17273
17273
|
return Object.values(pks).map((it) => {
|
17274
17274
|
return {
|
17275
17275
|
type: "alter_composite_pk",
|
17276
17276
|
tableName,
|
17277
17277
|
old: it.__old,
|
17278
17278
|
new: it.__new,
|
17279
|
-
schema:
|
17279
|
+
schema: schema5,
|
17280
17280
|
oldConstraintName: json1.tables[tableName].compositePrimaryKeys[PgSquasher.unsquashPK(it.__old).name].name,
|
17281
17281
|
newConstraintName: json2.tables[tableName].compositePrimaryKeys[PgSquasher.unsquashPK(it.__new).name].name
|
17282
17282
|
};
|
17283
17283
|
});
|
17284
17284
|
};
|
17285
|
-
prepareAddUniqueConstraintPg = (tableName,
|
17285
|
+
prepareAddUniqueConstraintPg = (tableName, schema5, unqs) => {
|
17286
17286
|
return Object.values(unqs).map((it) => {
|
17287
17287
|
return {
|
17288
17288
|
type: "create_unique_constraint",
|
17289
17289
|
tableName,
|
17290
17290
|
data: it,
|
17291
|
-
schema:
|
17291
|
+
schema: schema5
|
17292
17292
|
};
|
17293
17293
|
});
|
17294
17294
|
};
|
17295
|
-
prepareDeleteUniqueConstraintPg = (tableName,
|
17295
|
+
prepareDeleteUniqueConstraintPg = (tableName, schema5, unqs) => {
|
17296
17296
|
return Object.values(unqs).map((it) => {
|
17297
17297
|
return {
|
17298
17298
|
type: "delete_unique_constraint",
|
17299
17299
|
tableName,
|
17300
17300
|
data: it,
|
17301
|
-
schema:
|
17301
|
+
schema: schema5
|
17302
17302
|
};
|
17303
17303
|
});
|
17304
17304
|
};
|
@@ -17355,58 +17355,58 @@ var init_snapshotsDiffer = __esm({
|
|
17355
17355
|
init_utils2();
|
17356
17356
|
init_sqliteSchema();
|
17357
17357
|
init_mysqlSchema();
|
17358
|
-
makeChanged = (
|
17358
|
+
makeChanged = (schema5) => {
|
17359
17359
|
return objectType({
|
17360
17360
|
type: enumType(["changed"]),
|
17361
|
-
old:
|
17362
|
-
new:
|
17361
|
+
old: schema5,
|
17362
|
+
new: schema5
|
17363
17363
|
});
|
17364
17364
|
};
|
17365
|
-
makeSelfOrChanged = (
|
17365
|
+
makeSelfOrChanged = (schema5) => {
|
17366
17366
|
return unionType([
|
17367
|
-
|
17367
|
+
schema5,
|
17368
17368
|
objectType({
|
17369
17369
|
type: enumType(["changed"]),
|
17370
|
-
old:
|
17371
|
-
new:
|
17370
|
+
old: schema5,
|
17371
|
+
new: schema5
|
17372
17372
|
})
|
17373
17373
|
]);
|
17374
17374
|
};
|
17375
|
-
makePatched = (
|
17375
|
+
makePatched = (schema5) => {
|
17376
17376
|
return unionType([
|
17377
17377
|
objectType({
|
17378
17378
|
type: literalType("added"),
|
17379
|
-
value:
|
17379
|
+
value: schema5
|
17380
17380
|
}),
|
17381
17381
|
objectType({
|
17382
17382
|
type: literalType("deleted"),
|
17383
|
-
value:
|
17383
|
+
value: schema5
|
17384
17384
|
}),
|
17385
17385
|
objectType({
|
17386
17386
|
type: literalType("changed"),
|
17387
|
-
old:
|
17388
|
-
new:
|
17387
|
+
old: schema5,
|
17388
|
+
new: schema5
|
17389
17389
|
})
|
17390
17390
|
]);
|
17391
17391
|
};
|
17392
|
-
makeSelfOrPatched = (
|
17392
|
+
makeSelfOrPatched = (schema5) => {
|
17393
17393
|
return unionType([
|
17394
17394
|
objectType({
|
17395
17395
|
type: literalType("none"),
|
17396
|
-
value:
|
17396
|
+
value: schema5.optional()
|
17397
17397
|
}),
|
17398
17398
|
objectType({
|
17399
17399
|
type: literalType("added"),
|
17400
|
-
value:
|
17400
|
+
value: schema5
|
17401
17401
|
}),
|
17402
17402
|
objectType({
|
17403
17403
|
type: literalType("deleted"),
|
17404
|
-
value:
|
17404
|
+
value: schema5
|
17405
17405
|
}),
|
17406
17406
|
objectType({
|
17407
17407
|
type: literalType("changed"),
|
17408
|
-
old:
|
17409
|
-
new:
|
17408
|
+
old: schema5,
|
17409
|
+
new: schema5
|
17410
17410
|
})
|
17411
17411
|
]);
|
17412
17412
|
};
|
@@ -17600,9 +17600,9 @@ var init_snapshotsDiffer = __esm({
|
|
17600
17600
|
created: table4.added,
|
17601
17601
|
deleted: table4.deleted
|
17602
17602
|
});
|
17603
|
-
const
|
17603
|
+
const schema5 = valueFromSelfOrPatchedNew(table4.schema);
|
17604
17604
|
jsonRenameColumnsStatements.push(
|
17605
|
-
...prepareRenameColumns(table4.name,
|
17605
|
+
...prepareRenameColumns(table4.name, schema5, result.renamed)
|
17606
17606
|
);
|
17607
17607
|
const renamedColumnsAltered = result.renamed.map(
|
17608
17608
|
(it) => alteredColumnSchema.parse(diffForRenamedColumn(it.from, it.to))
|
@@ -17787,17 +17787,17 @@ var init_snapshotsDiffer = __esm({
|
|
17787
17787
|
});
|
17788
17788
|
const rColumns = jsonRenameColumnsStatements.map((it) => {
|
17789
17789
|
const tableName = it.tableName;
|
17790
|
-
const
|
17790
|
+
const schema5 = it.schema;
|
17791
17791
|
return {
|
17792
|
-
from: { schema:
|
17793
|
-
to: { schema:
|
17792
|
+
from: { schema: schema5, table: tableName, column: it.oldColumnName },
|
17793
|
+
to: { schema: schema5, table: tableName, column: it.newColumnName }
|
17794
17794
|
};
|
17795
17795
|
});
|
17796
17796
|
const jsonTableAlternations = allAlteredResolved.map((it) => {
|
17797
|
-
const
|
17797
|
+
const schema5 = valueFromSelfOrPatchedNew(it.schema);
|
17798
17798
|
return prepareAlterTableColumnsJson(
|
17799
17799
|
it.name,
|
17800
|
-
|
17800
|
+
schema5,
|
17801
17801
|
it.deleted,
|
17802
17802
|
it.added,
|
17803
17803
|
it.altered,
|
@@ -17815,15 +17815,15 @@ var init_snapshotsDiffer = __esm({
|
|
17815
17815
|
{ createColumns: [], dropColumns: [], alterColumns: [] }
|
17816
17816
|
);
|
17817
17817
|
const jsonCreateIndexesForAllAlteredTables = allAltered.map((it) => {
|
17818
|
-
const
|
17819
|
-
return prepareCreateIndexesJson(it.name,
|
17818
|
+
const schema5 = valueFromSelfOrPatchedNew(it.schema);
|
17819
|
+
return prepareCreateIndexesJson(it.name, schema5, it.addedIndexes || {});
|
17820
17820
|
}).flat();
|
17821
17821
|
const jsonDropIndexesForAllAlteredTables = allAltered.map((it) => {
|
17822
|
-
const
|
17823
|
-
return prepareDropIndexesJson(it.name,
|
17822
|
+
const schema5 = valueFromSelfOrPatchedNew(it.schema);
|
17823
|
+
return prepareDropIndexesJson(it.name, schema5, it.deletedIndexes || {});
|
17824
17824
|
}).flat();
|
17825
17825
|
allAltered.forEach((it) => {
|
17826
|
-
const
|
17826
|
+
const schema5 = valueFromSelfOrPatchedNew(it.schema);
|
17827
17827
|
const droppedIndexes = Object.keys(it.alteredIndexes).reduce(
|
17828
17828
|
(current, item) => {
|
17829
17829
|
current[item] = it.alteredIndexes[item].__old;
|
@@ -17839,30 +17839,30 @@ var init_snapshotsDiffer = __esm({
|
|
17839
17839
|
{}
|
17840
17840
|
);
|
17841
17841
|
jsonCreateIndexesForAllAlteredTables.push(
|
17842
|
-
...prepareCreateIndexesJson(it.name,
|
17842
|
+
...prepareCreateIndexesJson(it.name, schema5, createdIndexes || {})
|
17843
17843
|
);
|
17844
17844
|
jsonDropIndexesForAllAlteredTables.push(
|
17845
|
-
...prepareDropIndexesJson(it.name,
|
17845
|
+
...prepareDropIndexesJson(it.name, schema5, droppedIndexes || {})
|
17846
17846
|
);
|
17847
17847
|
});
|
17848
17848
|
const jsonCreateReferencesForCreatedTables = created.map((it) => {
|
17849
17849
|
return prepareCreateReferencesJson(it.name, it.schema, it.foreignKeys);
|
17850
17850
|
}).flat();
|
17851
17851
|
const jsonReferencesForAllAlteredTables = allAltered.map((it) => {
|
17852
|
-
const
|
17852
|
+
const schema5 = valueFromSelfOrPatchedNew(it.schema);
|
17853
17853
|
const forAdded = prepareCreateReferencesJson(
|
17854
17854
|
it.name,
|
17855
|
-
|
17855
|
+
schema5,
|
17856
17856
|
it.addedForeignKeys
|
17857
17857
|
);
|
17858
17858
|
const forAltered = prepareDropReferencesJson(
|
17859
17859
|
it.name,
|
17860
|
-
|
17860
|
+
schema5,
|
17861
17861
|
it.deletedForeignKeys
|
17862
17862
|
);
|
17863
17863
|
const alteredFKs = prepareAlterReferencesJson(
|
17864
17864
|
it.name,
|
17865
|
-
|
17865
|
+
schema5,
|
17866
17866
|
it.alteredForeignKeys
|
17867
17867
|
);
|
17868
17868
|
return [...forAdded, ...forAltered, ...alteredFKs];
|
@@ -18582,11 +18582,11 @@ var init_upFolders = __esm({
|
|
18582
18582
|
sql2
|
18583
18583
|
);
|
18584
18584
|
const tableName = table4.name;
|
18585
|
-
const
|
18585
|
+
const schema5 = typeof table4.schema === "string" ? table4.schema : "";
|
18586
18586
|
return result.renamed.map((it) => {
|
18587
18587
|
return {
|
18588
|
-
from: { schema:
|
18589
|
-
to: { schema:
|
18588
|
+
from: { schema: schema5, table: tableName, column: it.from.name },
|
18589
|
+
to: { schema: schema5, table: tableName, column: it.to.name }
|
18590
18590
|
};
|
18591
18591
|
});
|
18592
18592
|
}).flat();
|
@@ -18654,11 +18654,11 @@ var init_upFolders = __esm({
|
|
18654
18654
|
sql2
|
18655
18655
|
);
|
18656
18656
|
const tableName = table4.name;
|
18657
|
-
const
|
18657
|
+
const schema5 = typeof table4.schema === "string" ? table4.schema : "";
|
18658
18658
|
return result.renamed.map((it) => {
|
18659
18659
|
return {
|
18660
|
-
from: { schema:
|
18661
|
-
to: { schema:
|
18660
|
+
from: { schema: schema5, table: tableName, column: it.from.name },
|
18661
|
+
to: { schema: schema5, table: tableName, column: it.to.name }
|
18662
18662
|
};
|
18663
18663
|
});
|
18664
18664
|
}).flat();
|
@@ -18736,11 +18736,11 @@ var init_upFolders = __esm({
|
|
18736
18736
|
sql2
|
18737
18737
|
);
|
18738
18738
|
const tableName = table4.name;
|
18739
|
-
const
|
18739
|
+
const schema5 = typeof table4.schema === "string" ? table4.schema : "";
|
18740
18740
|
return result.renamed.map((it) => {
|
18741
18741
|
return {
|
18742
|
-
from: { schema:
|
18743
|
-
to: { schema:
|
18742
|
+
from: { schema: schema5, table: tableName, column: it.from.name },
|
18743
|
+
to: { schema: schema5, table: tableName, column: it.to.name }
|
18744
18744
|
};
|
18745
18745
|
});
|
18746
18746
|
}).flat();
|
@@ -19009,8 +19009,8 @@ var init_utils2 = __esm({
|
|
19009
19009
|
const out = it.schema ? `"${it.schema}"."${it.name}"` : `"${it.name}"`;
|
19010
19010
|
return out;
|
19011
19011
|
};
|
19012
|
-
columnRenameKey = (table4,
|
19013
|
-
const out =
|
19012
|
+
columnRenameKey = (table4, schema5, column7) => {
|
19013
|
+
const out = schema5 ? `"${schema5}"."${table4}"."${column7}"` : `"${table4}"."${column7}"`;
|
19014
19014
|
return out;
|
19015
19015
|
};
|
19016
19016
|
}
|
@@ -22108,7 +22108,7 @@ var init_mysql = __esm({
|
|
22108
22108
|
}
|
22109
22109
|
const {
|
22110
22110
|
out,
|
22111
|
-
schema:
|
22111
|
+
schema: schema5,
|
22112
22112
|
driver: driver2,
|
22113
22113
|
schemaFilter,
|
22114
22114
|
tablesFilter,
|
@@ -22118,7 +22118,7 @@ var init_mysql = __esm({
|
|
22118
22118
|
} = cliRes.data;
|
22119
22119
|
return {
|
22120
22120
|
out,
|
22121
|
-
schema:
|
22121
|
+
schema: schema5,
|
22122
22122
|
driver: driver2,
|
22123
22123
|
schemaFilter,
|
22124
22124
|
tablesFilter,
|
@@ -22154,7 +22154,7 @@ var init_mysql = __esm({
|
|
22154
22154
|
const {
|
22155
22155
|
strict,
|
22156
22156
|
verbose,
|
22157
|
-
schema:
|
22157
|
+
schema: schema5,
|
22158
22158
|
driver: driver2,
|
22159
22159
|
schemaFilter,
|
22160
22160
|
tablesFilter,
|
@@ -22162,7 +22162,7 @@ var init_mysql = __esm({
|
|
22162
22162
|
} = cliRes.data;
|
22163
22163
|
return {
|
22164
22164
|
driver: driver2,
|
22165
|
-
schema:
|
22165
|
+
schema: schema5,
|
22166
22166
|
strict,
|
22167
22167
|
verbose,
|
22168
22168
|
tablesFilter,
|
@@ -30217,7 +30217,7 @@ var require_createNode = __commonJS({
|
|
30217
30217
|
if (value instanceof String || value instanceof Number || value instanceof Boolean || typeof BigInt !== "undefined" && value instanceof BigInt) {
|
30218
30218
|
value = value.valueOf();
|
30219
30219
|
}
|
30220
|
-
const { aliasDuplicateObjects, onAnchor, onTagObj, schema:
|
30220
|
+
const { aliasDuplicateObjects, onAnchor, onTagObj, schema: schema5, sourceObjects } = ctx;
|
30221
30221
|
let ref = void 0;
|
30222
30222
|
if (aliasDuplicateObjects && value && typeof value === "object") {
|
30223
30223
|
ref = sourceObjects.get(value);
|
@@ -30232,7 +30232,7 @@ var require_createNode = __commonJS({
|
|
30232
30232
|
}
|
30233
30233
|
if (tagName == null ? void 0 : tagName.startsWith("!!"))
|
30234
30234
|
tagName = defaultTagPrefix + tagName.slice(2);
|
30235
|
-
let tagObj = findTagObject(value, tagName,
|
30235
|
+
let tagObj = findTagObject(value, tagName, schema5.tags);
|
30236
30236
|
if (!tagObj) {
|
30237
30237
|
if (value && typeof value.toJSON === "function") {
|
30238
30238
|
value = value.toJSON();
|
@@ -30243,7 +30243,7 @@ var require_createNode = __commonJS({
|
|
30243
30243
|
ref.node = node2;
|
30244
30244
|
return node2;
|
30245
30245
|
}
|
30246
|
-
tagObj = value instanceof Map ?
|
30246
|
+
tagObj = value instanceof Map ? schema5[identity.MAP] : Symbol.iterator in Object(value) ? schema5[identity.SEQ] : schema5[identity.MAP];
|
30247
30247
|
}
|
30248
30248
|
if (onTagObj) {
|
30249
30249
|
onTagObj(tagObj);
|
@@ -30269,7 +30269,7 @@ var require_Collection = __commonJS({
|
|
30269
30269
|
var createNode = require_createNode();
|
30270
30270
|
var identity = require_identity();
|
30271
30271
|
var Node3 = require_Node();
|
30272
|
-
function collectionFromPath(
|
30272
|
+
function collectionFromPath(schema5, path5, value) {
|
30273
30273
|
let v = value;
|
30274
30274
|
for (let i = path5.length - 1; i >= 0; --i) {
|
30275
30275
|
const k = path5[i];
|
@@ -30287,16 +30287,16 @@ var require_Collection = __commonJS({
|
|
30287
30287
|
onAnchor: () => {
|
30288
30288
|
throw new Error("This should not happen, please report a bug.");
|
30289
30289
|
},
|
30290
|
-
schema:
|
30290
|
+
schema: schema5,
|
30291
30291
|
sourceObjects: /* @__PURE__ */ new Map()
|
30292
30292
|
});
|
30293
30293
|
}
|
30294
30294
|
var isEmptyPath = (path5) => path5 == null || typeof path5 === "object" && !!path5[Symbol.iterator]().next().done;
|
30295
30295
|
var Collection = class extends Node3.NodeBase {
|
30296
|
-
constructor(type,
|
30296
|
+
constructor(type, schema5) {
|
30297
30297
|
super(type);
|
30298
30298
|
Object.defineProperty(this, "schema", {
|
30299
|
-
value:
|
30299
|
+
value: schema5,
|
30300
30300
|
configurable: true,
|
30301
30301
|
enumerable: false,
|
30302
30302
|
writable: true
|
@@ -30307,11 +30307,11 @@ var require_Collection = __commonJS({
|
|
30307
30307
|
*
|
30308
30308
|
* @param schema - If defined, overwrites the original's schema
|
30309
30309
|
*/
|
30310
|
-
clone(
|
30310
|
+
clone(schema5) {
|
30311
30311
|
const copy2 = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
30312
|
-
if (
|
30313
|
-
copy2.schema =
|
30314
|
-
copy2.items = copy2.items.map((it) => identity.isNode(it) || identity.isPair(it) ? it.clone(
|
30312
|
+
if (schema5)
|
30313
|
+
copy2.schema = schema5;
|
30314
|
+
copy2.items = copy2.items.map((it) => identity.isNode(it) || identity.isPair(it) ? it.clone(schema5) : it);
|
30315
30315
|
if (this.range)
|
30316
30316
|
copy2.range = this.range.slice();
|
30317
30317
|
return copy2;
|
@@ -31218,12 +31218,12 @@ var require_Pair = __commonJS({
|
|
31218
31218
|
this.key = key;
|
31219
31219
|
this.value = value;
|
31220
31220
|
}
|
31221
|
-
clone(
|
31221
|
+
clone(schema5) {
|
31222
31222
|
let { key, value } = this;
|
31223
31223
|
if (identity.isNode(key))
|
31224
|
-
key = key.clone(
|
31224
|
+
key = key.clone(schema5);
|
31225
31225
|
if (identity.isNode(value))
|
31226
|
-
value = value.clone(
|
31226
|
+
value = value.clone(schema5);
|
31227
31227
|
return new _Pair(key, value);
|
31228
31228
|
}
|
31229
31229
|
toJSON(_2, ctx) {
|
@@ -31417,17 +31417,17 @@ var require_YAMLMap = __commonJS({
|
|
31417
31417
|
static get tagName() {
|
31418
31418
|
return "tag:yaml.org,2002:map";
|
31419
31419
|
}
|
31420
|
-
constructor(
|
31421
|
-
super(identity.MAP,
|
31420
|
+
constructor(schema5) {
|
31421
|
+
super(identity.MAP, schema5);
|
31422
31422
|
this.items = [];
|
31423
31423
|
}
|
31424
31424
|
/**
|
31425
31425
|
* A generic collection parsing method that can be extended
|
31426
31426
|
* to other node classes that inherit from YAMLMap
|
31427
31427
|
*/
|
31428
|
-
static from(
|
31428
|
+
static from(schema5, obj, ctx) {
|
31429
31429
|
const { keepUndefined, replacer } = ctx;
|
31430
|
-
const map = new this(
|
31430
|
+
const map = new this(schema5);
|
31431
31431
|
const add = (key, value) => {
|
31432
31432
|
if (typeof replacer === "function")
|
31433
31433
|
value = replacer.call(obj, key, value);
|
@@ -31443,8 +31443,8 @@ var require_YAMLMap = __commonJS({
|
|
31443
31443
|
for (const key of Object.keys(obj))
|
31444
31444
|
add(key, obj[key]);
|
31445
31445
|
}
|
31446
|
-
if (typeof
|
31447
|
-
map.items.sort(
|
31446
|
+
if (typeof schema5.sortMapEntries === "function") {
|
31447
|
+
map.items.sort(schema5.sortMapEntries);
|
31448
31448
|
}
|
31449
31449
|
return map;
|
31450
31450
|
}
|
@@ -31552,7 +31552,7 @@ var require_map = __commonJS({
|
|
31552
31552
|
onError("Expected a mapping for this tag");
|
31553
31553
|
return map2;
|
31554
31554
|
},
|
31555
|
-
createNode: (
|
31555
|
+
createNode: (schema5, obj, ctx) => YAMLMap.YAMLMap.from(schema5, obj, ctx)
|
31556
31556
|
};
|
31557
31557
|
exports.map = map;
|
31558
31558
|
}
|
@@ -31572,8 +31572,8 @@ var require_YAMLSeq = __commonJS({
|
|
31572
31572
|
static get tagName() {
|
31573
31573
|
return "tag:yaml.org,2002:seq";
|
31574
31574
|
}
|
31575
|
-
constructor(
|
31576
|
-
super(identity.SEQ,
|
31575
|
+
constructor(schema5) {
|
31576
|
+
super(identity.SEQ, schema5);
|
31577
31577
|
this.items = [];
|
31578
31578
|
}
|
31579
31579
|
add(value) {
|
@@ -31648,9 +31648,9 @@ var require_YAMLSeq = __commonJS({
|
|
31648
31648
|
onComment
|
31649
31649
|
});
|
31650
31650
|
}
|
31651
|
-
static from(
|
31651
|
+
static from(schema5, obj, ctx) {
|
31652
31652
|
const { replacer } = ctx;
|
31653
|
-
const seq = new this(
|
31653
|
+
const seq = new this(schema5);
|
31654
31654
|
if (obj && Symbol.iterator in Object(obj)) {
|
31655
31655
|
let i = 0;
|
31656
31656
|
for (let it of obj) {
|
@@ -31690,7 +31690,7 @@ var require_seq = __commonJS({
|
|
31690
31690
|
onError("Expected a sequence for this tag");
|
31691
31691
|
return seq2;
|
31692
31692
|
},
|
31693
|
-
createNode: (
|
31693
|
+
createNode: (schema5, obj, ctx) => YAMLSeq.YAMLSeq.from(schema5, obj, ctx)
|
31694
31694
|
};
|
31695
31695
|
exports.seq = seq;
|
31696
31696
|
}
|
@@ -31886,7 +31886,7 @@ var require_schema = __commonJS({
|
|
31886
31886
|
var bool = require_bool();
|
31887
31887
|
var float = require_float();
|
31888
31888
|
var int = require_int();
|
31889
|
-
var
|
31889
|
+
var schema5 = [
|
31890
31890
|
map.map,
|
31891
31891
|
seq.seq,
|
31892
31892
|
string.string,
|
@@ -31899,7 +31899,7 @@ var require_schema = __commonJS({
|
|
31899
31899
|
float.floatExp,
|
31900
31900
|
float.float
|
31901
31901
|
];
|
31902
|
-
exports.schema =
|
31902
|
+
exports.schema = schema5;
|
31903
31903
|
}
|
31904
31904
|
});
|
31905
31905
|
|
@@ -31965,8 +31965,8 @@ var require_schema2 = __commonJS({
|
|
31965
31965
|
return str;
|
31966
31966
|
}
|
31967
31967
|
};
|
31968
|
-
var
|
31969
|
-
exports.schema =
|
31968
|
+
var schema5 = [map.map, seq.seq].concat(jsonScalars, jsonError);
|
31969
|
+
exports.schema = schema5;
|
31970
31970
|
}
|
31971
31971
|
});
|
31972
31972
|
|
@@ -32067,9 +32067,9 @@ ${cn.comment}` : item.comment;
|
|
32067
32067
|
onError("Expected a sequence for this tag");
|
32068
32068
|
return seq;
|
32069
32069
|
}
|
32070
|
-
function createPairs(
|
32070
|
+
function createPairs(schema5, iterable, ctx) {
|
32071
32071
|
const { replacer } = ctx;
|
32072
|
-
const pairs2 = new YAMLSeq.YAMLSeq(
|
32072
|
+
const pairs2 = new YAMLSeq.YAMLSeq(schema5);
|
32073
32073
|
pairs2.tag = "tag:yaml.org,2002:pairs";
|
32074
32074
|
let i = 0;
|
32075
32075
|
if (iterable && Symbol.iterator in Object(iterable))
|
@@ -32154,8 +32154,8 @@ var require_omap = __commonJS({
|
|
32154
32154
|
}
|
32155
32155
|
return map;
|
32156
32156
|
}
|
32157
|
-
static from(
|
32158
|
-
const pairs$1 = pairs.createPairs(
|
32157
|
+
static from(schema5, iterable, ctx) {
|
32158
|
+
const pairs$1 = pairs.createPairs(schema5, iterable, ctx);
|
32159
32159
|
const omap2 = new this();
|
32160
32160
|
omap2.items = pairs$1.items;
|
32161
32161
|
return omap2;
|
@@ -32182,7 +32182,7 @@ var require_omap = __commonJS({
|
|
32182
32182
|
}
|
32183
32183
|
return Object.assign(new YAMLOMap(), pairs$1);
|
32184
32184
|
},
|
32185
|
-
createNode: (
|
32185
|
+
createNode: (schema5, iterable, ctx) => YAMLOMap.from(schema5, iterable, ctx)
|
32186
32186
|
};
|
32187
32187
|
exports.YAMLOMap = YAMLOMap;
|
32188
32188
|
exports.omap = omap;
|
@@ -32357,8 +32357,8 @@ var require_set = __commonJS({
|
|
32357
32357
|
var Pair = require_Pair();
|
32358
32358
|
var YAMLMap = require_YAMLMap();
|
32359
32359
|
var YAMLSet = class _YAMLSet extends YAMLMap.YAMLMap {
|
32360
|
-
constructor(
|
32361
|
-
super(
|
32360
|
+
constructor(schema5) {
|
32361
|
+
super(schema5);
|
32362
32362
|
this.tag = _YAMLSet.tag;
|
32363
32363
|
}
|
32364
32364
|
add(key) {
|
@@ -32402,9 +32402,9 @@ var require_set = __commonJS({
|
|
32402
32402
|
else
|
32403
32403
|
throw new Error("Set items must all have null values");
|
32404
32404
|
}
|
32405
|
-
static from(
|
32405
|
+
static from(schema5, iterable, ctx) {
|
32406
32406
|
const { replacer } = ctx;
|
32407
|
-
const set3 = new this(
|
32407
|
+
const set3 = new this(schema5);
|
32408
32408
|
if (iterable && Symbol.iterator in Object(iterable))
|
32409
32409
|
for (let value of iterable) {
|
32410
32410
|
if (typeof replacer === "function")
|
@@ -32421,7 +32421,7 @@ var require_set = __commonJS({
|
|
32421
32421
|
nodeClass: YAMLSet,
|
32422
32422
|
default: false,
|
32423
32423
|
tag: "tag:yaml.org,2002:set",
|
32424
|
-
createNode: (
|
32424
|
+
createNode: (schema5, iterable, ctx) => YAMLSet.from(schema5, iterable, ctx),
|
32425
32425
|
resolve(map, onError) {
|
32426
32426
|
if (identity.isMap(map)) {
|
32427
32427
|
if (map.hasAllNullValues(true))
|
@@ -32542,7 +32542,7 @@ var require_schema3 = __commonJS({
|
|
32542
32542
|
var pairs = require_pairs();
|
32543
32543
|
var set2 = require_set();
|
32544
32544
|
var timestamp = require_timestamp();
|
32545
|
-
var
|
32545
|
+
var schema5 = [
|
32546
32546
|
map.map,
|
32547
32547
|
seq.seq,
|
32548
32548
|
string.string,
|
@@ -32564,7 +32564,7 @@ var require_schema3 = __commonJS({
|
|
32564
32564
|
timestamp.floatTime,
|
32565
32565
|
timestamp.timestamp
|
32566
32566
|
];
|
32567
|
-
exports.schema =
|
32567
|
+
exports.schema = schema5;
|
32568
32568
|
}
|
32569
32569
|
});
|
32570
32570
|
|
@@ -32579,7 +32579,7 @@ var require_tags = __commonJS({
|
|
32579
32579
|
var bool = require_bool();
|
32580
32580
|
var float = require_float();
|
32581
32581
|
var int = require_int();
|
32582
|
-
var
|
32582
|
+
var schema5 = require_schema();
|
32583
32583
|
var schema$1 = require_schema2();
|
32584
32584
|
var binary = require_binary();
|
32585
32585
|
var omap = require_omap();
|
@@ -32588,7 +32588,7 @@ var require_tags = __commonJS({
|
|
32588
32588
|
var set2 = require_set();
|
32589
32589
|
var timestamp = require_timestamp();
|
32590
32590
|
var schemas = /* @__PURE__ */ new Map([
|
32591
|
-
["core",
|
32591
|
+
["core", schema5.schema],
|
32592
32592
|
["failsafe", [map.map, seq.seq, string.string]],
|
32593
32593
|
["json", schema$1.schema],
|
32594
32594
|
["yaml11", schema$2.schema],
|
@@ -32662,10 +32662,10 @@ var require_Schema = __commonJS({
|
|
32662
32662
|
var tags = require_tags();
|
32663
32663
|
var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
32664
32664
|
var Schema = class _Schema {
|
32665
|
-
constructor({ compat, customTags, merge, resolveKnownTags, schema:
|
32665
|
+
constructor({ compat, customTags, merge, resolveKnownTags, schema: schema5, sortMapEntries, toStringDefaults }) {
|
32666
32666
|
this.compat = Array.isArray(compat) ? tags.getTags(compat, "compat") : compat ? tags.getTags(null, compat) : null;
|
32667
32667
|
this.merge = !!merge;
|
32668
|
-
this.name = typeof
|
32668
|
+
this.name = typeof schema5 === "string" && schema5 || "core";
|
32669
32669
|
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
|
32670
32670
|
this.tags = tags.getTags(customTags, this.name);
|
32671
32671
|
this.toStringOptions = toStringDefaults ?? null;
|
@@ -34192,12 +34192,12 @@ var require_compose_scalar = __commonJS({
|
|
34192
34192
|
scalar.comment = comment;
|
34193
34193
|
return scalar;
|
34194
34194
|
}
|
34195
|
-
function findScalarTagByName(
|
34195
|
+
function findScalarTagByName(schema5, value, tagName, tagToken, onError) {
|
34196
34196
|
var _a;
|
34197
34197
|
if (tagName === "!")
|
34198
|
-
return
|
34198
|
+
return schema5[identity.SCALAR];
|
34199
34199
|
const matchWithTest = [];
|
34200
|
-
for (const tag of
|
34200
|
+
for (const tag of schema5.tags) {
|
34201
34201
|
if (!tag.collection && tag.tag === tagName) {
|
34202
34202
|
if (tag.default && tag.test)
|
34203
34203
|
matchWithTest.push(tag);
|
@@ -34208,24 +34208,24 @@ var require_compose_scalar = __commonJS({
|
|
34208
34208
|
for (const tag of matchWithTest)
|
34209
34209
|
if ((_a = tag.test) == null ? void 0 : _a.test(value))
|
34210
34210
|
return tag;
|
34211
|
-
const kt =
|
34211
|
+
const kt = schema5.knownTags[tagName];
|
34212
34212
|
if (kt && !kt.collection) {
|
34213
|
-
|
34213
|
+
schema5.tags.push(Object.assign({}, kt, { default: false, test: void 0 }));
|
34214
34214
|
return kt;
|
34215
34215
|
}
|
34216
34216
|
onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str");
|
34217
|
-
return
|
34217
|
+
return schema5[identity.SCALAR];
|
34218
34218
|
}
|
34219
|
-
function findScalarTagByTest({ directives, schema:
|
34220
|
-
const tag =
|
34219
|
+
function findScalarTagByTest({ directives, schema: schema5 }, value, token, onError) {
|
34220
|
+
const tag = schema5.tags.find((tag2) => {
|
34221
34221
|
var _a;
|
34222
34222
|
return tag2.default && ((_a = tag2.test) == null ? void 0 : _a.test(value));
|
34223
|
-
}) ||
|
34224
|
-
if (
|
34225
|
-
const compat =
|
34223
|
+
}) || schema5[identity.SCALAR];
|
34224
|
+
if (schema5.compat) {
|
34225
|
+
const compat = schema5.compat.find((tag2) => {
|
34226
34226
|
var _a;
|
34227
34227
|
return tag2.default && ((_a = tag2.test) == null ? void 0 : _a.test(value));
|
34228
|
-
}) ??
|
34228
|
+
}) ?? schema5[identity.SCALAR];
|
34229
34229
|
if (tag.tag !== compat.tag) {
|
34230
34230
|
const ts = directives.tagString(tag.tag);
|
34231
34231
|
const cs = directives.tagString(compat.tag);
|
@@ -36698,15 +36698,15 @@ var init_dist = __esm({
|
|
36698
36698
|
headerRecord.push([key, value]);
|
36699
36699
|
}
|
36700
36700
|
}
|
36701
|
-
const
|
36701
|
+
const init2 = {
|
36702
36702
|
method,
|
36703
36703
|
headers: headerRecord,
|
36704
36704
|
signal: abortController.signal
|
36705
36705
|
};
|
36706
36706
|
if (!(method === "GET" || method === "HEAD")) {
|
36707
|
-
|
36707
|
+
init2.body = import_stream.Readable.toWeb(incoming);
|
36708
36708
|
}
|
36709
|
-
return new Request2(url,
|
36709
|
+
return new Request2(url, init2);
|
36710
36710
|
};
|
36711
36711
|
getRequestCache = Symbol("getRequestCache");
|
36712
36712
|
requestCache = Symbol("requestCache");
|
@@ -36799,27 +36799,27 @@ var init_dist = __esm({
|
|
36799
36799
|
delete this[cacheKey];
|
36800
36800
|
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
36801
36801
|
}
|
36802
|
-
constructor(body,
|
36802
|
+
constructor(body, init2) {
|
36803
36803
|
this.#body = body;
|
36804
|
-
if (
|
36805
|
-
const cachedGlobalResponse =
|
36804
|
+
if (init2 instanceof _Response) {
|
36805
|
+
const cachedGlobalResponse = init2[responseCache];
|
36806
36806
|
if (cachedGlobalResponse) {
|
36807
36807
|
this.#init = cachedGlobalResponse;
|
36808
36808
|
this[getResponseCache]();
|
36809
36809
|
return;
|
36810
36810
|
} else {
|
36811
|
-
this.#init =
|
36811
|
+
this.#init = init2.#init;
|
36812
36812
|
}
|
36813
36813
|
} else {
|
36814
|
-
this.#init =
|
36814
|
+
this.#init = init2;
|
36815
36815
|
}
|
36816
36816
|
if (typeof body === "string" || body instanceof ReadableStream) {
|
36817
|
-
let headers = (
|
36817
|
+
let headers = (init2 == null ? void 0 : init2.headers) || { "content-type": "text/plain; charset=UTF-8" };
|
36818
36818
|
if (headers instanceof Headers) {
|
36819
36819
|
headers = buildOutgoingHttpHeaders(headers);
|
36820
36820
|
}
|
36821
36821
|
;
|
36822
|
-
this[cacheKey] = [(
|
36822
|
+
this[cacheKey] = [(init2 == null ? void 0 : init2.status) || 200, body, headers];
|
36823
36823
|
}
|
36824
36824
|
}
|
36825
36825
|
};
|
@@ -36864,14 +36864,14 @@ var init_dist = __esm({
|
|
36864
36864
|
if (typeof global.crypto === "undefined") {
|
36865
36865
|
global.crypto = import_crypto3.default;
|
36866
36866
|
}
|
36867
|
-
global.fetch = (info3,
|
36868
|
-
|
36867
|
+
global.fetch = (info3, init2) => {
|
36868
|
+
init2 = {
|
36869
36869
|
// Disable compression handling so people can return the result of a fetch
|
36870
36870
|
// directly in the loader without messing with the Content-Encoding header.
|
36871
36871
|
compress: false,
|
36872
|
-
...
|
36872
|
+
...init2
|
36873
36873
|
};
|
36874
|
-
return webFetch(info3,
|
36874
|
+
return webFetch(info3, init2);
|
36875
36875
|
};
|
36876
36876
|
regBuffer = /^no$/i;
|
36877
36877
|
regContentType = /^(application\/json\b|text\/(?!event-stream\b))/i;
|
@@ -37433,10 +37433,10 @@ var zValidator;
|
|
37433
37433
|
var init_esm = __esm({
|
37434
37434
|
"node_modules/.pnpm/@hono+zod-validator@0.2.1_hono@4.1.5_zod@3.20.2/node_modules/@hono/zod-validator/dist/esm/index.js"() {
|
37435
37435
|
init_validator2();
|
37436
|
-
zValidator = (target,
|
37436
|
+
zValidator = (target, schema5, hook2) => (
|
37437
37437
|
// @ts-expect-error not typed well
|
37438
37438
|
validator(target, async (value, c) => {
|
37439
|
-
const result = await
|
37439
|
+
const result = await schema5.safeParseAsync(value);
|
37440
37440
|
if (hook2) {
|
37441
37441
|
const hookResult = hook2({ data: value, ...result }, c);
|
37442
37442
|
if (hookResult) {
|
@@ -38576,8 +38576,8 @@ var init_router3 = __esm({
|
|
38576
38576
|
name = "SmartRouter";
|
38577
38577
|
routers = [];
|
38578
38578
|
routes = [];
|
38579
|
-
constructor(
|
38580
|
-
Object.assign(this,
|
38579
|
+
constructor(init2) {
|
38580
|
+
Object.assign(this, init2);
|
38581
38581
|
}
|
38582
38582
|
add(method, path5, handler) {
|
38583
38583
|
if (!this.routes) {
|
@@ -40294,7 +40294,7 @@ var require_textParsers = __commonJS({
|
|
40294
40294
|
result.radius = parseFloat(radius);
|
40295
40295
|
return result;
|
40296
40296
|
};
|
40297
|
-
var
|
40297
|
+
var init2 = function(register) {
|
40298
40298
|
register(20, parseBigInteger);
|
40299
40299
|
register(21, parseInteger);
|
40300
40300
|
register(23, parseInteger);
|
@@ -40341,7 +40341,7 @@ var require_textParsers = __commonJS({
|
|
40341
40341
|
register(1270, parseStringArray);
|
40342
40342
|
};
|
40343
40343
|
module2.exports = {
|
40344
|
-
init
|
40344
|
+
init: init2
|
40345
40345
|
};
|
40346
40346
|
}
|
40347
40347
|
});
|
@@ -40603,7 +40603,7 @@ var require_binaryParsers = __commonJS({
|
|
40603
40603
|
return null;
|
40604
40604
|
return parseBits(value, 8) > 0;
|
40605
40605
|
};
|
40606
|
-
var
|
40606
|
+
var init2 = function(register) {
|
40607
40607
|
register(20, parseInt64);
|
40608
40608
|
register(21, parseInt16);
|
40609
40609
|
register(23, parseInt32);
|
@@ -40622,7 +40622,7 @@ var require_binaryParsers = __commonJS({
|
|
40622
40622
|
register(25, parseText);
|
40623
40623
|
};
|
40624
40624
|
module2.exports = {
|
40625
|
-
init
|
40625
|
+
init: init2
|
40626
40626
|
};
|
40627
40627
|
}
|
40628
40628
|
});
|
@@ -60338,7 +60338,7 @@ __export(studio_exports, {
|
|
60338
60338
|
drizzleForSQLite: () => drizzleForSQLite,
|
60339
60339
|
prepareServer: () => prepareServer
|
60340
60340
|
});
|
60341
|
-
var import_node_https, drizzleForPostgres, drizzleForMySQL, prepareParams, drizzleForSQLite, proxySchema, jsonStringify, prepareServer;
|
60341
|
+
var import_node_https, drizzleForPostgres, drizzleForMySQL, prepareParams, drizzleForSQLite, init, proxySchema, schema4, jsonStringify, prepareServer;
|
60342
60342
|
var init_studio = __esm({
|
60343
60343
|
"src/serializer/studio.ts"() {
|
60344
60344
|
init_dist();
|
@@ -60442,12 +60442,22 @@ var init_studio = __esm({
|
|
60442
60442
|
}
|
60443
60443
|
assertUnreachable(driver2);
|
60444
60444
|
};
|
60445
|
+
init = mod.object({
|
60446
|
+
type: mod.literal("init")
|
60447
|
+
});
|
60445
60448
|
proxySchema = mod.object({
|
60446
|
-
|
60447
|
-
|
60448
|
-
|
60449
|
-
|
60449
|
+
type: mod.literal("proxy"),
|
60450
|
+
data: mod.object({
|
60451
|
+
sql: mod.string(),
|
60452
|
+
params: mod.array(mod.any()).optional(),
|
60453
|
+
mode: mod.enum(["array", "object"]).default("object"),
|
60454
|
+
method: mod.union([mod.literal("values"), mod.literal("get"), mod.literal("all"), mod.literal("run"), mod.literal("execute")])
|
60455
|
+
})
|
60450
60456
|
});
|
60457
|
+
schema4 = mod.union([
|
60458
|
+
init,
|
60459
|
+
proxySchema
|
60460
|
+
]);
|
60451
60461
|
SuperJSON.registerCustom(
|
60452
60462
|
{
|
60453
60463
|
isApplicable: (v) => v instanceof Buffer,
|
@@ -60479,18 +60489,23 @@ var init_studio = __esm({
|
|
60479
60489
|
error: err2.message
|
60480
60490
|
});
|
60481
60491
|
});
|
60482
|
-
app.
|
60483
|
-
|
60484
|
-
|
60485
|
-
|
60486
|
-
|
60487
|
-
|
60488
|
-
|
60489
|
-
|
60490
|
-
|
60491
|
-
|
60492
|
-
|
60493
|
-
|
60492
|
+
app.post("/", zValidator("json", schema4), async (c) => {
|
60493
|
+
const body = c.req.valid("json");
|
60494
|
+
const { type } = body;
|
60495
|
+
if (type === "init") {
|
60496
|
+
return c.json({ version: "4", dialect: dialect6 });
|
60497
|
+
}
|
60498
|
+
if (type === "proxy") {
|
60499
|
+
const { sql: sql2, params, mode, method } = body.data;
|
60500
|
+
const result = await proxy({
|
60501
|
+
sql: sql2,
|
60502
|
+
params: params || [],
|
60503
|
+
mode,
|
60504
|
+
method
|
60505
|
+
});
|
60506
|
+
return c.json(JSON.parse(jsonStringify(result)));
|
60507
|
+
}
|
60508
|
+
throw new Error(`Unknown type: ${type}`);
|
60494
60509
|
});
|
60495
60510
|
return {
|
60496
60511
|
start: (params) => {
|
@@ -60593,20 +60608,20 @@ var init_introspect_mysql = __esm({
|
|
60593
60608
|
}
|
60594
60609
|
return value;
|
60595
60610
|
};
|
60596
|
-
schemaToTypeScript = (
|
60611
|
+
schemaToTypeScript = (schema5, casing) => {
|
60597
60612
|
const withCasing3 = prepareCasing(casing);
|
60598
|
-
Object.values(
|
60613
|
+
Object.values(schema5.tables).forEach((table4) => {
|
60599
60614
|
Object.values(table4.foreignKeys).forEach((fk4) => {
|
60600
60615
|
const relation = `${fk4.tableFrom}-${fk4.tableTo}`;
|
60601
60616
|
relations.add(relation);
|
60602
60617
|
});
|
60603
60618
|
});
|
60604
60619
|
const schemas = Object.fromEntries(
|
60605
|
-
Object.entries(
|
60620
|
+
Object.entries(schema5.schemas).map((it) => {
|
60606
60621
|
return [it[0], withCasing3(it[1])];
|
60607
60622
|
})
|
60608
60623
|
);
|
60609
|
-
const imports = Object.values(
|
60624
|
+
const imports = Object.values(schema5.tables).reduce(
|
60610
60625
|
(res, it) => {
|
60611
60626
|
const idxImports = Object.values(it.indexes).map(
|
60612
60627
|
(idx) => idx.isUnique ? "uniqueIndex" : "index"
|
@@ -60646,7 +60661,7 @@ var init_introspect_mysql = __esm({
|
|
60646
60661
|
return `export const ${it[1]} = mysqlSchema("${it[0]}");
|
60647
60662
|
`;
|
60648
60663
|
}).join();
|
60649
|
-
const tableStatements = Object.values(
|
60664
|
+
const tableStatements = Object.values(schema5.tables).map((table4) => {
|
60650
60665
|
const tableSchema = schemas[table4.schema];
|
60651
60666
|
const func = tableSchema ? tableSchema : "mysqlTable";
|
60652
60667
|
let statement = "";
|
@@ -60664,7 +60679,7 @@ var init_introspect_mysql = __esm({
|
|
60664
60679
|
Object.values(table4.foreignKeys),
|
60665
60680
|
withCasing3,
|
60666
60681
|
table4.name,
|
60667
|
-
|
60682
|
+
schema5
|
60668
60683
|
);
|
60669
60684
|
statement += "}";
|
60670
60685
|
const filteredFKs = Object.values(table4.foreignKeys).filter((it) => {
|
@@ -60712,7 +60727,7 @@ import { sql } from "drizzle-orm"
|
|
60712
60727
|
const file = importsTs + decalrations;
|
60713
60728
|
const schemaEntry = `
|
60714
60729
|
{
|
60715
|
-
${Object.values(
|
60730
|
+
${Object.values(schema5.tables).map((it) => withCasing3(it.name)).join(",")}
|
60716
60731
|
}
|
60717
60732
|
`;
|
60718
60733
|
return {
|
@@ -60947,7 +60962,7 @@ import { sql } from "drizzle-orm"
|
|
60947
60962
|
return `// Warning: Can't parse ${type} from database
|
60948
60963
|
// ${type}Type: ${type}("${name}")`;
|
60949
60964
|
};
|
60950
|
-
createTableColumns = (columns, fks, casing, tableName,
|
60965
|
+
createTableColumns = (columns, fks, casing, tableName, schema5) => {
|
60951
60966
|
let statement = "";
|
60952
60967
|
const oneColumnsFKs = Object.values(fks).filter((it) => {
|
60953
60968
|
return !isSelf(it);
|
@@ -60968,7 +60983,7 @@ import { sql } from "drizzle-orm"
|
|
60968
60983
|
it.default,
|
60969
60984
|
it.autoincrement,
|
60970
60985
|
it.onUpdate,
|
60971
|
-
((_c = (_b = (_a =
|
60986
|
+
((_c = (_b = (_a = schema5.internal) == null ? void 0 : _a.tables[tableName]) == null ? void 0 : _b.columns[it.name]) == null ? void 0 : _c.isDefaultAnExpression) ?? false
|
60972
60987
|
);
|
60973
60988
|
statement += it.primaryKey ? ".primaryKey()" : "";
|
60974
60989
|
statement += it.notNull ? ".notNull()" : "";
|
@@ -62493,9 +62508,9 @@ var init_mysqlIntrospect = __esm({
|
|
62493
62508
|
progress.update(stage, count, status);
|
62494
62509
|
})
|
62495
62510
|
);
|
62496
|
-
const
|
62497
|
-
const ts = schemaToTypeScript(
|
62498
|
-
const { internal, ...schemaWithoutInternals } =
|
62511
|
+
const schema5 = { id: originUUID, prevId: "", ...res };
|
62512
|
+
const ts = schemaToTypeScript(schema5, config.introspect.casing);
|
62513
|
+
const { internal, ...schemaWithoutInternals } = schema5;
|
62499
62514
|
return { schema: schemaWithoutInternals, ts };
|
62500
62515
|
};
|
62501
62516
|
mysqlPushIntrospect = async (connection, filters) => {
|
@@ -62514,8 +62529,8 @@ var init_mysqlIntrospect = __esm({
|
|
62514
62529
|
return false;
|
62515
62530
|
};
|
62516
62531
|
const res = await fromDatabase(client, databaseName, filter2);
|
62517
|
-
const
|
62518
|
-
const { internal, ...schemaWithoutInternals } =
|
62532
|
+
const schema5 = { id: originUUID, prevId: "", ...res };
|
62533
|
+
const { internal, ...schemaWithoutInternals } = schema5;
|
62519
62534
|
return { schema: schemaWithoutInternals };
|
62520
62535
|
};
|
62521
62536
|
}
|
@@ -62668,20 +62683,20 @@ var init_introspect_pg = __esm({
|
|
62668
62683
|
}
|
62669
62684
|
return value;
|
62670
62685
|
};
|
62671
|
-
schemaToTypeScript2 = (
|
62672
|
-
Object.values(
|
62686
|
+
schemaToTypeScript2 = (schema5, casing) => {
|
62687
|
+
Object.values(schema5.tables).forEach((table4) => {
|
62673
62688
|
Object.values(table4.foreignKeys).forEach((fk4) => {
|
62674
62689
|
const relation = `${fk4.tableFrom}-${fk4.tableTo}`;
|
62675
62690
|
relations2.add(relation);
|
62676
62691
|
});
|
62677
62692
|
});
|
62678
62693
|
const schemas = Object.fromEntries(
|
62679
|
-
Object.entries(
|
62694
|
+
Object.entries(schema5.schemas).map((it) => {
|
62680
62695
|
return [it[0], withCasing(it[1], casing)];
|
62681
62696
|
})
|
62682
62697
|
);
|
62683
|
-
const enumTypes = new Set(Object.values(
|
62684
|
-
const imports = Object.values(
|
62698
|
+
const enumTypes = new Set(Object.values(schema5.enums).map((it) => it.name));
|
62699
|
+
const imports = Object.values(schema5.tables).reduce(
|
62685
62700
|
(res, it) => {
|
62686
62701
|
const idxImports = Object.values(it.indexes).map(
|
62687
62702
|
(idx) => idx.isUnique ? "uniqueIndex" : "index"
|
@@ -62722,7 +62737,7 @@ var init_introspect_pg = __esm({
|
|
62722
62737
|
},
|
62723
62738
|
{ pg: [] }
|
62724
62739
|
);
|
62725
|
-
const enumStatements = Object.values(
|
62740
|
+
const enumStatements = Object.values(schema5.enums).map((it) => {
|
62726
62741
|
const values = Object.values(it.values).map((it2) => `'${it2}'`).join(", ");
|
62727
62742
|
return `export const ${withCasing(it.name, casing)} = pgEnum("${it.name}", [${values}])
|
62728
62743
|
`;
|
@@ -62731,7 +62746,7 @@ var init_introspect_pg = __esm({
|
|
62731
62746
|
return `export const ${it[1]} = pgSchema("${it[0]}");
|
62732
62747
|
`;
|
62733
62748
|
}).join("");
|
62734
|
-
const tableStatements = Object.values(
|
62749
|
+
const tableStatements = Object.values(schema5.tables).map((table4) => {
|
62735
62750
|
const tableSchema = schemas[table4.schema];
|
62736
62751
|
const func = tableSchema ? `${tableSchema}.table` : "pgTable";
|
62737
62752
|
let statement = `export const ${withCasing(
|
@@ -62745,7 +62760,7 @@ var init_introspect_pg = __esm({
|
|
62745
62760
|
Object.values(table4.foreignKeys),
|
62746
62761
|
enumTypes,
|
62747
62762
|
casing,
|
62748
|
-
|
62763
|
+
schema5.internal
|
62749
62764
|
);
|
62750
62765
|
statement += "}";
|
62751
62766
|
const filteredFKs = Object.values(table4.foreignKeys).filter((it) => {
|
@@ -62789,7 +62804,7 @@ var init_introspect_pg = __esm({
|
|
62789
62804
|
const file = importsTs + decalrations;
|
62790
62805
|
const schemaEntry = `
|
62791
62806
|
{
|
62792
|
-
${Object.values(
|
62807
|
+
${Object.values(schema5.tables).map((it) => withCasing(it.name, casing)).join(",\n")}
|
62793
62808
|
}
|
62794
62809
|
`;
|
62795
62810
|
return { file, imports: importsTs, decalrations, schemaEntry };
|
@@ -63180,8 +63195,8 @@ var init_pgIntrospect = __esm({
|
|
63180
63195
|
return false;
|
63181
63196
|
};
|
63182
63197
|
const res = await fromDatabase2(client, filter2, schemaFilters);
|
63183
|
-
const
|
63184
|
-
const { internal, ...schemaWithoutInternals } =
|
63198
|
+
const schema5 = { id: originUUID, prevId: "", ...res };
|
63199
|
+
const { internal, ...schemaWithoutInternals } = schema5;
|
63185
63200
|
return { schema: schemaWithoutInternals };
|
63186
63201
|
};
|
63187
63202
|
pgIntrospect = async (config, filters, schemaFilters) => {
|
@@ -63207,9 +63222,9 @@ var init_pgIntrospect = __esm({
|
|
63207
63222
|
progress.update(stage, count, status);
|
63208
63223
|
})
|
63209
63224
|
);
|
63210
|
-
const
|
63211
|
-
const ts = schemaToTypeScript2(
|
63212
|
-
const { internal, ...schemaWithoutInternals } =
|
63225
|
+
const schema5 = { id: originUUID, prevId: "", ...res };
|
63226
|
+
const ts = schemaToTypeScript2(schema5, { casing: config.introspect.casing });
|
63227
|
+
const { internal, ...schemaWithoutInternals } = schema5;
|
63213
63228
|
return { schema: schemaWithoutInternals, ts };
|
63214
63229
|
};
|
63215
63230
|
}
|
@@ -63251,14 +63266,14 @@ var init_introspect_sqlite = __esm({
|
|
63251
63266
|
}
|
63252
63267
|
return value;
|
63253
63268
|
};
|
63254
|
-
schemaToTypeScript3 = (
|
63255
|
-
Object.values(
|
63269
|
+
schemaToTypeScript3 = (schema5, casing) => {
|
63270
|
+
Object.values(schema5.tables).forEach((table4) => {
|
63256
63271
|
Object.values(table4.foreignKeys).forEach((fk4) => {
|
63257
63272
|
const relation = `${fk4.tableFrom}-${fk4.tableTo}`;
|
63258
63273
|
relations3.add(relation);
|
63259
63274
|
});
|
63260
63275
|
});
|
63261
|
-
const imports = Object.values(
|
63276
|
+
const imports = Object.values(schema5.tables).reduce(
|
63262
63277
|
(res, it) => {
|
63263
63278
|
const idxImports = Object.values(it.indexes).map(
|
63264
63279
|
(idx) => idx.isUnique ? "uniqueIndex" : "index"
|
@@ -63284,7 +63299,7 @@ var init_introspect_sqlite = __esm({
|
|
63284
63299
|
},
|
63285
63300
|
{ sqlite: [] }
|
63286
63301
|
);
|
63287
|
-
const tableStatements = Object.values(
|
63302
|
+
const tableStatements = Object.values(schema5.tables).map((table4) => {
|
63288
63303
|
const func = "sqliteTable";
|
63289
63304
|
let statement = "";
|
63290
63305
|
if (imports.sqlite.includes(withCasing2(table4.name, casing))) {
|
@@ -63345,7 +63360,7 @@ var init_introspect_sqlite = __esm({
|
|
63345
63360
|
const file = importsTs + decalrations;
|
63346
63361
|
const schemaEntry = `
|
63347
63362
|
{
|
63348
|
-
${Object.values(
|
63363
|
+
${Object.values(schema5.tables).map((it) => withCasing2(it.name, casing)).join(",")}
|
63349
63364
|
}
|
63350
63365
|
`;
|
63351
63366
|
return { file, imports: importsTs, decalrations, schemaEntry };
|
@@ -63577,9 +63592,9 @@ var init_sqliteIntrospect = __esm({
|
|
63577
63592
|
progress.update(stage, count, status);
|
63578
63593
|
})
|
63579
63594
|
);
|
63580
|
-
const
|
63581
|
-
const ts = schemaToTypeScript3(
|
63582
|
-
return { schema:
|
63595
|
+
const schema5 = { id: originUUID, prevId: "", ...res };
|
63596
|
+
const ts = schemaToTypeScript3(schema5, config.introspect.casing);
|
63597
|
+
return { schema: schema5, ts };
|
63583
63598
|
};
|
63584
63599
|
sqlitePushIntrospect = async (client, filters) => {
|
63585
63600
|
const matchers = filters.map((it) => {
|
@@ -63596,8 +63611,8 @@ var init_sqliteIntrospect = __esm({
|
|
63596
63611
|
return false;
|
63597
63612
|
};
|
63598
63613
|
const res = await fromDatabase3(client, filter2);
|
63599
|
-
const
|
63600
|
-
return { schema:
|
63614
|
+
const schema5 = { id: originUUID, prevId: "", ...res };
|
63615
|
+
return { schema: schema5 };
|
63601
63616
|
};
|
63602
63617
|
}
|
63603
63618
|
});
|
@@ -63730,7 +63745,7 @@ init_source();
|
|
63730
63745
|
// package.json
|
63731
63746
|
var package_default = {
|
63732
63747
|
name: "drizzle-kit",
|
63733
|
-
version: "0.20.
|
63748
|
+
version: "0.20.16",
|
63734
63749
|
repository: "https://github.com/drizzle-team/drizzle-kit-mirror",
|
63735
63750
|
author: "Drizzle Team",
|
63736
63751
|
license: "MIT",
|
@@ -65436,8 +65451,8 @@ function log(entry) {
|
|
65436
65451
|
case "fetch":
|
65437
65452
|
if (!$.verbose)
|
65438
65453
|
return;
|
65439
|
-
const
|
65440
|
-
process.stderr.write("$ " + source_default.greenBright("fetch") + ` ${entry.url}${
|
65454
|
+
const init2 = entry.init ? " " + (0, import_node_util2.inspect)(entry.init) : "";
|
65455
|
+
process.stderr.write("$ " + source_default.greenBright("fetch") + ` ${entry.url}${init2}
|
65441
65456
|
`);
|
65442
65457
|
break;
|
65443
65458
|
case "retry":
|
@@ -65912,11 +65927,11 @@ var dbPushMysqlCommand = new import_commander.Command("push:mysql").option(
|
|
65912
65927
|
const connection = await connectToMySQL2(drizzleConfig);
|
65913
65928
|
const filterConfig = drizzleConfig.tablesFilter;
|
65914
65929
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
65915
|
-
const { schema:
|
65930
|
+
const { schema: schema5 } = await mysqlPushIntrospect2(connection, tablesFilter);
|
65916
65931
|
const { prepareMySQLPush: prepareMySQLPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
65917
65932
|
const statements = await prepareMySQLPush2(
|
65918
65933
|
{ schema: drizzleConfig.schema },
|
65919
|
-
|
65934
|
+
schema5
|
65920
65935
|
);
|
65921
65936
|
const filteredStatements = filterStatements(
|
65922
65937
|
(statements == null ? void 0 : statements.statements) ?? [],
|
@@ -66034,7 +66049,7 @@ var dbPushPgCommand = new import_commander.Command("push:pg").option(
|
|
66034
66049
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
66035
66050
|
const schemaFilterConfig = drizzleConfig.schemaFilter;
|
66036
66051
|
const schemasFilter = schemaFilterConfig ? typeof schemaFilterConfig === "string" ? [schemaFilterConfig] : schemaFilterConfig : [];
|
66037
|
-
const { schema:
|
66052
|
+
const { schema: schema5 } = await pgPushIntrospect2(
|
66038
66053
|
connection,
|
66039
66054
|
tablesFilter,
|
66040
66055
|
schemasFilter
|
@@ -66042,7 +66057,7 @@ var dbPushPgCommand = new import_commander.Command("push:pg").option(
|
|
66042
66057
|
const { preparePgPush: preparePgPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
66043
66058
|
const statements = await preparePgPush2(
|
66044
66059
|
{ schema: drizzleConfig.schema },
|
66045
|
-
|
66060
|
+
schema5,
|
66046
66061
|
schemasFilter
|
66047
66062
|
);
|
66048
66063
|
try {
|
@@ -66134,12 +66149,12 @@ var dbPushSqliteCommand = new import_commander.Command("push:sqlite").option(
|
|
66134
66149
|
const connection = await connectToSQLite2(res);
|
66135
66150
|
const filterConfig = res.tablesFilter;
|
66136
66151
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
66137
|
-
const { schema:
|
66152
|
+
const { schema: schema5 } = await sqlitePushIntrospect2(
|
66138
66153
|
connection.client,
|
66139
66154
|
tablesFilter
|
66140
66155
|
);
|
66141
66156
|
const { prepareSQLitePush: prepareSQLitePush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
66142
|
-
const statements = await prepareSQLitePush2({ schema: res.schema },
|
66157
|
+
const statements = await prepareSQLitePush2({ schema: res.schema }, schema5);
|
66143
66158
|
try {
|
66144
66159
|
if (typeof statements === "undefined") {
|
66145
66160
|
} else if (statements.sqlStatements.length === 0) {
|
@@ -66355,7 +66370,7 @@ var introspectPgCommand = new import_commander.Command("introspect:pg").option("
|
|
66355
66370
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
66356
66371
|
const schemaFilterConfig = validatedConfig.schemaFilter;
|
66357
66372
|
const schemasFilter = schemaFilterConfig ? typeof schemaFilterConfig === "string" ? [schemaFilterConfig] : schemaFilterConfig : [];
|
66358
|
-
const { schema:
|
66373
|
+
const { schema: schema5, ts } = await pgIntrospect2(
|
66359
66374
|
validatedConfig,
|
66360
66375
|
tablesFilter,
|
66361
66376
|
schemasFilter
|
@@ -66366,13 +66381,13 @@ var introspectPgCommand = new import_commander.Command("introspect:pg").option("
|
|
66366
66381
|
if (snapshots.length === 0) {
|
66367
66382
|
const { sqlStatements, _meta } = await prepareSQL(
|
66368
66383
|
squashPgScheme(dryPg),
|
66369
|
-
squashPgScheme(
|
66384
|
+
squashPgScheme(schema5),
|
66370
66385
|
"pg",
|
66371
66386
|
dryMySql,
|
66372
|
-
|
66387
|
+
schema5
|
66373
66388
|
);
|
66374
66389
|
writeResult({
|
66375
|
-
cur:
|
66390
|
+
cur: schema5,
|
66376
66391
|
sqlStatements,
|
66377
66392
|
journal,
|
66378
66393
|
_meta,
|
@@ -66412,20 +66427,20 @@ var introspectMySqlCommand = new import_commander.Command("introspect:mysql").op
|
|
66412
66427
|
const { snapshots, journal } = prepareOutFolder2(out, "mysql");
|
66413
66428
|
const filterConfig = res.tablesFilter;
|
66414
66429
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
66415
|
-
const { schema:
|
66430
|
+
const { schema: schema5, ts } = await mysqlIntrospect2(res, tablesFilter);
|
66416
66431
|
const schemaFile = import_path8.default.join(out, "schema.ts");
|
66417
66432
|
(0, import_fs13.writeFileSync)(schemaFile, ts.file);
|
66418
66433
|
console.log();
|
66419
66434
|
if (snapshots.length === 0) {
|
66420
66435
|
const { sqlStatements, _meta } = await prepareSQL(
|
66421
66436
|
squashMysqlScheme(dryMySql),
|
66422
|
-
squashMysqlScheme(
|
66437
|
+
squashMysqlScheme(schema5),
|
66423
66438
|
"mysql",
|
66424
66439
|
dryMySql,
|
66425
|
-
|
66440
|
+
schema5
|
66426
66441
|
);
|
66427
66442
|
writeResult({
|
66428
|
-
cur:
|
66443
|
+
cur: schema5,
|
66429
66444
|
sqlStatements,
|
66430
66445
|
journal,
|
66431
66446
|
_meta,
|
@@ -66465,20 +66480,20 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
66465
66480
|
const { snapshots, journal } = prepareOutFolder2(out, "sqlite");
|
66466
66481
|
const filterConfig = res.tablesFilter;
|
66467
66482
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
66468
|
-
const { schema:
|
66483
|
+
const { schema: schema5, ts } = await sqliteIntrospect2(res, tablesFilter);
|
66469
66484
|
const schemaFile = import_path8.default.join(out, "schema.ts");
|
66470
66485
|
(0, import_fs13.writeFileSync)(schemaFile, ts.file);
|
66471
66486
|
console.log();
|
66472
66487
|
if (snapshots.length === 0) {
|
66473
66488
|
const { sqlStatements, _meta } = await prepareSQL(
|
66474
66489
|
squashSqliteScheme(drySQLite),
|
66475
|
-
squashSqliteScheme(
|
66490
|
+
squashSqliteScheme(schema5),
|
66476
66491
|
"sqlite",
|
66477
66492
|
drySQLite,
|
66478
|
-
|
66493
|
+
schema5
|
66479
66494
|
);
|
66480
66495
|
writeResult({
|
66481
|
-
cur:
|
66496
|
+
cur: schema5,
|
66482
66497
|
sqlStatements,
|
66483
66498
|
journal,
|
66484
66499
|
_meta,
|