drizzle-kit 0.22.7-28915b7 → 0.22.7-9e796de

Sign up to get free protection for your applications and to get access to all the features.
package/bin.cjs CHANGED
@@ -22390,21 +22390,14 @@ function mapSqlToSqliteType(sqlType) {
22390
22390
  }
22391
22391
  }
22392
22392
  function extractGeneratedColumns(input) {
22393
- console.log("input", input);
22394
22393
  const columns = {};
22395
- const lines = input.split(/,\s*(?![^()]*\))/);
22394
+ const lines = input.split("\n");
22396
22395
  for (const line of lines) {
22397
22396
  if (line.includes("GENERATED ALWAYS AS")) {
22398
22397
  const parts = line.trim().split(/\s+/);
22399
- const columnName = parts[0].replace(/[`'"]/g, "");
22398
+ const columnName = parts[0].slice(1, parts[0].length - 1);
22400
22399
  const expression = line.substring(line.indexOf("("), line.indexOf(")") + 1).trim();
22401
- const typeIndex = parts.findIndex(
22402
- (part) => part.match(/(stored|virtual)/i)
22403
- );
22404
- let type = "virtual";
22405
- if (typeIndex !== -1) {
22406
- type = parts[typeIndex].replace(/[^a-z]/gi, "").toLowerCase();
22407
- }
22400
+ const type = parts[parts.length - 1].replace(/(^,)|(,$)/g, "").toLowerCase();
22408
22401
  columns[columnName] = {
22409
22402
  columnName,
22410
22403
  expression,
@@ -22412,7 +22405,6 @@ function extractGeneratedColumns(input) {
22412
22405
  };
22413
22406
  }
22414
22407
  }
22415
- console.log("columns", columns);
22416
22408
  return columns;
22417
22409
  }
22418
22410
  var import_drizzle_orm7, import_sqlite_core2, dialect6, generateSqliteSnapshot, fromDatabase3;
@@ -22453,7 +22445,7 @@ var init_sqliteSerializer = __esm({
22453
22445
  notNull,
22454
22446
  autoincrement: (0, import_drizzle_orm7.is)(column7, import_sqlite_core2.SQLiteBaseInteger) ? column7.autoIncrement : false,
22455
22447
  generated: generated ? {
22456
- 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})`,
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,
22457
22449
  type: generated.mode ?? "virtual"
22458
22450
  } : void 0
22459
22451
  };
@@ -23210,7 +23202,7 @@ var init_sqlgenerator = __esm({
23210
23202
  const notNullStatement = column7.notNull ? " NOT NULL" : "";
23211
23203
  const defaultStatement = column7.default !== void 0 ? ` DEFAULT ${column7.default}` : "";
23212
23204
  const autoincrementStatement = column7.autoincrement ? " AUTOINCREMENT" : "";
23213
- 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()}` : "";
23214
23206
  statement += " ";
23215
23207
  statement += `\`${column7.name}\` ${column7.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${notNullStatement}${generatedStatement}`;
23216
23208
  statement += i2 === columns.length - 1 ? "" : ",\n";
@@ -23641,7 +23633,7 @@ var init_sqlgenerator = __esm({
23641
23633
  const primaryKeyStatement = `${primaryKey ? " PRIMARY KEY" : ""}`;
23642
23634
  const referenceAsObject = referenceData ? SQLiteSquasher.unsquashFK(referenceData) : void 0;
23643
23635
  const referenceStatement = `${referenceAsObject ? ` REFERENCES ${referenceAsObject.tableTo}(${referenceAsObject.columnsTo})` : ""}`;
23644
- const generatedStatement = generated ? ` GENERATED ALWAYS AS ${generated.as} ${generated.type.toUpperCase()}` : "";
23636
+ const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated.as}) ${generated.type.toUpperCase()}` : "";
23645
23637
  return `ALTER TABLE \`${tableName}\` ADD \`${name}\` ${type}${primaryKeyStatement}${defaultStatement}${notNullStatement}${generatedStatement}${referenceStatement};`;
23646
23638
  }
23647
23639
  };
@@ -122412,9 +122404,9 @@ var init_sqlitePushUtils = __esm({
122412
122404
  );
122413
122405
  }
122414
122406
  } else {
122415
- const stmnt = fromJson([statement], "sqlite");
122407
+ const stmnt = fromJson([statement], "sqlite")[0];
122416
122408
  if (typeof stmnt !== "undefined") {
122417
- statementsToExecute.push(...stmnt);
122409
+ statementsToExecute.push(stmnt);
122418
122410
  }
122419
122411
  }
122420
122412
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.22.7-28915b7",
3
+ "version": "0.22.7-9e796de",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
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
  };
@@ -29069,21 +29069,14 @@ function mapSqlToSqliteType(sqlType) {
29069
29069
  }
29070
29070
  }
