drizzle-kit 0.22.7-7d5e8a9 → 0.22.7-9e796de
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +8 -16
- package/package.json +1 -1
- package/payload.js +8 -14
- package/payload.mjs +8 -14
package/bin.cjs
CHANGED
@@ -22391,19 +22391,13 @@ function mapSqlToSqliteType(sqlType) {
|
|
22391
22391
|
}
|
22392
22392
|
function extractGeneratedColumns(input) {
|
22393
22393
|
const columns = {};
|
22394
|
-
const lines = input.split(
|
22394
|
+
const lines = input.split("\n");
|
22395
22395
|
for (const line of lines) {
|
22396
22396
|
if (line.includes("GENERATED ALWAYS AS")) {
|
22397
22397
|
const parts = line.trim().split(/\s+/);
|
22398
|
-
const columnName = parts[0].
|
22398
|
+
const columnName = parts[0].slice(1, parts[0].length - 1);
|
22399
22399
|
const expression = line.substring(line.indexOf("("), line.indexOf(")") + 1).trim();
|
22400
|
-
const
|
22401
|
-
(part) => part.match(/(stored|virtual)/i)
|
22402
|
-
);
|
22403
|
-
let type = "virtual";
|
22404
|
-
if (typeIndex !== -1) {
|
22405
|
-
type = parts[typeIndex].replace(/[^a-z]/gi, "").toLowerCase();
|
22406
|
-
}
|
22400
|
+
const type = parts[parts.length - 1].replace(/(^,)|(,$)/g, "").toLowerCase();
|
22407
22401
|
columns[columnName] = {
|
22408
22402
|
columnName,
|
22409
22403
|
expression,
|
@@ -22451,7 +22445,7 @@ var init_sqliteSerializer = __esm({
|
|
22451
22445
|
notNull,
|
22452
22446
|
autoincrement: (0, import_drizzle_orm7.is)(column7, import_sqlite_core2.SQLiteBaseInteger) ? column7.autoIncrement : false,
|
22453
22447
|
generated: generated ? {
|
22454
|
-
as: (0, import_drizzle_orm7.is)(generated.as, import_drizzle_orm7.SQL) ?
|
22448
|
+
as: (0, import_drizzle_orm7.is)(generated.as, import_drizzle_orm7.SQL) ? dialect6.sqlToQuery(generated.as, "indexes").sql : typeof generated.as === "function" ? dialect6.sqlToQuery(generated.as(), "indexes").sql : generated.as,
|
22455
22449
|
type: generated.mode ?? "virtual"
|
22456
22450
|
} : void 0
|
22457
22451
|
};
|
@@ -23208,7 +23202,7 @@ var init_sqlgenerator = __esm({
|
|
23208
23202
|
const notNullStatement = column7.notNull ? " NOT NULL" : "";
|
23209
23203
|
const defaultStatement = column7.default !== void 0 ? ` DEFAULT ${column7.default}` : "";
|
23210
23204
|
const autoincrementStatement = column7.autoincrement ? " AUTOINCREMENT" : "";
|
23211
|
-
const generatedStatement = column7.generated ? ` GENERATED ALWAYS AS ${column7.generated.as} ${column7.generated.type.toUpperCase()}` : "";
|
23205
|
+
const generatedStatement = column7.generated ? ` GENERATED ALWAYS AS (${column7.generated.as}) ${column7.generated.type.toUpperCase()}` : "";
|
23212
23206
|
statement += " ";
|
23213
23207
|
statement += `\`${column7.name}\` ${column7.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${notNullStatement}${generatedStatement}`;
|
23214
23208
|
statement += i2 === columns.length - 1 ? "" : ",\n";
|
@@ -23639,7 +23633,7 @@ var init_sqlgenerator = __esm({
|
|
23639
23633
|
const primaryKeyStatement = `${primaryKey ? " PRIMARY KEY" : ""}`;
|
23640
23634
|
const referenceAsObject = referenceData ? SQLiteSquasher.unsquashFK(referenceData) : void 0;
|
23641
23635
|
const referenceStatement = `${referenceAsObject ? ` REFERENCES ${referenceAsObject.tableTo}(${referenceAsObject.columnsTo})` : ""}`;
|
23642
|
-
const generatedStatement = generated ? ` GENERATED ALWAYS AS ${generated.as} ${generated.type.toUpperCase()}` : "";
|
23636
|
+
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated.as}) ${generated.type.toUpperCase()}` : "";
|
23643
23637
|
return `ALTER TABLE \`${tableName}\` ADD \`${name}\` ${type}${primaryKeyStatement}${defaultStatement}${notNullStatement}${generatedStatement}${referenceStatement};`;
|
23644
23638
|
}
|
23645
23639
|
};
|
@@ -122410,9 +122404,9 @@ var init_sqlitePushUtils = __esm({
|
|
122410
122404
|
);
|
122411
122405
|
}
|
122412
122406
|
} else {
|
122413
|
-
const stmnt = fromJson([statement], "sqlite");
|
122407
|
+
const stmnt = fromJson([statement], "sqlite")[0];
|
122414
122408
|
if (typeof stmnt !== "undefined") {
|
122415
|
-
statementsToExecute.push(
|
122409
|
+
statementsToExecute.push(stmnt);
|
122416
122410
|
}
|
122417
122411
|
}
|
122418
122412
|
}
|
@@ -124254,9 +124248,7 @@ var init_push = __esm({
|
|
124254
124248
|
}
|
124255
124249
|
await db2.query("commit");
|
124256
124250
|
} catch (e2) {
|
124257
|
-
console.error(e2);
|
124258
124251
|
await db2.query("rollback");
|
124259
|
-
process.exit(1);
|
124260
124252
|
}
|
124261
124253
|
} else if (credentials2.driver === "turso") {
|
124262
124254
|
await db2.batch(statementsToExecute.map((it) => ({ query: it })));
|
package/package.json
CHANGED
package/payload.js
CHANGED
@@ -24156,7 +24156,7 @@ var init_sqlgenerator = __esm({
|
|
24156
24156
|
const notNullStatement = column4.notNull ? " NOT NULL" : "";
|
24157
24157
|
const defaultStatement = column4.default !== void 0 ? ` DEFAULT ${column4.default}` : "";
|
24158
24158
|
const autoincrementStatement = column4.autoincrement ? " AUTOINCREMENT" : "";
|
24159
|
-
const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS ${column4.generated.as} ${column4.generated.type.toUpperCase()}` : "";
|
24159
|
+
const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS (${column4.generated.as}) ${column4.generated.type.toUpperCase()}` : "";
|
24160
24160
|
statement += " ";
|
24161
24161
|
statement += `\`${column4.name}\` ${column4.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${notNullStatement}${generatedStatement}`;
|
24162
24162
|
statement += i === columns.length - 1 ? "" : ",\n";
|
@@ -24587,7 +24587,7 @@ var init_sqlgenerator = __esm({
|
|
24587
24587
|
const primaryKeyStatement = `${primaryKey ? " PRIMARY KEY" : ""}`;
|
24588
24588
|
const referenceAsObject = referenceData ? SQLiteSquasher.unsquashFK(referenceData) : void 0;
|
24589
24589
|
const referenceStatement = `${referenceAsObject ? ` REFERENCES ${referenceAsObject.tableTo}(${referenceAsObject.columnsTo})` : ""}`;
|
24590
|
-
const generatedStatement = generated ? ` GENERATED ALWAYS AS ${generated.as} ${generated.type.toUpperCase()}` : "";
|
24590
|
+
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated.as}) ${generated.type.toUpperCase()}` : "";
|
24591
24591
|
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${defaultStatement}${notNullStatement}${generatedStatement}${referenceStatement};`;
|
24592
24592
|
}
|
24593
24593
|
};
|
@@ -29070,19 +29070,13 @@ function mapSqlToSqliteType(sqlType) {
|
|
29070
29070
|
}
|
29071
29071
|
function extractGeneratedColumns(input) {
|
29072
29072
|
const columns = {};
|
29073
|
-
const lines = input.split(
|
29073
|
+
const lines = input.split("\n");
|
29074
29074
|
for (const line of lines) {
|
29075
29075
|
if (line.includes("GENERATED ALWAYS AS")) {
|
29076
29076
|
const parts = line.trim().split(/\s+/);
|
29077
|
-
const columnName = parts[0].
|
29077
|
+
const columnName = parts[0].slice(1, parts[0].length - 1);
|
29078
29078
|
const expression = line.substring(line.indexOf("("), line.indexOf(")") + 1).trim();
|
29079
|
-
const
|
29080
|
-
(part) => part.match(/(stored|virtual)/i)
|
29081
|
-
);
|
29082
|
-
let type = "virtual";
|
29083
|
-
if (typeIndex !== -1) {
|
29084
|
-
type = parts[typeIndex].replace(/[^a-z]/gi, "").toLowerCase();
|
29085
|
-
}
|
29079
|
+
const type = parts[parts.length - 1].replace(/(^,)|(,$)/g, "").toLowerCase();
|
29086
29080
|
columns[columnName] = {
|
29087
29081
|
columnName,
|
29088
29082
|
expression,
|
@@ -29130,7 +29124,7 @@ var init_sqliteSerializer = __esm({
|
|
29130
29124
|
notNull,
|
29131
29125
|
autoincrement: is(column4, SQLiteBaseInteger) ? column4.autoIncrement : false,
|
29132
29126
|
generated: generated ? {
|
29133
|
-
as: is(generated.as, SQL) ?
|
29127
|
+
as: is(generated.as, SQL) ? dialect5.sqlToQuery(generated.as, "indexes").sql : typeof generated.as === "function" ? dialect5.sqlToQuery(generated.as(), "indexes").sql : generated.as,
|
29134
29128
|
type: generated.mode ?? "virtual"
|
29135
29129
|
} : void 0
|
29136
29130
|
};
|
@@ -35101,9 +35095,9 @@ var logSuggestionsAndReturn = async (connection, statements, json1, json2, meta)
|
|
35101
35095
|
);
|
35102
35096
|
}
|
35103
35097
|
} else {
|
35104
|
-
const stmnt = fromJson([statement], "sqlite");
|
35098
|
+
const stmnt = fromJson([statement], "sqlite")[0];
|
35105
35099
|
if (typeof stmnt !== "undefined") {
|
35106
|
-
statementsToExecute.push(
|
35100
|
+
statementsToExecute.push(stmnt);
|
35107
35101
|
}
|
35108
35102
|
}
|
35109
35103
|
}
|
package/payload.mjs
CHANGED
@@ -24161,7 +24161,7 @@ var init_sqlgenerator = __esm({
|
|
24161
24161
|
const notNullStatement = column4.notNull ? " NOT NULL" : "";
|
24162
24162
|
const defaultStatement = column4.default !== void 0 ? ` DEFAULT ${column4.default}` : "";
|
24163
24163
|
const autoincrementStatement = column4.autoincrement ? " AUTOINCREMENT" : "";
|
24164
|
-
const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS ${column4.generated.as} ${column4.generated.type.toUpperCase()}` : "";
|
24164
|
+
const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS (${column4.generated.as}) ${column4.generated.type.toUpperCase()}` : "";
|
24165
24165
|
statement += " ";
|
24166
24166
|
statement += `\`${column4.name}\` ${column4.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${notNullStatement}${generatedStatement}`;
|
24167
24167
|
statement += i === columns.length - 1 ? "" : ",\n";
|
@@ -24592,7 +24592,7 @@ var init_sqlgenerator = __esm({
|
|
24592
24592
|
const primaryKeyStatement = `${primaryKey ? " PRIMARY KEY" : ""}`;
|
24593
24593
|
const referenceAsObject = referenceData ? SQLiteSquasher.unsquashFK(referenceData) : void 0;
|
24594
24594
|
const referenceStatement = `${referenceAsObject ? ` REFERENCES ${referenceAsObject.tableTo}(${referenceAsObject.columnsTo})` : ""}`;
|
24595
|
-
const generatedStatement = generated ? ` GENERATED ALWAYS AS ${generated.as} ${generated.type.toUpperCase()}` : "";
|
24595
|
+
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated.as}) ${generated.type.toUpperCase()}` : "";
|
24596
24596
|
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${defaultStatement}${notNullStatement}${generatedStatement}${referenceStatement};`;
|
24597
24597
|
}
|
24598
24598
|
};
|
@@ -29075,19 +29075,13 @@ function mapSqlToSqliteType(sqlType) {
|
|
29075
29075
|
}
|
29076
29076
|
function extractGeneratedColumns(input) {
|
29077
29077
|
const columns = {};
|
29078
|
-
const lines = input.split(
|
29078
|
+
const lines = input.split("\n");
|
29079
29079
|
for (const line of lines) {
|
29080
29080
|
if (line.includes("GENERATED ALWAYS AS")) {
|
29081
29081
|
const parts = line.trim().split(/\s+/);
|
29082
|
-
const columnName = parts[0].
|
29082
|
+
const columnName = parts[0].slice(1, parts[0].length - 1);
|
29083
29083
|
const expression = line.substring(line.indexOf("("), line.indexOf(")") + 1).trim();
|
29084
|
-
const
|
29085
|
-
(part) => part.match(/(stored|virtual)/i)
|
29086
|
-
);
|
29087
|
-
let type = "virtual";
|
29088
|
-
if (typeIndex !== -1) {
|
29089
|
-
type = parts[typeIndex].replace(/[^a-z]/gi, "").toLowerCase();
|
29090
|
-
}
|
29084
|
+
const type = parts[parts.length - 1].replace(/(^,)|(,$)/g, "").toLowerCase();
|
29091
29085
|
columns[columnName] = {
|
29092
29086
|
columnName,
|
29093
29087
|
expression,
|
@@ -29135,7 +29129,7 @@ var init_sqliteSerializer = __esm({
|
|
29135
29129
|
notNull,
|
29136
29130
|
autoincrement: is(column4, SQLiteBaseInteger) ? column4.autoIncrement : false,
|
29137
29131
|
generated: generated ? {
|
29138
|
-
as: is(generated.as, SQL) ?
|
29132
|
+
as: is(generated.as, SQL) ? dialect5.sqlToQuery(generated.as, "indexes").sql : typeof generated.as === "function" ? dialect5.sqlToQuery(generated.as(), "indexes").sql : generated.as,
|
29139
29133
|
type: generated.mode ?? "virtual"
|
29140
29134
|
} : void 0
|
29141
29135
|
};
|
@@ -35092,9 +35086,9 @@ var logSuggestionsAndReturn = async (connection, statements, json1, json2, meta)
|
|
35092
35086
|
);
|
35093
35087
|
}
|
35094
35088
|
} else {
|
35095
|
-
const stmnt = fromJson([statement], "sqlite");
|
35089
|
+
const stmnt = fromJson([statement], "sqlite")[0];
|
35096
35090
|
if (typeof stmnt !== "undefined") {
|
35097
|
-
statementsToExecute.push(
|
35091
|
+
statementsToExecute.push(stmnt);
|
35098
35092
|
}
|
35099
35093
|
}
|
35100
35094
|
}
|