drizzle-kit 0.22.4 → 0.22.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. package/bin.cjs +62 -27
  2. package/package.json +1 -1
  3. package/payload.js +47 -21
  4. package/payload.mjs +47 -21
package/bin.cjs CHANGED
@@ -4420,9 +4420,11 @@ Is ${source_default.bold.blue(
4420
4420
  render(status) {
4421
4421
  if (status === "pending") {
4422
4422
  const spin = this.spinner.value();
4423
- return `[${spin}] ${this.progressText}`;
4423
+ return `[${spin}] ${this.progressText}
4424
+ `;
4424
4425
  }
4425
- return `[${source_default.green("\u2713")}] ${this.successText}`;
4426
+ return `[${source_default.green("\u2713")}] ${this.successText}
4427
+ `;
4426
4428
  }
4427
4429
  };
4428
4430
  DropMigrationView = class extends import_hanji.Prompt {
@@ -9058,11 +9060,11 @@ var init_pgSchema = __esm({
9058
9060
  },
9059
9061
  squashIdxPush: (idx) => {
9060
9062
  index2.parse(idx);
9061
- return `${idx.name};${idx.columns.map((c) => `${c.isExpression ? "" : c.expression},${c.asc},${c.nulls}`).join(",,")};${idx.isUnique};${idx.method};${JSON.stringify(idx.with)}`;
9063
+ return `${idx.name};${idx.columns.map((c) => `${c.isExpression ? "" : c.expression}--${c.asc}--${c.nulls}`).join(",,")};${idx.isUnique};${idx.method};${JSON.stringify(idx.with)}`;
9062
9064
  },
9063
9065
  unsquashIdxPush: (input) => {
9064
9066
  const [name, columnsString, isUnique, method, idxWith] = input.split(";");
9065
- const columnString = columnsString.split(",,");
9067
+ const columnString = columnsString.split("--");
9066
9068
  const columns = [];
9067
9069
  for (const column7 of columnString) {
9068
9070
  const [expression, asc, nulls, opclass] = column7.split(",");
@@ -23742,7 +23744,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
23742
23744
  } = statement.data;
23743
23745
  const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
23744
23746
  const value = columns.map(
23745
- (it) => `${it.expression}${it.opclass ? ` ${it.opclass}` : it.asc ? "" : " DESC"}${it.asc && it.nulls && it.nulls === "last" || it.opclass ? "" : ` NULLS ${it.nulls.toUpperCase()}`}`
23747
+ (it) => `${it.isExpression ? it.expression : `"${it.expression}"`}${it.opclass ? ` ${it.opclass}` : it.asc ? "" : " DESC"}${it.asc && it.nulls && it.nulls === "last" || it.opclass ? "" : ` NULLS ${it.nulls.toUpperCase()}`}`
23746
23748
  ).join(",");
23747
23749
  const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
23748
23750
  function reverseLogic(mappedWith) {
@@ -121915,10 +121917,19 @@ var init_mysqlIntrospect = __esm({
121915
121917
  const filter2 = (tableName) => {
121916
121918
  if (matchers.length === 0)
121917
121919
  return true;
121918
- for (let i2 = 0; i2 < matchers.length; i2++) {
121919
- const matcher = matchers[i2];
121920
- if (matcher.match(tableName))
121921
- return true;
121920
+ let flags = [];
121921
+ for (let matcher of matchers) {
121922
+ if (matcher.negate) {
121923
+ if (!matcher.match(tableName)) {
121924
+ flags.push(false);
121925
+ }
121926
+ }
121927
+ if (matcher.match(tableName)) {
121928
+ flags.push(true);
121929
+ }
121930
+ }
121931
+ if (flags.length > 0) {
121932
+ return flags.every(Boolean);
121922
121933
  }
121923
121934
  return false;
121924
121935
  };
@@ -121958,10 +121969,19 @@ var init_pgIntrospect = __esm({
121958
121969
  const filter2 = (tableName) => {
121959
121970
  if (matchers.length === 0)
121960
121971
  return true;
121961
- for (let i2 = 0; i2 < matchers.length; i2++) {
121962
- const matcher = matchers[i2];
121963
- if (matcher.match(tableName))
121964
- return true;
121972
+ let flags = [];
121973
+ for (let matcher of matchers) {
121974
+ if (matcher.negate) {
121975
+ if (!matcher.match(tableName)) {
121976
+ flags.push(false);
121977
+ }
121978
+ }
121979
+ if (matcher.match(tableName)) {
121980
+ flags.push(true);
121981
+ }
121982
+ }
121983
+ if (flags.length > 0) {
121984
+ return flags.every(Boolean);
121965
121985
  }
121966
121986
  return false;
121967
121987
  };
@@ -122306,10 +122326,19 @@ var init_sqliteIntrospect = __esm({
122306
122326
  const filter2 = (tableName) => {
122307
122327
  if (matchers.length === 0)
122308
122328
  return true;
122309
- for (let i2 = 0; i2 < matchers.length; i2++) {
122310
- const matcher = matchers[i2];
122311
- if (matcher.match(tableName))
122312
- return true;
122329
+ let flags = [];
122330
+ for (let matcher of matchers) {
122331
+ if (matcher.negate) {
122332
+ if (!matcher.match(tableName)) {
122333
+ flags.push(false);
122334
+ }
122335
+ }
122336
+ if (matcher.match(tableName)) {
122337
+ flags.push(true);
122338
+ }
122339
+ }
122340
+ if (flags.length > 0) {
122341
+ return flags.every(Boolean);
122313
122342
  }
122314
122343
  return false;
122315
122344
  };
@@ -122331,10 +122360,19 @@ var init_sqliteIntrospect = __esm({
122331
122360
  const filter2 = (tableName) => {
122332
122361
  if (matchers.length === 0)
122333
122362
  return true;
122334
- for (let i2 = 0; i2 < matchers.length; i2++) {
122335
- const matcher = matchers[i2];
122336
- if (matcher.match(tableName))
122337
- return true;
122363
+ let flags = [];
122364
+ for (let matcher of matchers) {
122365
+ if (matcher.negate) {
122366
+ if (!matcher.match(tableName)) {
122367
+ flags.push(false);
122368
+ }
122369
+ }
122370
+ if (matcher.match(tableName)) {
122371
+ flags.push(true);
122372
+ }
122373
+ }
122374
+ if (flags.length > 0) {
122375
+ return flags.every(Boolean);
122338
122376
  }
122339
122377
  return false;
122340
122378
  };
@@ -122342,10 +122380,7 @@ var init_sqliteIntrospect = __esm({
122342
122380
  "Pulling schema from database...",
122343
122381
  "Pulling schema from database..."
122344
122382
  );
122345
- const res = await (0, import_hanji10.renderWithTask)(
122346
- progress,
122347
- fromDatabase3(db2, filter2)
122348
- );
122383
+ const res = await (0, import_hanji10.renderWithTask)(progress, fromDatabase3(db2, filter2));
122349
122384
  const schema5 = { id: originUUID, prevId: "", ...res };
122350
122385
  return { schema: schema5 };
122351
122386
  };
@@ -128324,7 +128359,7 @@ var updateUpToV7 = (json) => {
128324
128359
  opClass: void 0
128325
128360
  };
128326
128361
  });
128327
- return [idx[0], { columns: mappedColumns, ...rest }];
128362
+ return [idx[0], { columns: mappedColumns, with: {}, ...rest }];
128328
128363
  })
128329
128364
  );
128330
128365
  return [it[0], { ...table4, indexes: mappedIndexes }];
@@ -129502,7 +129537,7 @@ var printVersions = async () => {
129502
129537
  var versions = async () => {
129503
129538
  const { npmVersion } = await ormCoreVersions();
129504
129539
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
129505
- const envVersion = "0.22.4";
129540
+ const envVersion = "0.22.6";
129506
129541
  const kitVersion = envVersion ? `v${envVersion}` : "--";
129507
129542
  const versions2 = `drizzle-kit: ${kitVersion}
129508
129543
  ${ormVersion}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.22.4",
3
+ "version": "0.22.6",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
package/payload.js CHANGED
@@ -15191,11 +15191,11 @@ var init_pgSchema = __esm({
15191
15191
  },
15192
15192
  squashIdxPush: (idx) => {
15193
15193
  index2.parse(idx);
15194
- return `${idx.name};${idx.columns.map((c) => `${c.isExpression ? "" : c.expression},${c.asc},${c.nulls}`).join(",,")};${idx.isUnique};${idx.method};${JSON.stringify(idx.with)}`;
15194
+ return `${idx.name};${idx.columns.map((c) => `${c.isExpression ? "" : c.expression}--${c.asc}--${c.nulls}`).join(",,")};${idx.isUnique};${idx.method};${JSON.stringify(idx.with)}`;
15195
15195
  },
15196
15196
  unsquashIdxPush: (input) => {
15197
15197
  const [name2, columnsString, isUnique, method, idxWith] = input.split(";");
15198
- const columnString = columnsString.split(",,");
15198
+ const columnString = columnsString.split("--");
15199
15199
  const columns = [];
15200
15200
  for (const column4 of columnString) {
15201
15201
  const [expression, asc2, nulls, opclass] = column4.split(",");
@@ -15783,9 +15783,11 @@ Is ${source_default.bold.blue(
15783
15783
  render(status) {
15784
15784
  if (status === "pending") {
15785
15785
  const spin = this.spinner.value();
15786
- return `[${spin}] ${this.progressText}`;
15786
+ return `[${spin}] ${this.progressText}
15787
+ `;
15787
15788
  }
15788
- return `[${source_default.green("\u2713")}] ${this.successText}`;
15789
+ return `[${source_default.green("\u2713")}] ${this.successText}
15790
+ `;
15789
15791
  }
15790
15792
  };
15791
15793
  }
@@ -24359,7 +24361,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24359
24361
  } = statement.data;
24360
24362
  const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
24361
24363
  const value = columns.map(
24362
- (it) => `${it.expression}${it.opclass ? ` ${it.opclass}` : it.asc ? "" : " DESC"}${it.asc && it.nulls && it.nulls === "last" || it.opclass ? "" : ` NULLS ${it.nulls.toUpperCase()}`}`
24364
+ (it) => `${it.isExpression ? it.expression : `"${it.expression}"`}${it.opclass ? ` ${it.opclass}` : it.asc ? "" : " DESC"}${it.asc && it.nulls && it.nulls === "last" || it.opclass ? "" : ` NULLS ${it.nulls.toUpperCase()}`}`
24363
24365
  ).join(",");
24364
24366
  const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
24365
24367
  function reverseLogic(mappedWith) {
@@ -33280,10 +33282,19 @@ var init_mysqlIntrospect = __esm({
33280
33282
  const filter2 = (tableName) => {
33281
33283
  if (matchers.length === 0)
33282
33284
  return true;
33283
- for (let i = 0; i < matchers.length; i++) {
33284
- const matcher = matchers[i];
33285
- if (matcher.match(tableName))
33286
- return true;
33285
+ let flags = [];
33286
+ for (let matcher of matchers) {
33287
+ if (matcher.negate) {
33288
+ if (!matcher.match(tableName)) {
33289
+ flags.push(false);
33290
+ }
33291
+ }
33292
+ if (matcher.match(tableName)) {
33293
+ flags.push(true);
33294
+ }
33295
+ }
33296
+ if (flags.length > 0) {
33297
+ return flags.every(Boolean);
33287
33298
  }
33288
33299
  return false;
33289
33300
  };
@@ -33338,10 +33349,19 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
33338
33349
  const filter2 = (tableName) => {
33339
33350
  if (matchers.length === 0)
33340
33351
  return true;
33341
- for (let i = 0; i < matchers.length; i++) {
33342
- const matcher = matchers[i];
33343
- if (matcher.match(tableName))
33344
- return true;
33352
+ let flags = [];
33353
+ for (let matcher of matchers) {
33354
+ if (matcher.negate) {
33355
+ if (!matcher.match(tableName)) {
33356
+ flags.push(false);
33357
+ }
33358
+ }
33359
+ if (matcher.match(tableName)) {
33360
+ flags.push(true);
33361
+ }
33362
+ }
33363
+ if (flags.length > 0) {
33364
+ return flags.every(Boolean);
33345
33365
  }
33346
33366
  return false;
33347
33367
  };
@@ -33720,10 +33740,19 @@ var sqlitePushIntrospect = async (db, filters) => {
33720
33740
  const filter2 = (tableName) => {
33721
33741
  if (matchers.length === 0)
33722
33742
  return true;
33723
- for (let i = 0; i < matchers.length; i++) {
33724
- const matcher = matchers[i];
33725
- if (matcher.match(tableName))
33726
- return true;
33743
+ let flags = [];
33744
+ for (let matcher of matchers) {
33745
+ if (matcher.negate) {
33746
+ if (!matcher.match(tableName)) {
33747
+ flags.push(false);
33748
+ }
33749
+ }
33750
+ if (matcher.match(tableName)) {
33751
+ flags.push(true);
33752
+ }
33753
+ }
33754
+ if (flags.length > 0) {
33755
+ return flags.every(Boolean);
33727
33756
  }
33728
33757
  return false;
33729
33758
  };
@@ -33731,10 +33760,7 @@ var sqlitePushIntrospect = async (db, filters) => {
33731
33760
  "Pulling schema from database...",
33732
33761
  "Pulling schema from database..."
33733
33762
  );
33734
- const res = await (0, import_hanji7.renderWithTask)(
33735
- progress,
33736
- fromDatabase2(db, filter2)
33737
- );
33763
+ const res = await (0, import_hanji7.renderWithTask)(progress, fromDatabase2(db, filter2));
33738
33764
  const schema4 = { id: originUUID, prevId: "", ...res };
33739
33765
  return { schema: schema4 };
33740
33766
  };
package/payload.mjs CHANGED
@@ -15197,11 +15197,11 @@ var init_pgSchema = __esm({
15197
15197
  },
15198
15198
  squashIdxPush: (idx) => {
15199
15199
  index2.parse(idx);
15200
- return `${idx.name};${idx.columns.map((c) => `${c.isExpression ? "" : c.expression},${c.asc},${c.nulls}`).join(",,")};${idx.isUnique};${idx.method};${JSON.stringify(idx.with)}`;
15200
+ return `${idx.name};${idx.columns.map((c) => `${c.isExpression ? "" : c.expression}--${c.asc}--${c.nulls}`).join(",,")};${idx.isUnique};${idx.method};${JSON.stringify(idx.with)}`;
15201
15201
  },
15202
15202
  unsquashIdxPush: (input) => {
15203
15203
  const [name2, columnsString, isUnique, method, idxWith] = input.split(";");
15204
- const columnString = columnsString.split(",,");
15204
+ const columnString = columnsString.split("--");
15205
15205
  const columns = [];
15206
15206
  for (const column4 of columnString) {
15207
15207
  const [expression, asc2, nulls, opclass] = column4.split(",");
@@ -15789,9 +15789,11 @@ Is ${source_default.bold.blue(
15789
15789
  render(status) {
15790
15790
  if (status === "pending") {
15791
15791
  const spin = this.spinner.value();
15792
- return `[${spin}] ${this.progressText}`;
15792
+ return `[${spin}] ${this.progressText}
15793
+ `;
15793
15794
  }
15794
- return `[${source_default.green("\u2713")}] ${this.successText}`;
15795
+ return `[${source_default.green("\u2713")}] ${this.successText}
15796
+ `;
15795
15797
  }
15796
15798
  };
15797
15799
  }
@@ -24365,7 +24367,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24365
24367
  } = statement.data;
24366
24368
  const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
24367
24369
  const value = columns.map(
24368
- (it) => `${it.expression}${it.opclass ? ` ${it.opclass}` : it.asc ? "" : " DESC"}${it.asc && it.nulls && it.nulls === "last" || it.opclass ? "" : ` NULLS ${it.nulls.toUpperCase()}`}`
24370
+ (it) => `${it.isExpression ? it.expression : `"${it.expression}"`}${it.opclass ? ` ${it.opclass}` : it.asc ? "" : " DESC"}${it.asc && it.nulls && it.nulls === "last" || it.opclass ? "" : ` NULLS ${it.nulls.toUpperCase()}`}`
24369
24371
  ).join(",");
24370
24372
  const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
24371
24373
  function reverseLogic(mappedWith) {
@@ -33286,10 +33288,19 @@ var init_mysqlIntrospect = __esm({
33286
33288
  const filter2 = (tableName) => {
33287
33289
  if (matchers.length === 0)
33288
33290
  return true;
33289
- for (let i = 0; i < matchers.length; i++) {
33290
- const matcher = matchers[i];
33291
- if (matcher.match(tableName))
33292
- return true;
33291
+ let flags = [];
33292
+ for (let matcher of matchers) {
33293
+ if (matcher.negate) {
33294
+ if (!matcher.match(tableName)) {
33295
+ flags.push(false);
33296
+ }
33297
+ }
33298
+ if (matcher.match(tableName)) {
33299
+ flags.push(true);
33300
+ }
33301
+ }
33302
+ if (flags.length > 0) {
33303
+ return flags.every(Boolean);
33293
33304
  }
33294
33305
  return false;
33295
33306
  };
@@ -33330,10 +33341,19 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
33330
33341
  const filter2 = (tableName) => {
33331
33342
  if (matchers.length === 0)
33332
33343
  return true;
33333
- for (let i = 0; i < matchers.length; i++) {
33334
- const matcher = matchers[i];
33335
- if (matcher.match(tableName))
33336
- return true;
33344
+ let flags = [];
33345
+ for (let matcher of matchers) {
33346
+ if (matcher.negate) {
33347
+ if (!matcher.match(tableName)) {
33348
+ flags.push(false);
33349
+ }
33350
+ }
33351
+ if (matcher.match(tableName)) {
33352
+ flags.push(true);
33353
+ }
33354
+ }
33355
+ if (flags.length > 0) {
33356
+ return flags.every(Boolean);
33337
33357
  }
33338
33358
  return false;
33339
33359
  };
@@ -33712,10 +33732,19 @@ var sqlitePushIntrospect = async (db, filters) => {
33712
33732
  const filter2 = (tableName) => {
33713
33733
  if (matchers.length === 0)
33714
33734
  return true;
33715
- for (let i = 0; i < matchers.length; i++) {
33716
- const matcher = matchers[i];
33717
- if (matcher.match(tableName))
33718
- return true;
33735
+ let flags = [];
33736
+ for (let matcher of matchers) {
33737
+ if (matcher.negate) {
33738
+ if (!matcher.match(tableName)) {
33739
+ flags.push(false);
33740
+ }
33741
+ }
33742
+ if (matcher.match(tableName)) {
33743
+ flags.push(true);
33744
+ }
33745
+ }
33746
+ if (flags.length > 0) {
33747
+ return flags.every(Boolean);
33719
33748
  }
33720
33749
  return false;
33721
33750
  };
@@ -33723,10 +33752,7 @@ var sqlitePushIntrospect = async (db, filters) => {
33723
33752
  "Pulling schema from database...",
33724
33753
  "Pulling schema from database..."
33725
33754
  );
33726
- const res = await (0, import_hanji7.renderWithTask)(
33727
- progress,
33728
- fromDatabase2(db, filter2)
33729
- );
33755
+ const res = await (0, import_hanji7.renderWithTask)(progress, fromDatabase2(db, filter2));
33730
33756
  const schema4 = { id: originUUID, prevId: "", ...res };
33731
33757
  return { schema: schema4 };
33732
33758
  };