drizzle-kit 0.30.0-3256029 → 0.30.0-c56b864

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. package/api.js +305 -207
  2. package/api.mjs +305 -207
  3. package/bin.cjs +61 -81
  4. package/package.json +1 -1
package/bin.cjs CHANGED
@@ -81445,8 +81445,7 @@ var init_introspect_sqlite = __esm({
81445
81445
  });
81446
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) {
81447
81447
  statement += ",\n";
81448
- statement += "(table) => {\n";
81449
- statement += " return {\n";
81448
+ statement += "(table) => [";
81450
81449
  statement += createTableIndexes(
81451
81450
  table5.name,
81452
81451
  Object.values(table5.indexes),
@@ -81465,8 +81464,7 @@ var init_introspect_sqlite = __esm({
81465
81464
  Object.values(table5.checkConstraints),
81466
81465
  casing2
81467
81466
  );
81468
- statement += " }\n";
81469
- statement += "}";
81467
+ statement += "\n]";
81470
81468
  }
81471
81469
  statement += ");";
81472
81470
  return statement;
@@ -81623,12 +81621,11 @@ var init_introspect_sqlite = __esm({
81623
81621
  idxKey = withCasing(idxKey, casing2);
81624
81622
  const indexGeneratedName = indexName4(tableName, it.columns);
81625
81623
  const escapedIndexName = indexGeneratedName === it.name ? "" : `"${it.name}"`;
81626
- statement += ` ${idxKey}: `;
81624
+ statement += `
81625
+ `;
81627
81626
  statement += it.isUnique ? "uniqueIndex(" : "index(";
81628
81627
  statement += `${escapedIndexName})`;
81629
81628
  statement += `.on(${it.columns.map((it2) => `table.${withCasing(it2, casing2)}`).join(", ")}),`;
81630
- statement += `
81631
- `;
81632
81629
  });
81633
81630
  return statement;
81634
81631
  };
@@ -81636,39 +81633,36 @@ var init_introspect_sqlite = __esm({
81636
81633
  let statement = "";
81637
81634
  unqs.forEach((it) => {
81638
81635
  const idxKey = withCasing(it.name, casing2);
81639
- statement += ` ${idxKey}: `;
81636
+ statement += `
81637
+ `;
81640
81638
  statement += "unique(";
81641
81639
  statement += `"${it.name}")`;
81642
81640
  statement += `.on(${it.columns.map((it2) => `table.${withCasing(it2, casing2)}`).join(", ")}),`;
81643
- statement += `
81644
- `;
81645
81641
  });
81646
81642
  return statement;
81647
81643
  };
81648
81644
  createTableChecks = (checks, casing2) => {
81649
81645
  let statement = "";
81650
81646
  checks.forEach((it) => {
81651
- const checkKey = withCasing(it.name, casing2);
81652
- statement += ` ${checkKey}: `;
81647
+ statement += `
81648
+ `;
81653
81649
  statement += "check(";
81654
81650
  statement += `"${it.name}", `;
81655
81651
  statement += `sql\`${it.value}\`)`;
81656
- statement += `,
81657
- `;
81652
+ statement += `,`;
81658
81653
  });
81659
81654
  return statement;
81660
81655
  };
81661
81656
  createTablePKs = (pks, casing2) => {
81662
81657
  let statement = "";
81663
81658
  pks.forEach((it, i2) => {
81664
- statement += ` pk${i2}: `;
81659
+ statement += `
81660
+ `;
81665
81661
  statement += "primaryKey({ columns: [";
81666
81662
  statement += `${it.columns.map((c) => {
81667
81663
  return `table.${withCasing(c, casing2)}`;
81668
81664
  }).join(", ")}]${it.name ? `, name: "${it.name}"` : ""}}`;
81669
81665
  statement += ")";
81670
- statement += `
81671
- `;
81672
81666
  });
81673
81667
  return statement;
81674
81668
  };
@@ -81677,7 +81671,9 @@ var init_introspect_sqlite = __esm({
81677
81671
  fks.forEach((it) => {
81678
81672
  const isSelf4 = it.tableTo === it.tableFrom;
81679
81673
  const tableTo = isSelf4 ? "table" : `${withCasing(it.tableTo, casing2)}`;
81680
- statement += ` ${withCasing(it.name, casing2)}: foreignKey(() => ({
81674
+ statement += `
81675
+ `;
81676
+ statement += `foreignKey(() => ({
81681
81677
  `;
81682
81678
  statement += ` columns: [${it.columnsFrom.map((i2) => `table.${withCasing(i2, casing2)}`).join(", ")}],
81683
81679
  `;
@@ -81688,8 +81684,7 @@ var init_introspect_sqlite = __esm({
81688
81684
  statement += ` }))`;
81689
81685
  statement += it.onUpdate && it.onUpdate !== "no action" ? `.onUpdate("${it.onUpdate}")` : "";
81690
81686
  statement += it.onDelete && it.onDelete !== "no action" ? `.onDelete("${it.onDelete}")` : "";
81691
- statement += `,
81692
- `;
81687
+ statement += `,`;
81693
81688
  });
81694
81689
  return statement;
81695
81690
  };
@@ -82818,8 +82813,7 @@ var init_introspect_mysql = __esm({
82818
82813
  });
82819
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) {
82820
82815
  statement += ",\n";
82821
- statement += "(table) => {\n";
82822
- statement += " return {\n";
82816
+ statement += "(table) => [";
82823
82817
  statement += createTableIndexes2(
82824
82818
  table5.name,
82825
82819
  Object.values(table5.indexes),
@@ -82838,8 +82832,7 @@ var init_introspect_mysql = __esm({
82838
82832
  Object.values(table5.checkConstraint),
82839
82833
  withCasing4
82840
82834
  );
82841
- statement += " }\n";
82842
- statement += "}";
82835
+ statement += "\n]";
82843
82836
  }
82844
82837
  statement += ");";
82845
82838
  return statement;
@@ -83209,12 +83202,11 @@ import { sql } from "drizzle-orm"
83209
83202
  idxKey = casing2(idxKey);
83210
83203
  const indexGeneratedName = indexName(tableName, it.columns);
83211
83204
  const escapedIndexName = indexGeneratedName === it.name ? "" : `"${it.name}"`;
83212
- statement += ` ${idxKey}: `;
83205
+ statement += `
83206
+ `;
83213
83207
  statement += it.isUnique ? "uniqueIndex(" : "index(";
83214
83208
  statement += `${escapedIndexName})`;
83215
83209
  statement += `.on(${it.columns.map((it2) => `table.${casing2(it2)}`).join(", ")}),`;
83216
- statement += `
83217
- `;
83218
83210
  });
83219
83211
  return statement;
83220
83212
  };
@@ -83222,25 +83214,23 @@ import { sql } from "drizzle-orm"
83222
83214
  let statement = "";
83223
83215
  unqs.forEach((it) => {
83224
83216
  const idxKey = casing2(it.name);
83225
- statement += ` ${idxKey}: `;
83217
+ statement += `
83218
+ `;
83226
83219
  statement += "unique(";
83227
83220
  statement += `"${it.name}")`;
83228
83221
  statement += `.on(${it.columns.map((it2) => `table.${casing2(it2)}`).join(", ")}),`;
83229
- statement += `
83230
- `;
83231
83222
  });
83232
83223
  return statement;
83233
83224
  };
83234
83225
  createTableChecks2 = (checks, casing2) => {
83235
83226
  let statement = "";
83236
83227
  checks.forEach((it) => {
83237
- const checkKey = casing2(it.name);
83238
- statement += ` ${checkKey}: `;
83228
+ statement += `
83229
+ `;
83239
83230
  statement += "check(";
83240
83231
  statement += `"${it.name}", `;
83241
83232
  statement += `sql\`${it.value.replace(/`/g, "\\`")}\`)`;
83242
- statement += `,
83243
- `;
83233
+ statement += `,`;
83244
83234
  });
