drizzle-kit 0.29.1 → 0.30.0-1abaaf8
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/api.js +394 -264
- package/api.mjs +394 -264
- package/bin.cjs +70 -99
- package/package.json +1 -1
package/bin.cjs
CHANGED
@@ -42787,7 +42787,7 @@ var init_sqlgenerator = __esm({
|
|
42787
42787
|
const { tableName, schema: schema6, columns, compositePKs, uniqueConstraints, checkConstraints, policies, isRLSEnabled } = st;
|
42788
42788
|
let statement = "";
|
42789
42789
|
const name = schema6 ? `"${schema6}"."${tableName}"` : `"${tableName}"`;
|
42790
|
-
statement += `CREATE TABLE
|
42790
|
+
statement += `CREATE TABLE ${name} (
|
42791
42791
|
`;
|
42792
42792
|
for (let i2 = 0; i2 < columns.length; i2++) {
|
42793
42793
|
const column9 = columns[i2];
|
@@ -43633,7 +43633,7 @@ WITH ${withCheckOption} CHECK OPTION` : "";
|
|
43633
43633
|
convert(statement) {
|
43634
43634
|
const { tableName, columnName, schema: schema6 } = statement;
|
43635
43635
|
const tableNameWithSchema = schema6 ? `"${schema6}"."${tableName}"` : `"${tableName}"`;
|
43636
|
-
return `ALTER TABLE ${tableNameWithSchema} DROP COLUMN
|
43636
|
+
return `ALTER TABLE ${tableNameWithSchema} DROP COLUMN "${columnName}";`;
|
43637
43637
|
}
|
43638
43638
|
};
|
43639
43639
|
MySqlAlterTableDropColumnConvertor = class extends Convertor {
|
@@ -44054,7 +44054,7 @@ WITH ${withCheckOption} CHECK OPTION` : "";
|
|
44054
44054
|
for (const table5 of Object.values(json2.tables)) {
|
44055
44055
|
for (const index5 of Object.values(table5.indexes)) {
|
44056
44056
|
const unsquashed = SQLiteSquasher.unsquashIdx(index5);
|
44057
|
-
sqlStatements.push(`DROP INDEX
|
44057
|
+
sqlStatements.push(`DROP INDEX "${unsquashed.name}";`);
|
44058
44058
|
indexes.push({ ...unsquashed, tableName: table5.name });
|
44059
44059
|
}
|
44060
44060
|
}
|
@@ -44570,13 +44570,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
|
|
44570
44570
|
const toColumnsString = columnsTo.map((it) => `"${it}"`).join(",");
|
44571
44571
|
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${tableFrom}"` : `"${tableFrom}"`;
|
44572
44572
|
const tableToNameWithSchema = schemaTo ? `"${schemaTo}"."${tableTo}"` : `"${tableTo}"`;
|
44573
|
-
const alterStatement = `ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}
|
44574
|
-
|
44575
|
-
sql += " " + alterStatement + ";\n";
|
44576
|
-
sql += "EXCEPTION\n";
|
44577
|
-
sql += " WHEN duplicate_object THEN null;\n";
|
44578
|
-
sql += "END $$;\n";
|
44579
|
-
return sql;
|
44573
|
+
const alterStatement = `ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement};`;
|
44574
|
+
return alterStatement;
|
44580
44575
|
}
|
44581
44576
|
};
|
44582
44577
|
LibSQLCreateForeignKeyConvertor = class extends Convertor {
|
@@ -44633,12 +44628,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
|
|
44633
44628
|
const toColumnsString = newFk.columnsTo.map((it) => `"${it}"`).join(",");
|
44634
44629
|
const tableFromNameWithSchema = oldFk.schemaTo ? `"${oldFk.schemaTo}"."${oldFk.tableFrom}"` : `"${oldFk.tableFrom}"`;
|
44635
44630
|
const tableToNameWithSchema = newFk.schemaTo ? `"${newFk.schemaTo}"."${newFk.tableFrom}"` : `"${newFk.tableFrom}"`;
|
44636
|
-
const alterStatement = `ALTER TABLE ${tableFromNameWithSchema} ADD CONSTRAINT "${newFk.name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}
|
44637
|
-
sql +=
|
44638
|
-
sql += " " + alterStatement + ";\n";
|
44639
|
-
sql += "EXCEPTION\n";
|
44640
|
-
sql += " WHEN duplicate_object THEN null;\n";
|
44641
|
-
sql += "END $$;\n";
|
44631
|
+
const alterStatement = `ALTER TABLE ${tableFromNameWithSchema} ADD CONSTRAINT "${newFk.name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement};`;
|
44632
|
+
sql += alterStatement;
|
44642
44633
|
return sql;
|
44643
44634
|
}
|
44644
44635
|
};
|
@@ -44694,7 +44685,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
|
|
44694
44685
|
reversedString = reversedString.slice(0, -1);
|
44695
44686
|
return reversedString;
|
44696
44687
|
}
|
44697
|
-
return `CREATE ${indexPart}${concurrently ? " CONCURRENTLY" : ""}
|
44688
|
+
return `CREATE ${indexPart}${concurrently ? " CONCURRENTLY" : ""} "${name}" ON ${tableNameWithSchema} USING ${method} (${value})${Object.keys(withMap).length !== 0 ? ` WITH (${reverseLogic(withMap)})` : ""}${where ? ` WHERE ${where}` : ""};`;
|
44698
44689
|
}
|
44699
44690
|
};
|
44700
44691
|
CreateMySqlIndexConvertor = class extends Convertor {
|
@@ -44752,7 +44743,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
|
|
44752
44743
|
}
|
44753
44744
|
convert(statement) {
|
44754
44745
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
44755
|
-
return `DROP INDEX
|
44746
|
+
return `DROP INDEX "${name}";`;
|
44756
44747
|
}
|
44757
44748
|
};
|
44758
44749
|
PgCreateSchemaConvertor = class extends Convertor {
|
@@ -44823,7 +44814,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
|
|
44823
44814
|
}
|
44824
44815
|
convert(statement) {
|
44825
44816
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
44826
|
-
return `DROP INDEX
|
44817
|
+
return `DROP INDEX \`${name}\`;`;
|
44827
44818
|
}
|
44828
44819
|
};
|
44829
44820
|
MySqlDropIndexConvertor = class extends Convertor {
|
@@ -81454,8 +81445,7 @@ var init_introspect_sqlite = __esm({
|
|
81454
81445
|
});
|
81455
81446
|
if (Object.keys(table5.indexes).length > 0 || filteredFKs.length > 0 || Object.keys(table5.compositePrimaryKeys).length > 0 || Object.keys(table5.uniqueConstraints).length > 0 || Object.keys(table5.checkConstraints).length > 0) {
|
81456
81447
|
statement += ",\n";
|
81457
|
-
statement += "(table) =>
|
81458
|
-
statement += " return {\n";
|
81448
|
+
statement += "(table) => [";
|
81459
81449
|
statement += createTableIndexes(
|
81460
81450
|
table5.name,
|
81461
81451
|
Object.values(table5.indexes),
|
@@ -81474,8 +81464,7 @@ var init_introspect_sqlite = __esm({
|
|
81474
81464
|
Object.values(table5.checkConstraints),
|
81475
81465
|
casing2
|
81476
81466
|
);
|
81477
|
-
statement += "
|
81478
|
-
statement += "}";
|
81467
|
+
statement += "\n]";
|
81479
81468
|
}
|
81480
81469
|
statement += ");";
|
81481
81470
|
return statement;
|
@@ -81632,12 +81621,11 @@ var init_introspect_sqlite = __esm({
|
|
81632
81621
|
idxKey = withCasing(idxKey, casing2);
|
81633
81622
|
const indexGeneratedName = indexName4(tableName, it.columns);
|
81634
81623
|
const escapedIndexName = indexGeneratedName === it.name ? "" : `"${it.name}"`;
|
81635
|
-
statement += `
|
81624
|
+
statement += `
|
81625
|
+
`;
|
81636
81626
|
statement += it.isUnique ? "uniqueIndex(" : "index(";
|
81637
81627
|
statement += `${escapedIndexName})`;
|
81638
81628
|
statement += `.on(${it.columns.map((it2) => `table.${withCasing(it2, casing2)}`).join(", ")}),`;
|
81639
|
-
statement += `
|
81640
|
-
`;
|
81641
81629
|
});
|
81642
81630
|
return statement;
|
81643
81631
|
};
|
@@ -81645,39 +81633,36 @@ var init_introspect_sqlite = __esm({
|
|
81645
81633
|
let statement = "";
|
81646
81634
|
unqs.forEach((it) => {
|
81647
81635
|
const idxKey = withCasing(it.name, casing2);
|
81648
|
-
statement += `
|
81636
|
+
statement += `
|
81637
|
+
`;
|
81649
81638
|
statement += "unique(";
|
81650
81639
|
statement += `"${it.name}")`;
|
81651
81640
|
statement += `.on(${it.columns.map((it2) => `table.${withCasing(it2, casing2)}`).join(", ")}),`;
|
81652
|
-
statement += `
|
81653
|
-
`;
|
81654
81641
|
});
|
81655
81642
|
return statement;
|
81656
81643
|
};
|
81657
81644
|
createTableChecks = (checks, casing2) => {
|
81658
81645
|
let statement = "";
|
81659
81646
|
checks.forEach((it) => {
|
81660
|
-
|
81661
|
-
|
81647
|
+
statement += `
|
81648
|
+
`;
|
81662
81649
|
statement += "check(";
|
81663
81650
|
statement += `"${it.name}", `;
|
81664
81651
|
statement += `sql\`${it.value}\`)`;
|
81665
|
-
statement +=
|
81666
|
-
`;
|
81652
|
+
statement += `,`;
|
81667
81653
|
});
|
81668
81654
|
return statement;
|
81669
81655
|
};
|
81670
81656
|
createTablePKs = (pks, casing2) => {
|
81671
81657
|
let statement = "";
|
81672
81658
|
pks.forEach((it, i2) => {
|
81673
|
-
statement += `
|
81659
|
+
statement += `
|
81660
|
+
`;
|
81674
81661
|
statement += "primaryKey({ columns: [";
|
81675
81662
|
statement += `${it.columns.map((c) => {
|
81676
81663
|
return `table.${withCasing(c, casing2)}`;
|
81677
81664
|
}).join(", ")}]${it.name ? `, name: "${it.name}"` : ""}}`;
|
81678
81665
|
statement += ")";
|
81679
|
-
statement += `
|
81680
|
-
`;
|
81681
81666
|
});
|
81682
81667
|
return statement;
|
81683
81668
|
};
|
@@ -81686,7 +81671,9 @@ var init_introspect_sqlite = __esm({
|
|
81686
81671
|
fks.forEach((it) => {
|
81687
81672
|
const isSelf4 = it.tableTo === it.tableFrom;
|
81688
81673
|
const tableTo = isSelf4 ? "table" : `${withCasing(it.tableTo, casing2)}`;
|
81689
|
-
statement += `
|
81674
|
+
statement += `
|
81675
|
+
`;
|
81676
|
+
statement += `foreignKey(() => ({
|
81690
81677
|
`;
|
81691
81678
|
statement += ` columns: [${it.columnsFrom.map((i2) => `table.${withCasing(i2, casing2)}`).join(", ")}],
|
81692
81679
|
`;
|
@@ -81697,8 +81684,7 @@ var init_introspect_sqlite = __esm({
|
|
81697
81684
|
statement += ` }))`;
|
81698
81685
|
statement += it.onUpdate && it.onUpdate !== "no action" ? `.onUpdate("${it.onUpdate}")` : "";
|
81699
81686
|
statement += it.onDelete && it.onDelete !== "no action" ? `.onDelete("${it.onDelete}")` : "";
|
81700
|
-
statement +=
|
81701
|
-
`;
|
81687
|
+
statement += `,`;
|
81702
81688
|
});
|
81703
81689
|
return statement;
|
81704
81690
|
};
|
@@ -82827,8 +82813,7 @@ var init_introspect_mysql = __esm({
|
|
82827
82813
|
});
|
82828
82814
|
if (Object.keys(table5.indexes).length > 0 || filteredFKs.length > 0 || Object.keys(table5.compositePrimaryKeys).length > 0 || Object.keys(table5.uniqueConstraints).length > 0 || Object.keys(table5.checkConstraint).length > 0) {
|
82829
82815
|
statement += ",\n";
|
82830
|
-
statement += "(table) =>
|
82831
|
-
statement += " return {\n";
|
82816
|
+
statement += "(table) => [";
|
82832
82817
|
statement += createTableIndexes2(
|
82833
82818
|
table5.name,
|
82834
82819
|
Object.values(table5.indexes),
|
@@ -82847,8 +82832,7 @@ var init_introspect_mysql = __esm({
|
|
82847
82832
|
Object.values(table5.checkConstraint),
|
82848
82833
|
withCasing4
|
82849
82834
|
);
|
82850
|
-
statement += "
|
82851
|
-
statement += "}";
|
82835
|
+
statement += "\n]";
|
82852
82836
|
}
|
82853
82837
|
statement += ");";
|
82854
82838
|
return statement;
|
@@ -83218,12 +83202,11 @@ import { sql } from "drizzle-orm"
|
|
83218
83202
|
idxKey = casing2(idxKey);
|
83219
83203
|
const indexGeneratedName = indexName(tableName, it.columns);
|
83220
83204
|
const escapedIndexName = indexGeneratedName === it.name ? "" : `"${it.name}"`;
|
83221
|
-
statement += `
|
83205
|
+
statement += `
|
83206
|
+
`;
|
83222
83207
|
statement += it.isUnique ? "uniqueIndex(" : "index(";
|
83223
83208
|
statement += `${escapedIndexName})`;
|
83224
83209
|
statement += `.on(${it.columns.map((it2) => `table.${casing2(it2)}`).join(", ")}),`;
|
83225
|
-
statement += `
|
83226
|
-
`;
|
83227
83210
|
});
|
83228
83211
|
return statement;
|
83229
83212
|
};
|
@@ -83231,25 +83214,23 @@ import { sql } from "drizzle-orm"
|
|
83231
83214
|
let statement = "";
|
83232
83215
|
unqs.forEach((it) => {
|
83233
83216
|
const idxKey = casing2(it.name);
|
83234
|
-
statement += `
|
83217
|
+
statement += `
|
83218
|
+
`;
|
83235
83219
|
statement += "unique(";
|
83236
83220
|
statement += `"${it.name}")`;
|
83237
83221
|
statement += `.on(${it.columns.map((it2) => `table.${casing2(it2)}`).join(", ")}),`;
|
83238
|
-
statement += `
|
83239
|
-
`;
|
83240
83222
|
});
|
83241
83223
|
return statement;
|
83242
83224
|
};
|
83243
83225
|
createTableChecks2 = (checks, casing2) => {
|
83244
83226
|
let statement = "";
|
83245
83227
|
checks.forEach((it) => {
|
83246
|
-
|
83247
|
-
|
83228
|
+
statement += `
|
83229
|
+
`;
|
83248
83230
|
statement += "check(";
|
83249
83231
|
statement += `"${it.name}", `;
|
83250
83232
|
statement += `sql\`${it.value.replace(/`/g, "\\`")}\`)`;
|
83251
|
-
statement +=
|
83252
|
-
`;
|
83233
|
+
statement += `,`;
|
83253
83234
|
});
|
83254
83235
|
return statement;
|
83255
83236
|
};
|
@@ -83257,14 +83238,13 @@ import { sql } from "drizzle-orm"
|
|
83257
83238
|
let statement = "";
|
83258
83239
|
pks.forEach((it) => {
|
83259
83240
|
let idxKey = casing2(it.name);
|
83260
|
-
statement += `
|
83241
|
+
statement += `
|
83242
|
+
`;
|
83261
83243
|
statement += "primaryKey({ columns: [";
|
83262
83244
|
statement += `${it.columns.map((c) => {
|
83263
83245
|
return `table.${casing2(c)}`;
|
83264
83246
|
}).join(", ")}]${it.name ? `, name: "${it.name}"` : ""}}`;
|
83265
83247
|
statement += "),";
|
83266
|
-
statement += `
|
83267
|
-
`;
|
83268
83248
|
});
|
83269
83249
|
return statement;
|
83270
83250
|
};
|
@@ -83273,7 +83253,9 @@ import { sql } from "drizzle-orm"
|
|
83273
83253
|
fks.forEach((it) => {
|
83274
83254
|
const isSelf4 = it.tableTo === it.tableFrom;
|
83275
83255
|
const tableTo = isSelf4 ? "table" : `${casing2(it.tableTo)}`;
|
83276
|
-
statement += `
|
83256
|
+
statement += `
|
83257
|
+
`;
|
83258
|
+
statement += `foreignKey({
|
83277
83259
|
`;
|
83278
83260
|
statement += ` columns: [${it.columnsFrom.map((i2) => `table.${casing2(i2)}`).join(", ")}],
|
83279
83261
|
`;
|
@@ -83284,8 +83266,7 @@ import { sql } from "drizzle-orm"
|
|
83284
83266
|
statement += ` })`;
|
83285
83267
|
statement += it.onUpdate && it.onUpdate !== "no action" ? `.onUpdate("${it.onUpdate}")` : "";
|
83286
83268
|
statement += it.onDelete && it.onDelete !== "no action" ? `.onDelete("${it.onDelete}")` : "";
|
83287
|
-
statement +=
|
83288
|
-
`;
|
83269
|
+
statement += `,`;
|
83289
83270
|
});
|
83290
83271
|
return statement;
|
83291
83272
|
};
|
@@ -83630,8 +83611,7 @@ var init_introspect_pg = __esm({
|
|
83630
83611
|
statement += "}";
|
83631
83612
|
if (Object.keys(table5.indexes).length > 0 || Object.values(table5.foreignKeys).length > 0 || Object.values(table5.policies).length > 0 || Object.keys(table5.compositePrimaryKeys).length > 0 || Object.keys(table5.uniqueConstraints).length > 0 || Object.keys(table5.checkConstraints).length > 0) {
|
83632
83613
|
statement += ", ";
|
83633
|
-
statement += "(table) =>
|
83634
|
-
statement += " return {\n";
|
83614
|
+
statement += "(table) => [";
|
83635
83615
|
statement += createTableIndexes3(table5.name, Object.values(table5.indexes), casing2);
|
83636
83616
|
statement += createTableFKs3(Object.values(table5.foreignKeys), schemas, casing2);
|
83637
83617
|
statement += createTablePKs3(
|
@@ -83651,8 +83631,7 @@ var init_introspect_pg = __esm({
|
|
83651
83631
|
Object.values(table5.checkConstraints),
|
83652
83632
|
casing2
|
83653
83633
|
);
|
83654
|
-
statement += "
|
83655
|
-
statement += "}";
|
83634
|
+
statement += "\n]";
|
83656
83635
|
}
|
83657
83636
|
statement += ");";
|
83658
83637
|
return statement;
|
@@ -84047,7 +84026,8 @@ import { sql } from "drizzle-orm"
|
|
84047
84026
|
it.columns.map((it2) => it2.expression)
|
84048
84027
|
);
|
84049
84028
|
const escapedIndexName = indexGeneratedName === it.name ? "" : `"${it.name}"`;
|
84050
|
-
statement += `
|
84029
|
+
statement += `
|
84030
|
+
`;
|
84051
84031
|
statement += it.isUnique ? "uniqueIndex(" : "index(";
|
84052
84032
|
statement += `${escapedIndexName})`;
|
84053
84033
|
statement += `${it.concurrently ? `.concurrently()` : ""}`;
|
@@ -84070,23 +84050,21 @@ import { sql } from "drizzle-orm"
|
|
84070
84050
|
return `${reversedString}}`;
|
84071
84051
|
}
|
84072
84052
|
statement += it.with && Object.keys(it.with).length > 0 ? `.with(${reverseLogic(it.with)})` : "";
|
84073
|
-
statement +=
|
84074
|
-
`;
|
84053
|
+
statement += `,`;
|
84075
84054
|
});
|
84076
84055
|
return statement;
|
84077
84056
|
};
|
84078
84057
|
createTablePKs3 = (pks, casing2) => {
|
84079
84058
|
let statement = "";
|
84080
84059
|
pks.forEach((it) => {
|
84081
|
-
|
84082
|
-
|
84060
|
+
statement += `
|
84061
|
+
`;
|
84083
84062
|
statement += "primaryKey({ columns: [";
|
84084
84063
|
statement += `${it.columns.map((c) => {
|
84085
84064
|
return `table.${withCasing2(c, casing2)}`;
|
84086
84065
|
}).join(", ")}]${it.name ? `, name: "${it.name}"` : ""}}`;
|
84087
84066
|
statement += ")";
|
84088
|
-
statement +=
|
84089
|
-
`;
|
84067
|
+
statement += `,`;
|
84090
84068
|
});
|
84091
84069
|
return statement;
|
84092
84070
|
};
|
@@ -84098,39 +84076,37 @@ import { sql } from "drizzle-orm"
|
|
84098
84076
|
const mappedItTo = (_a = it.to) == null ? void 0 : _a.map((v) => {
|
84099
84077
|
return rolesNameToTsKey[v] ? withCasing2(rolesNameToTsKey[v], casing2) : `"${v}"`;
|
84100
84078
|
});
|
84101
|
-
statement += `
|
84079
|
+
statement += `
|
84080
|
+
`;
|
84102
84081
|
statement += "pgPolicy(";
|
84103
84082
|
statement += `"${it.name}", { `;
|
84104
84083
|
statement += `as: "${(_b = it.as) == null ? void 0 : _b.toLowerCase()}", for: "${(_c = it.for) == null ? void 0 : _c.toLowerCase()}", to: [${mappedItTo == null ? void 0 : mappedItTo.join(", ")}]${it.using ? `, using: sql\`${it.using}\`` : ""}${it.withCheck ? `, withCheck: sql\`${it.withCheck}\` ` : ""}`;
|
84105
|
-
statement += ` })
|
84106
|
-
`;
|
84084
|
+
statement += ` }),`;
|
84107
84085
|
});
|
84108
84086
|
return statement;
|
84109
84087
|
};
|
84110
84088
|
createTableUniques3 = (unqs, casing2) => {
|
84111
84089
|
let statement = "";
|
84112
84090
|
unqs.forEach((it) => {
|
84113
|
-
|
84114
|
-
|
84091
|
+
statement += `
|
84092
|
+
`;
|
84115
84093
|
statement += "unique(";
|
84116
84094
|
statement += `"${it.name}")`;
|
84117
84095
|
statement += `.on(${it.columns.map((it2) => `table.${withCasing2(it2, casing2)}`).join(", ")})`;
|
84118
84096
|
statement += it.nullsNotDistinct ? `.nullsNotDistinct()` : "";
|
84119
|
-
statement +=
|
84120
|
-
`;
|
84097
|
+
statement += `,`;
|
84121
84098
|
});
|
84122
84099
|
return statement;
|
84123
84100
|
};
|
84124
84101
|
createTableChecks3 = (checkConstraints, casing2) => {
|
84125
84102
|
let statement = "";
|
84126
84103
|
checkConstraints.forEach((it) => {
|
84127
|
-
|
84128
|
-
|
84104
|
+
statement += `
|
84105
|
+
`;
|
84129
84106
|
statement += "check(";
|
84130
84107
|
statement += `"${it.name}", `;
|
84131
84108
|
statement += `sql\`${it.value}\`)`;
|
84132
|
-
statement +=
|
84133
|
-
`;
|
84109
|
+
statement += `,`;
|
84134
84110
|
});
|
84135
84111
|
return statement;
|
84136
84112
|
};
|
@@ -84141,7 +84117,9 @@ import { sql } from "drizzle-orm"
|
|
84141
84117
|
const paramName = paramNameFor(it.tableTo, tableSchema);
|
84142
84118
|
const isSelf4 = it.tableTo === it.tableFrom;
|
84143
84119
|
const tableTo = isSelf4 ? "table" : `${withCasing2(paramName, casing2)}`;
|
84144
|
-
statement += `
|
84120
|
+
statement += `
|
84121
|
+
`;
|
84122
|
+
statement += `foreignKey({
|
84145
84123
|
`;
|
84146
84124
|
statement += ` columns: [${it.columnsFrom.map((i2) => `table.${withCasing2(i2, casing2)}`).join(", ")}],
|
84147
84125
|
`;
|
@@ -84152,8 +84130,7 @@ import { sql } from "drizzle-orm"
|
|
84152
84130
|
statement += ` })`;
|
84153
84131
|
statement += it.onUpdate && it.onUpdate !== "no action" ? `.onUpdate("${it.onUpdate}")` : "";
|
84154
84132
|
statement += it.onDelete && it.onDelete !== "no action" ? `.onDelete("${it.onDelete}")` : "";
|
84155
|
-
statement +=
|
84156
|
-
`;
|
84133
|
+
statement += `,`;
|
84157
84134
|
});
|
84158
84135
|
return statement;
|
84159
84136
|
};
|
@@ -84319,8 +84296,7 @@ var init_introspect_singlestore = __esm({
|
|
84319
84296
|
statement += "}";
|
84320
84297
|
if (Object.keys(table5.indexes).length > 0 || Object.keys(table5.compositePrimaryKeys).length > 0 || Object.keys(table5.uniqueConstraints).length > 0) {
|
84321
84298
|
statement += ",\n";
|
84322
|
-
statement += "(table) =>
|
84323
|
-
statement += " return {\n";
|
84299
|
+
statement += "(table) => [";
|
84324
84300
|
statement += createTableIndexes4(
|
84325
84301
|
table5.name,
|
84326
84302
|
Object.values(table5.indexes),
|
@@ -84334,8 +84310,7 @@ var init_introspect_singlestore = __esm({
|
|
84334
84310
|
Object.values(table5.uniqueConstraints),
|
84335
84311
|
withCasing4
|
84336
84312
|
);
|
84337
|
-
statement += "
|
84338
|
-
statement += "}";
|
84313
|
+
statement += "\n]";
|
84339
84314
|
}
|
84340
84315
|
statement += ");";
|
84341
84316
|
return statement;
|
@@ -84638,25 +84613,22 @@ import { sql } from "drizzle-orm"
|
|
84638
84613
|
idxKey = casing2(idxKey);
|
84639
84614
|
const indexGeneratedName = indexName3(tableName, it.columns);
|
84640
84615
|
const escapedIndexName = indexGeneratedName === it.name ? "" : `"${it.name}"`;
|
84641
|
-
statement += `
|
84616
|
+
statement += `
|
84617
|
+
`;
|
84642
84618
|
statement += it.isUnique ? "uniqueIndex(" : "index(";
|
84643
84619
|
statement += `${escapedIndexName})`;
|
84644
84620
|
statement += `.on(${it.columns.map((it2) => `table.${casing2(it2)}`).join(", ")}),`;
|
84645
|
-
statement += `
|
84646
|
-
`;
|
84647
84621
|
});
|
84648
84622
|
return statement;
|
84649
84623
|
};
|
84650
84624
|
createTableUniques4 = (unqs, casing2) => {
|
84651
84625
|
let statement = "";
|
84652
84626
|
unqs.forEach((it) => {
|
84653
|
-
|
84654
|
-
|
84627
|
+
statement += `
|
84628
|
+
`;
|
84655
84629
|
statement += "unique(";
|
84656
84630
|
statement += `"${it.name}")`;
|
84657
84631
|
statement += `.on(${it.columns.map((it2) => `table.${casing2(it2)}`).join(", ")}),`;
|
84658
|
-
statement += `
|
84659
|
-
`;
|
84660
84632
|
});
|
84661
84633
|
return statement;
|
84662
84634
|
};
|
@@ -84664,14 +84636,13 @@ import { sql } from "drizzle-orm"
|
|
84664
84636
|
let statement = "";
|
84665
84637
|
pks.forEach((it) => {
|
84666
84638
|
let idxKey = casing2(it.name);
|
84667
|
-
statement += `
|
84639
|
+
statement += `
|
84640
|
+
`;
|
84668
84641
|
statement += "primaryKey({ columns: [";
|
84669
84642
|
statement += `${it.columns.map((c) => {
|
84670
84643
|
return `table.${casing2(c)}`;
|
84671
84644
|
}).join(", ")}]${it.name ? `, name: "${it.name}"` : ""}}`;
|
84672
84645
|
statement += "),";
|
84673
|
-
statement += `
|
84674
|
-
`;
|
84675
84646
|
});
|
84676
84647
|
return statement;
|
84677
84648
|
};
|
@@ -92435,7 +92406,7 @@ init_utils5();
|
|
92435
92406
|
var version2 = async () => {
|
92436
92407
|
const { npmVersion } = await ormCoreVersions();
|
92437
92408
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
92438
|
-
const envVersion = "0.
|
92409
|
+
const envVersion = "0.30.0-1abaaf8";
|
92439
92410
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
92440
92411
|
const versions = `drizzle-kit: ${kitVersion}
|
92441
92412
|
${ormVersion}`;
|