29071
29071
  function extractGeneratedColumns(input) {
29072
- console.log("input", input);
29073
29072
  const columns = {};
29074
- const lines = input.split(/,\s*(?![^()]*\))/);
29073
+ const lines = input.split("\n");
29075
29074
  for (const line of lines) {
29076
29075
  if (line.includes("GENERATED ALWAYS AS")) {
29077
29076
  const parts = line.trim().split(/\s+/);
29078
- const columnName = parts[0].replace(/[`'"]/g, "");
29077
+ const columnName = parts[0].slice(1, parts[0].length - 1);
29079
29078
  const expression = line.substring(line.indexOf("("), line.indexOf(")") + 1).trim();
29080
- const typeIndex = parts.findIndex(
29081
- (part) => part.match(/(stored|virtual)/i)
29082
- );
29083
- let type = "virtual";
29084
- if (typeIndex !== -1) {
29085
- type = parts[typeIndex].replace(/[^a-z]/gi, "").toLowerCase();
29086
- }
29079
+ const type = parts[parts.length - 1].replace(/(^,)|(,$)/g, "").toLowerCase();
29087
29080
  columns[columnName] = {
29088
29081
  columnName,
29089
29082
  expression,
@@ -29091,7 +29084,6 @@ function extractGeneratedColumns(input) {
29091
29084
  };
29092
29085
  }
29093
29086
  }
29094
- console.log("columns", columns);
29095
29087
  return columns;
29096
29088
  }
29097
29089
  var dialect5, generateSqliteSnapshot, fromDatabase2;
@@ -29132,7 +29124,7 @@ var init_sqliteSerializer = __esm({
29132
29124
  notNull,
29133
29125
  autoincrement: is(column4, SQLiteBaseInteger) ? column4.autoIncrement : false,
29134
29126
  generated: generated ? {
29135
- as: is(generated.as, SQL) ? `(${dialect5.sqlToQuery(generated.as, "indexes").sql})` : typeof generated.as === "function" ? `(${dialect5.sqlToQuery(generated.as(), "indexes").sql})` : `(${generated.as})`,
29127
+ as: is(generated.as, SQL) ? dialect5.sqlToQuery(generated.as, "indexes").sql : typeof generated.as === "function" ? dialect5.sqlToQuery(generated.as(), "indexes").sql : generated.as,
29136
29128
  type: generated.mode ?? "virtual"
29137
29129
  } : void 0
29138
29130
  };
@@ -35103,9 +35095,9 @@ var logSuggestionsAndReturn = async (connection, statements, json1, json2, meta)
35103
35095
  );
35104
35096
  }
35105
35097
  } else {
35106
- const stmnt = fromJson([statement], "sqlite");
35098
+ const stmnt = fromJson([statement], "sqlite")[0];
35107
35099
  if (typeof stmnt !== "undefined") {
35108
- statementsToExecute.push(...stmnt);
35100
+ statementsToExecute.push(stmnt);
35109
35101
  }
35110
35102
  }
35111
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
  };
@@ -29074,21 +29074,14 @@ function mapSqlToSqliteType(sqlType) {
29074
29074
  }
29075
29075
  }
29076
29076
  function extractGeneratedColumns(input) {
29077
- console.log("input", input);
29078
29077
  const columns = {};
29079
- const lines = input.split(/,\s*(?![^()]*\))/);
29078
+ const lines = input.split("\n");
29080
29079
  for (const line of lines) {
29081
29080
  if (line.includes("GENERATED ALWAYS AS")) {
29082
29081
  const parts = line.trim().split(/\s+/);
29083
- const columnName = parts[0].replace(/[`'"]/g, "");
29082
+ const columnName = parts[0].slice(1, parts[0].length - 1);
29084
29083
  const expression = line.substring(line.indexOf("("), line.indexOf(")") + 1).trim();
29085
- const typeIndex = parts.findIndex(
29086
- (part) => part.match(/(stored|virtual)/i)
29087
- );
29088
- let type = "virtual";
29089
- if (typeIndex !== -1) {
29090
- type = parts[typeIndex].replace(/[^a-z]/gi, "").toLowerCase();
29091
- }
29084
+ const type = parts[parts.length - 1].replace(/(^,)|(,$)/g, "").toLowerCase();
29092
29085
  columns[columnName] = {
29093
29086
  columnName,
29094
29087
  expression,
@@ -29096,7 +29089,6 @@ function extractGeneratedColumns(input) {
29096
29089
  };
29097
29090
  }
29098
29091
  }
29099
- console.log("columns", columns);
29100
29092
  return columns;
29101
29093
  }
29102
29094
  var dialect5, generateSqliteSnapshot, fromDatabase2;
@@ -29137,7 +29129,7 @@ var init_sqliteSerializer = __esm({
29137
29129
  notNull,
29138
29130
  autoincrement: is(column4, SQLiteBaseInteger) ? column4.autoIncrement : false,
29139
29131
  generated: generated ? {
29140
- as: is(generated.as, SQL) ? `(${dialect5.sqlToQuery(generated.as, "indexes").sql})` : typeof generated.as === "function" ? `(${dialect5.sqlToQuery(generated.as(), "indexes").sql})` : `(${generated.as})`,
29132
+ as: is(generated.as, SQL) ? dialect5.sqlToQuery(generated.as, "indexes").sql : typeof generated.as === "function" ? dialect5.sqlToQuery(generated.as(), "indexes").sql : generated.as,
29141
29133
  type: generated.mode ?? "virtual"
29142
29134
  } : void 0
29143
29135
  };
@@ -35094,9 +35086,9 @@ var logSuggestionsAndReturn = async (connection, statements, json1, json2, meta)
35094
35086
  );
35095
35087
  }
35096
35088
  } else {
35097
- const stmnt = fromJson([statement], "sqlite");
35089
+ const stmnt = fromJson([statement], "sqlite")[0];
35098
35090
  if (typeof stmnt !== "undefined") {
35099
- statementsToExecute.push(...stmnt);
35091
+ statementsToExecute.push(stmnt);
35100
35092
  }
35101
35093
  }
35102
35094
  }