83245
83235
  return statement;
83246
83236
  };
@@ -83248,14 +83238,13 @@ import { sql } from "drizzle-orm"
83248
83238
  let statement = "";
83249
83239
  pks.forEach((it) => {
83250
83240
  let idxKey = casing2(it.name);
83251
- statement += ` ${idxKey}: `;
83241
+ statement += `
83242
+ `;
83252
83243
  statement += "primaryKey({ columns: [";
83253
83244
  statement += `${it.columns.map((c) => {
83254
83245
  return `table.${casing2(c)}`;
83255
83246
  }).join(", ")}]${it.name ? `, name: "${it.name}"` : ""}}`;
83256
83247
  statement += "),";
83257
- statement += `
83258
- `;
83259
83248
  });
83260
83249
  return statement;
83261
83250
  };
@@ -83264,7 +83253,9 @@ import { sql } from "drizzle-orm"
83264
83253
  fks.forEach((it) => {
83265
83254
  const isSelf4 = it.tableTo === it.tableFrom;
83266
83255
  const tableTo = isSelf4 ? "table" : `${casing2(it.tableTo)}`;
83267
- statement += ` ${casing2(it.name)}: foreignKey({
83256
+ statement += `
83257
+ `;
83258
+ statement += `foreignKey({
83268
83259
  `;
83269
83260
  statement += ` columns: [${it.columnsFrom.map((i2) => `table.${casing2(i2)}`).join(", ")}],
83270
83261
  `;
@@ -83275,8 +83266,7 @@ import { sql } from "drizzle-orm"
83275
83266
  statement += ` })`;
83276
83267
  statement += it.onUpdate && it.onUpdate !== "no action" ? `.onUpdate("${it.onUpdate}")` : "";
83277
83268
  statement += it.onDelete && it.onDelete !== "no action" ? `.onDelete("${it.onDelete}")` : "";
83278
- statement += `,
83279
- `;
83269
+ statement += `,`;
83280
83270
  });
83281
83271
  return statement;
83282
83272
  };
@@ -83621,8 +83611,7 @@ var init_introspect_pg = __esm({
83621
83611
  statement += "}";
83622
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) {
83623
83613
  statement += ", ";
83624
- statement += "(table) => {\n";
83625
- statement += " return {\n";
83614
+ statement += "(table) => [";
83626
83615
  statement += createTableIndexes3(table5.name, Object.values(table5.indexes), casing2);
83627
83616
  statement += createTableFKs3(Object.values(table5.foreignKeys), schemas, casing2);
83628
83617
  statement += createTablePKs3(
@@ -83642,8 +83631,7 @@ var init_introspect_pg = __esm({
83642
83631
  Object.values(table5.checkConstraints),
83643
83632
  casing2
83644
83633
  );
83645
- statement += " }\n";
83646
- statement += "}";
83634
+ statement += "\n]";
83647
83635
  }
83648
83636
  statement += ");";
83649
83637
  return statement;
@@ -84038,7 +84026,8 @@ import { sql } from "drizzle-orm"
84038
84026
  it.columns.map((it2) => it2.expression)
84039
84027
  );
84040
84028
  const escapedIndexName = indexGeneratedName === it.name ? "" : `"${it.name}"`;
84041
- statement += ` ${idxKey}: `;
84029
+ statement += `
84030
+ `;
84042
84031
  statement += it.isUnique ? "uniqueIndex(" : "index(";
84043
84032
  statement += `${escapedIndexName})`;
84044
84033
  statement += `${it.concurrently ? `.concurrently()` : ""}`;
@@ -84061,23 +84050,21 @@ import { sql } from "drizzle-orm"
84061
84050
  return `${reversedString}}`;
84062
84051
  }
84063
84052
  statement += it.with && Object.keys(it.with).length > 0 ? `.with(${reverseLogic(it.with)})` : "";
84064
- statement += `,
84065
- `;
84053
+ statement += `,`;
84066
84054
  });
84067
84055
  return statement;
84068
84056
  };
84069
84057
  createTablePKs3 = (pks, casing2) => {
84070
84058
  let statement = "";
84071
84059
  pks.forEach((it) => {
84072
- let idxKey = withCasing2(it.name, casing2);
84073
- statement += ` ${idxKey}: `;
84060
+ statement += `
84061
+ `;
84074
84062
  statement += "primaryKey({ columns: [";
84075
84063
  statement += `${it.columns.map((c) => {
84076
84064
  return `table.${withCasing2(c, casing2)}`;
84077
84065
  }).join(", ")}]${it.name ? `, name: "${it.name}"` : ""}}`;
84078
84066
  statement += ")";
84079
- statement += `,
84080
- `;
84067
+ statement += `,`;
84081
84068
  });
84082
84069
  return statement;
84083
84070
  };
@@ -84089,39 +84076,37 @@ import { sql } from "drizzle-orm"
84089
84076
  const mappedItTo = (_a = it.to) == null ? void 0 : _a.map((v) => {
84090
84077
  return rolesNameToTsKey[v] ? withCasing2(rolesNameToTsKey[v], casing2) : `"${v}"`;
84091
84078
  });
84092
- statement += ` ${idxKey}: `;
84079
+ statement += `
84080
+ `;
84093
84081
  statement += "pgPolicy(";
84094
84082
  statement += `"${it.name}", { `;
84095
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}\` ` : ""}`;
84096
- statement += ` }),
84097
- `;
84084
+ statement += ` }),`;
84098
84085
  });
84099
84086
  return statement;
84100
84087
  };
84101
84088
  createTableUniques3 = (unqs, casing2) => {
84102
84089
  let statement = "";
84103
84090
  unqs.forEach((it) => {
84104
- const idxKey = withCasing2(it.name, casing2);
84105
- statement += ` ${idxKey}: `;
84091
+ statement += `
84092
+ `;
84106
84093
  statement += "unique(";
84107
84094
  statement += `"${it.name}")`;
84108
84095
  statement += `.on(${it.columns.map((it2) => `table.${withCasing2(it2, casing2)}`).join(", ")})`;
84109
84096
  statement += it.nullsNotDistinct ? `.nullsNotDistinct()` : "";
84110
- statement += `,
84111
- `;
84097
+ statement += `,`;
84112
84098
  });
84113
84099
  return statement;
84114
84100
  };
84115
84101
  createTableChecks3 = (checkConstraints, casing2) => {
84116
84102
  let statement = "";
84117
84103
  checkConstraints.forEach((it) => {
84118
- const checkKey = withCasing2(it.name, casing2);
84119
- statement += ` ${checkKey}: `;
84104
+ statement += `
84105
+ `;
84120
84106
  statement += "check(";
84121
84107
  statement += `"${it.name}", `;
84122
84108
  statement += `sql\`${it.value}\`)`;
