drizzle-kit 0.19.11 → 0.19.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.cjs +13 -14
  2. package/package.json +1 -1
package/index.cjs CHANGED
@@ -12879,17 +12879,12 @@ The unique constraint ${source_default.underline.blue(
12879
12879
  WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock';
12880
12880
  `
12881
12881
  );
12882
- const isSeqExists = await db.query(
12883
- `SELECT * FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';`
12884
- );
12885
12882
  const tablesWithSeq = [];
12886
- if (isSeqExists.length > 0) {
12887
- const seq = await db.query(
12888
- `SELECT * FROM sqlite_sequence WHERE name != 'sqlite_sequence' and name != 'sqlite_stat1' and name != '_litestream_seq' and name != '_litestream_lock';`
12889
- );
12890
- for (const s of seq) {
12891
- tablesWithSeq.push(s.name);
12892
- }
12883
+ const seq = await db.query(
12884
+ `SELECT * FROM sqlite_master WHERE name != 'sqlite_sequence' and name != 'sqlite_stat1' and name != '_litestream_seq' and name != '_litestream_lock' and sql GLOB '*[ *' || CHAR(9) || CHAR(10) || CHAR(13) || ']AUTOINCREMENT[^'']*';`
12885
+ );
12886
+ for (const s of seq) {
12887
+ tablesWithSeq.push(s.name);
12893
12888
  }
12894
12889
  let columnsCount = 0;
12895
12890
  let tablesCount = /* @__PURE__ */ new Set();
@@ -12925,7 +12920,7 @@ The unique constraint ${source_default.underline.blue(
12925
12920
  const newColumn = {
12926
12921
  default: columnDefault === null ? void 0 : /^-?[\d.]+(?:e-?\d+)?$/.test(columnDefault) ? Number(columnDefault) : ["CURRENT_TIME", "CURRENT_DATE", "CURRENT_TIMESTAMP"].includes(
12927
12922
  columnDefault
12928
- ) ? `(${columnDefault})` : columnDefault === "false" ? false : columnDefault === "true" ? true : columnDefault.startsWith('"') && columnDefault.endsWith('"') ? columnDefault.substring(1, columnDefault.length - 1) : columnDefault,
12923
+ ) ? `(${columnDefault})` : columnDefault === "false" ? false : columnDefault === "true" ? true : columnDefault.startsWith("'") && columnDefault.endsWith("'") ? columnDefault : `(${columnDefault})`,
12929
12924
  autoincrement: isAutoincrement,
12930
12925
  name: columnName,
12931
12926
  type: mapSqlToSqliteType(columnType),
@@ -13026,7 +13021,7 @@ FROM sqlite_master AS m,
13026
13021
  pragma_index_list(m.name) AS il,
13027
13022
  pragma_index_info(il.name) AS ii
13028
13023
  WHERE
13029
- m.type = 'table';`
13024
+ m.type = 'table' and il.name NOT LIKE 'sqlite_autoindex_%';`
13030
13025
  );
13031
13026
  for (const idxRow of idxs) {
13032
13027
  const tableName = idxRow.tableName;
@@ -35939,6 +35934,7 @@ var init_mysql_introspect = __esm({
35939
35934
  patched = patched.startsWith("enum(") ? "mysqlEnum" : patched;
35940
35935
  patched = patched.startsWith("datetime(") ? "datetime" : patched;
35941
35936
  patched = patched.startsWith("varbinary(") ? "varbinary" : patched;
35937
+ patched = patched.startsWith("int(") ? "int" : patched;
35942
35938
  return patched;
35943
35939
  }).filter((type) => {
35944
35940
  return mysqlImportsList.has(type);
@@ -43089,6 +43085,9 @@ import { sql } from "drizzle-orm"
43089
43085
  if (defaultValue === "NULL") {
43090
43086
  return `sql\`NULL\``;
43091
43087
  }
43088
+ if (typeof defaultValue === "string" && defaultValue.startsWith("'") && defaultValue.endsWith("'")) {
43089
+ return defaultValue.substring(1, defaultValue.length - 1);
43090
+ }
43092
43091
  return defaultValue;
43093
43092
  };
43094
43093
  column6 = (type, name, defaultValue, autoincrement, casing) => {
@@ -43105,7 +43104,7 @@ import { sql } from "drizzle-orm"
43105
43104
  }
43106
43105
  if (lowered === "text") {
43107
43106
  let out = `${withCasing3(name, casing)}: text("${name}")`;
43108
- out += defaultValue ? `.default(${mapColumnDefault2(defaultValue)})` : "";
43107
+ out += defaultValue ? `.default("${mapColumnDefault2(defaultValue)}")` : "";
43109
43108
  return out;
43110
43109
  }
43111
43110
  if (lowered === "blob") {
@@ -52127,7 +52126,7 @@ init_source();
52127
52126
  // package.json
52128
52127
  var package_default = {
52129
52128
  name: "drizzle-kit",
52130
- version: "0.19.11",
52129
+ version: "0.19.12",
52131
52130
  repository: "https://github.com/drizzle-team/drizzle-kit-mirror",
52132
52131
  author: "Drizzle Team",
52133
52132
  license: "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.19.11",
3
+ "version": "0.19.12",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",