84123
- statement += `,
84124
- `;
84109
+ statement += `,`;
84125
84110
  });
84126
84111
  return statement;
84127
84112
  };
@@ -84132,7 +84117,9 @@ import { sql } from "drizzle-orm"
84132
84117
  const paramName = paramNameFor(it.tableTo, tableSchema);
84133
84118
  const isSelf4 = it.tableTo === it.tableFrom;
84134
84119
  const tableTo = isSelf4 ? "table" : `${withCasing2(paramName, casing2)}`;
84135
- statement += ` ${withCasing2(it.name, casing2)}: foreignKey({
84120
+ statement += `
84121
+ `;
84122
+ statement += `foreignKey({
84136
84123
  `;
84137
84124
  statement += ` columns: [${it.columnsFrom.map((i2) => `table.${withCasing2(i2, casing2)}`).join(", ")}],
84138
84125
  `;
@@ -84143,8 +84130,7 @@ import { sql } from "drizzle-orm"
84143
84130
  statement += ` })`;
84144
84131
  statement += it.onUpdate && it.onUpdate !== "no action" ? `.onUpdate("${it.onUpdate}")` : "";
84145
84132
  statement += it.onDelete && it.onDelete !== "no action" ? `.onDelete("${it.onDelete}")` : "";
84146
- statement += `,
84147
- `;
84133
+ statement += `,`;
84148
84134
  });
84149
84135
  return statement;
84150
84136
  };
@@ -84310,8 +84296,7 @@ var init_introspect_singlestore = __esm({
84310
84296
  statement += "}";
84311
84297
  if (Object.keys(table5.indexes).length > 0 || Object.keys(table5.compositePrimaryKeys).length > 0 || Object.keys(table5.uniqueConstraints).length > 0) {
84312
84298
  statement += ",\n";
84313
- statement += "(table) => {\n";
84314
- statement += " return {\n";
84299
+ statement += "(table) => [";
84315
84300
  statement += createTableIndexes4(
84316
84301
  table5.name,
84317
84302
  Object.values(table5.indexes),
@@ -84325,8 +84310,7 @@ var init_introspect_singlestore = __esm({
84325
84310
  Object.values(table5.uniqueConstraints),
84326
84311
  withCasing4
84327
84312
  );
84328
- statement += " }\n";
84329
- statement += "}";
84313
+ statement += "\n]";
84330
84314
  }
84331
84315
  statement += ");";
84332
84316
  return statement;
@@ -84629,25 +84613,22 @@ import { sql } from "drizzle-orm"
84629
84613
  idxKey = casing2(idxKey);
84630
84614
  const indexGeneratedName = indexName3(tableName, it.columns);
84631
84615
  const escapedIndexName = indexGeneratedName === it.name ? "" : `"${it.name}"`;
84632
- statement += ` ${idxKey}: `;
84616
+ statement += `
84617
+ `;
84633
84618
  statement += it.isUnique ? "uniqueIndex(" : "index(";
84634
84619
  statement += `${escapedIndexName})`;
84635
84620
  statement += `.on(${it.columns.map((it2) => `table.${casing2(it2)}`).join(", ")}),`;
84636
- statement += `
84637
- `;
84638
84621
  });
84639
84622
  return statement;
84640
84623
  };
84641
84624
  createTableUniques4 = (unqs, casing2) => {
84642
84625
  let statement = "";
84643
84626
  unqs.forEach((it) => {
84644
- const idxKey = casing2(it.name);
84645
- statement += ` ${idxKey}: `;
84627
+ statement += `
84628
+ `;
84646
84629
  statement += "unique(";
84647
84630
  statement += `"${it.name}")`;
84648
84631
  statement += `.on(${it.columns.map((it2) => `table.${casing2(it2)}`).join(", ")}),`;
84649
- statement += `
84650
- `;
84651
84632
  });
84652
84633
  return statement;
84653
84634
  };
@@ -84655,14 +84636,13 @@ import { sql } from "drizzle-orm"
84655
84636
  let statement = "";
84656
84637
  pks.forEach((it) => {
84657
84638
  let idxKey = casing2(it.name);
84658
- statement += ` ${idxKey}: `;
84639
+ statement += `
84640
+ `;
84659
84641
  statement += "primaryKey({ columns: [";
84660
84642
  statement += `${it.columns.map((c) => {
84661
84643
  return `table.${casing2(c)}`;
84662
84644
  }).join(", ")}]${it.name ? `, name: "${it.name}"` : ""}}`;
84663
84645
  statement += "),";
84664
- statement += `
84665
- `;
84666
84646
  });
84667
84647
  return statement;
84668
84648
  };
@@ -91831,7 +91811,7 @@ var generate = command2({
91831
91811
  } else if (dialect6 === "turso") {
91832
91812
  await prepareAndMigrateLibSQL2(opts);
91833
91813
  } else if (dialect6 === "singlestore") {
91834
- await prepareAndMigrateSqlite2(opts);
91814
+ await prepareAndMigrateSingleStore2(opts);
91835
91815
  } else {
91836
91816
  assertUnreachable(dialect6);
91837
91817
  }
@@ -92426,7 +92406,7 @@ init_utils5();
92426
92406
  var version2 = async () => {
92427
92407
  const { npmVersion } = await ormCoreVersions();
92428
92408
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
92429
- const envVersion = "0.30.0-3256029";
92409
+ const envVersion = "0.30.0-c56b864";
92430
92410
  const kitVersion = envVersion ? `v${envVersion}` : "--";
92431
92411
  const versions = `drizzle-kit: ${kitVersion}
92432
92412
  ${ormVersion}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.30.0-3256029",
3
+ "version": "0.30.0-c56b864",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",