drizzle-kit 0.16.9-fcedf83 → 0.17.0-6323eb6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +1773 -751
  2. package/package.json +11 -7
  3. package/utils.js +392 -111
package/utils.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -6669,7 +6670,7 @@ __export(utils_exports, {
6669
6670
  mapValues: () => mapValues,
6670
6671
  prepareMigrationFolder: () => prepareMigrationFolder,
6671
6672
  prepareMigrationMeta: () => prepareMigrationMeta,
6672
- prepareOutFolder: () => prepareOutFolder,
6673
+ prepareOutFolder: () => prepareOutFolder2,
6673
6674
  schemaRenameKey: () => schemaRenameKey,
6674
6675
  snapshotsPriorV4: () => snapshotsPriorV4,
6675
6676
  statementsForDiffs: () => statementsForDiffs,
@@ -7169,7 +7170,7 @@ var info = (msg, greyMsg = "") => {
7169
7170
  var originUUID = "00000000-0000-0000-0000-000000000000";
7170
7171
  var snapshotVersion = "5";
7171
7172
 
7172
- // node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
7173
+ // node_modules/.pnpm/zod@3.20.6/node_modules/zod/lib/index.mjs
7173
7174
  var util;
7174
7175
  (function(util2) {
7175
7176
  util2.assertEqual = (val) => val;
@@ -7584,7 +7585,7 @@ var OK = (value) => ({ status: "valid", value });
7584
7585
  var isAborted = (x) => x.status === "aborted";
7585
7586
  var isDirty = (x) => x.status === "dirty";
7586
7587
  var isValid = (x) => x.status === "valid";
7587
- var isAsync = (x) => typeof Promise !== void 0 && x instanceof Promise;
7588
+ var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
7588
7589
  var errorUtil;
7589
7590
  (function(errorUtil2) {
7590
7591
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
@@ -7800,28 +7801,29 @@ var ZodType = class {
7800
7801
  return this._refinement(refinement);
7801
7802
  }
7802
7803
  optional() {
7803
- return ZodOptional.create(this);
7804
+ return ZodOptional.create(this, this._def);
7804
7805
  }
7805
7806
  nullable() {
7806
- return ZodNullable.create(this);
7807
+ return ZodNullable.create(this, this._def);
7807
7808
  }
7808
7809
  nullish() {
7809
- return this.optional().nullable();
7810
+ return this.nullable().optional();
7810
7811
  }
7811
7812
  array() {
7812
- return ZodArray.create(this);
7813
+ return ZodArray.create(this, this._def);
7813
7814
  }
7814
7815
  promise() {
7815
- return ZodPromise.create(this);
7816
+ return ZodPromise.create(this, this._def);
7816
7817
  }
7817
7818
  or(option) {
7818
- return ZodUnion.create([this, option]);
7819
+ return ZodUnion.create([this, option], this._def);
7819
7820
  }
7820
7821
  and(incoming) {
7821
- return ZodIntersection.create(this, incoming);
7822
+ return ZodIntersection.create(this, incoming, this._def);
7822
7823
  }
7823
7824
  transform(transform) {
7824
7825
  return new ZodEffects({
7826
+ ...processCreateParams(this._def),
7825
7827
  schema: this,
7826
7828
  typeName: ZodFirstPartyTypeKind.ZodEffects,
7827
7829
  effect: { type: "transform", transform }
@@ -7830,6 +7832,7 @@ var ZodType = class {
7830
7832
  default(def) {
7831
7833
  const defaultValueFunc = typeof def === "function" ? def : () => def;
7832
7834
  return new ZodDefault({
7835
+ ...processCreateParams(this._def),
7833
7836
  innerType: this,
7834
7837
  defaultValue: defaultValueFunc,
7835
7838
  typeName: ZodFirstPartyTypeKind.ZodDefault
@@ -7839,14 +7842,15 @@ var ZodType = class {
7839
7842
  return new ZodBranded({
7840
7843
  typeName: ZodFirstPartyTypeKind.ZodBranded,
7841
7844
  type: this,
7842
- ...processCreateParams(void 0)
7845
+ ...processCreateParams(this._def)
7843
7846
  });
7844
7847
  }
7845
7848
  catch(def) {
7846
- const defaultValueFunc = typeof def === "function" ? def : () => def;
7849
+ const catchValueFunc = typeof def === "function" ? def : () => def;
7847
7850
  return new ZodCatch({
7851
+ ...processCreateParams(this._def),
7848
7852
  innerType: this,
7849
- defaultValue: defaultValueFunc,
7853
+ catchValue: catchValueFunc,
7850
7854
  typeName: ZodFirstPartyTypeKind.ZodCatch
7851
7855
  });
7852
7856
  }
@@ -7868,24 +7872,25 @@ var ZodType = class {
7868
7872
  }
7869
7873
  };
7870
7874
  var cuidRegex = /^c[^\s-]{8,}$/i;
7875
+ var cuid2Regex = /^[a-z][a-z0-9]*$/;
7871
7876
  var uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
7872
- var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
7877
+ var emailRegex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|([^-]([a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}))$/;
7873
7878
  var datetimeRegex = (args) => {
7874
7879
  if (args.precision) {
7875
7880
  if (args.offset) {
7876
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
7881
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
7877
7882
  } else {
7878
7883
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
7879
7884
  }
7880
7885
  } else if (args.precision === 0) {
7881
7886
  if (args.offset) {
7882
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
7887
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
7883
7888
  } else {
7884
7889
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
7885
7890
  }
7886
7891
  } else {
7887
7892
  if (args.offset) {
7888
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
7893
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
7889
7894
  } else {
7890
7895
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
7891
7896
  }
@@ -8007,6 +8012,16 @@ var ZodString = class extends ZodType {
8007
8012
  });
8008
8013
  status.dirty();
8009
8014
  }
8015
+ } else if (check.kind === "cuid2") {
8016
+ if (!cuid2Regex.test(input.data)) {
8017
+ ctx = this._getOrReturnCtx(input, ctx);
8018
+ addIssueToContext(ctx, {
8019
+ validation: "cuid2",
8020
+ code: ZodIssueCode.invalid_string,
8021
+ message: check.message
8022
+ });
8023
+ status.dirty();
8024
+ }
8010
8025
  } else if (check.kind === "url") {
8011
8026
  try {
8012
8027
  new URL(input.data);
@@ -8088,6 +8103,9 @@ var ZodString = class extends ZodType {
8088
8103
  cuid(message) {
8089
8104
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
8090
8105
  }
8106
+ cuid2(message) {
8107
+ return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
8108
+ }
8091
8109
  datetime(options) {
8092
8110
  var _a;
8093
8111
  if (typeof options === "string") {
@@ -8162,6 +8180,9 @@ var ZodString = class extends ZodType {
8162
8180
  get isCUID() {
8163
8181
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
8164
8182
  }
8183
+ get isCUID2() {
8184
+ return !!this._def.checks.find((ch) => ch.kind === "cuid2");
8185
+ }
8165
8186
  get minLength() {
8166
8187
  let min = null;
8167
8188
  for (const ch of this._def.checks) {
@@ -8392,7 +8413,22 @@ var ZodNumber = class extends ZodType {
8392
8413
  return max;
8393
8414
  }
8394
8415
  get isInt() {
8395
- return !!this._def.checks.find((ch) => ch.kind === "int");
8416
+ return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
8417
+ }
8418
+ get isFinite() {
8419
+ let max = null, min = null;
8420
+ for (const ch of this._def.checks) {
8421
+ if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
8422
+ return true;
8423
+ } else if (ch.kind === "min") {
8424
+ if (min === null || ch.value > min)
8425
+ min = ch.value;
8426
+ } else if (ch.kind === "max") {
8427
+ if (max === null || ch.value < max)
8428
+ max = ch.value;
8429
+ }
8430
+ }
8431
+ return Number.isFinite(min) && Number.isFinite(max);
8396
8432
  }
8397
8433
  };
8398
8434
  ZodNumber.create = (params) => {
@@ -8749,13 +8785,13 @@ var ZodArray = class extends ZodType {
8749
8785
  }
8750
8786
  }
8751
8787
  if (ctx.common.async) {
8752
- return Promise.all(ctx.data.map((item, i) => {
8788
+ return Promise.all([...ctx.data].map((item, i) => {
8753
8789
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
8754
8790
  })).then((result2) => {
8755
8791
  return ParseStatus.mergeArray(status, result2);
8756
8792
  });
8757
8793
  }
8758
- const result = ctx.data.map((item, i) => {
8794
+ const result = [...ctx.data].map((item, i) => {
8759
8795
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
8760
8796
  });
8761
8797
  return ParseStatus.mergeArray(status, result);
@@ -8804,15 +8840,6 @@ var objectUtil;
8804
8840
  };
8805
8841
  };
8806
8842
  })(objectUtil || (objectUtil = {}));
8807
- var AugmentFactory = (def) => (augmentation) => {
8808
- return new ZodObject({
8809
- ...def,
8810
- shape: () => ({
8811
- ...def.shape(),
8812
- ...augmentation
8813
- })
8814
- });
8815
- };
8816
8843
  function deepPartialify(schema3) {
8817
8844
  if (schema3 instanceof ZodObject) {
8818
8845
  const newShape = {};
@@ -8841,8 +8868,7 @@ var ZodObject = class extends ZodType {
8841
8868
  super(...arguments);
8842
8869
  this._cached = null;
8843
8870
  this.nonstrict = this.passthrough;
8844
- this.augment = AugmentFactory(this._def);
8845
- this.extend = AugmentFactory(this._def);
8871
+ this.augment = this.extend;
8846
8872
  }
8847
8873
  _getCached() {
8848
8874
  if (this._cached !== null)
@@ -8971,8 +8997,14 @@ var ZodObject = class extends ZodType {
8971
8997
  unknownKeys: "passthrough"
8972
8998
  });
8973
8999
  }
8974
- setKey(key, schema3) {
8975
- return this.augment({ [key]: schema3 });
9000
+ extend(augmentation) {
9001
+ return new ZodObject({
9002
+ ...this._def,
9003
+ shape: () => ({
9004
+ ...this._def.shape(),
9005
+ ...augmentation
9006
+ })
9007
+ });
8976
9008
  }
8977
9009
  merge(merging) {
8978
9010
  const merged = new ZodObject({
@@ -8983,6 +9015,9 @@ var ZodObject = class extends ZodType {
8983
9015
  });
8984
9016
  return merged;
8985
9017
  }
9018
+ setKey(key, schema3) {
9019
+ return this.augment({ [key]: schema3 });
9020
+ }
8986
9021
  catchall(index4) {
8987
9022
  return new ZodObject({
8988
9023
  ...this._def,
@@ -8991,9 +9026,10 @@ var ZodObject = class extends ZodType {
8991
9026
  }
8992
9027
  pick(mask) {
8993
9028
  const shape = {};
8994
- util.objectKeys(mask).map((key) => {
8995
- if (this.shape[key])
9029
+ util.objectKeys(mask).forEach((key) => {
9030
+ if (mask[key] && this.shape[key]) {
8996
9031
  shape[key] = this.shape[key];
9032
+ }
8997
9033
  });
8998
9034
  return new ZodObject({
8999
9035
  ...this._def,
@@ -9002,8 +9038,8 @@ var ZodObject = class extends ZodType {
9002
9038
  }
9003
9039
  omit(mask) {
9004
9040
  const shape = {};
9005
- util.objectKeys(this.shape).map((key) => {
9006
- if (util.objectKeys(mask).indexOf(key) === -1) {
9041
+ util.objectKeys(this.shape).forEach((key) => {
9042
+ if (!mask[key]) {
9007
9043
  shape[key] = this.shape[key];
9008
9044
  }
9009
9045
  });
@@ -9017,24 +9053,14 @@ var ZodObject = class extends ZodType {
9017
9053
  }
9018
9054
  partial(mask) {
9019
9055
  const newShape = {};
9020
- if (mask) {
9021
- util.objectKeys(this.shape).map((key) => {
9022
- if (util.objectKeys(mask).indexOf(key) === -1) {
9023
- newShape[key] = this.shape[key];
9024
- } else {
9025
- newShape[key] = this.shape[key].optional();
9026
- }
9027
- });
9028
- return new ZodObject({
9029
- ...this._def,
9030
- shape: () => newShape
9031
- });
9032
- } else {
9033
- for (const key in this.shape) {
9034
- const fieldSchema = this.shape[key];
9056
+ util.objectKeys(this.shape).forEach((key) => {
9057
+ const fieldSchema = this.shape[key];
9058
+ if (mask && !mask[key]) {
9059
+ newShape[key] = fieldSchema;
9060
+ } else {
9035
9061
  newShape[key] = fieldSchema.optional();
9036
9062
  }
9037
- }
9063
+ });
9038
9064
  return new ZodObject({
9039
9065
  ...this._def,
9040
9066
  shape: () => newShape
@@ -9042,21 +9068,10 @@ var ZodObject = class extends ZodType {
9042
9068
  }
9043
9069
  required(mask) {
9044
9070
  const newShape = {};
9045
- if (mask) {
9046
- util.objectKeys(this.shape).map((key) => {
9047
- if (util.objectKeys(mask).indexOf(key) === -1) {
9048
- newShape[key] = this.shape[key];
9049
- } else {
9050
- const fieldSchema = this.shape[key];
9051
- let newField = fieldSchema;
9052
- while (newField instanceof ZodOptional) {
9053
- newField = newField._def.innerType;
9054
- }
9055
- newShape[key] = newField;
9056
- }
9057
- });
9058
- } else {
9059
- for (const key in this.shape) {
9071
+ util.objectKeys(this.shape).forEach((key) => {
9072
+ if (mask && !mask[key]) {
9073
+ newShape[key] = this.shape[key];
9074
+ } else {
9060
9075
  const fieldSchema = this.shape[key];
9061
9076
  let newField = fieldSchema;
9062
9077
  while (newField instanceof ZodOptional) {
@@ -9064,7 +9079,7 @@ var ZodObject = class extends ZodType {
9064
9079
  }
9065
9080
  newShape[key] = newField;
9066
9081
  }
9067
- }
9082
+ });
9068
9083
  return new ZodObject({
9069
9084
  ...this._def,
9070
9085
  shape: () => newShape
@@ -9404,7 +9419,7 @@ var ZodTuple = class extends ZodType {
9404
9419
  });
9405
9420
  status.dirty();
9406
9421
  }
9407
- const items = ctx.data.map((item, itemIndex) => {
9422
+ const items = [...ctx.data].map((item, itemIndex) => {
9408
9423
  const schema3 = this._def.items[itemIndex] || this._def.rest;
9409
9424
  if (!schema3)
9410
9425
  return null;
@@ -9771,6 +9786,7 @@ var ZodLiteral = class extends ZodType {
9771
9786
  if (input.data !== this._def.value) {
9772
9787
  const ctx = this._getOrReturnCtx(input);
9773
9788
  addIssueToContext(ctx, {
9789
+ received: ctx.data,
9774
9790
  code: ZodIssueCode.invalid_literal,
9775
9791
  expected: this._def.value
9776
9792
  });
@@ -9844,6 +9860,12 @@ var ZodEnum = class extends ZodType {
9844
9860
  }
9845
9861
  return enumValues;
9846
9862
  }
9863
+ extract(values) {
9864
+ return ZodEnum.create(values);
9865
+ }
9866
+ exclude(values) {
9867
+ return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
9868
+ }
9847
9869
  };
9848
9870
  ZodEnum.create = createZodEnum;
9849
9871
  var ZodNativeEnum = class extends ZodType {
@@ -9882,6 +9904,9 @@ ZodNativeEnum.create = (values, params) => {
9882
9904
  });
9883
9905
  };
9884
9906
  var ZodPromise = class extends ZodType {
9907
+ unwrap() {
9908
+ return this._def.type;
9909
+ }
9885
9910
  _parse(input) {
9886
9911
  const { ctx } = this._processInputParams(input);
9887
9912
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
@@ -10095,23 +10120,29 @@ var ZodCatch = class extends ZodType {
10095
10120
  const result = this._def.innerType._parse({
10096
10121
  data: ctx.data,
10097
10122
  path: ctx.path,
10098
- parent: ctx
10123
+ parent: {
10124
+ ...ctx,
10125
+ common: {
10126
+ ...ctx.common,
10127
+ issues: []
10128
+ }
10129
+ }
10099
10130
  });
10100
10131
  if (isAsync(result)) {
10101
10132
  return result.then((result2) => {
10102
10133
  return {
10103
10134
  status: "valid",
10104
- value: result2.status === "valid" ? result2.value : this._def.defaultValue()
10135
+ value: result2.status === "valid" ? result2.value : this._def.catchValue()
10105
10136
  };
10106
10137
  });
10107
10138
  } else {
10108
10139
  return {
10109
10140
  status: "valid",
10110
- value: result.status === "valid" ? result.value : this._def.defaultValue()
10141
+ value: result.status === "valid" ? result.value : this._def.catchValue()
10111
10142
  };
10112
10143
  }
10113
10144
  }
10114
- removeDefault() {
10145
+ removeCatch() {
10115
10146
  return this._def.innerType;
10116
10147
  }
10117
10148
  };
@@ -10119,7 +10150,7 @@ ZodCatch.create = (type, params) => {
10119
10150
  return new ZodCatch({
10120
10151
  innerType: type,
10121
10152
  typeName: ZodFirstPartyTypeKind.ZodCatch,
10122
- defaultValue: typeof params.default === "function" ? params.default : () => params.default,
10153
+ catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
10123
10154
  ...processCreateParams(params)
10124
10155
  });
10125
10156
  };
@@ -10323,12 +10354,17 @@ var tableV3 = objectType({
10323
10354
  indexes: recordType(stringType(), index),
10324
10355
  foreignKeys: recordType(stringType(), fk)
10325
10356
  }).strict();
10357
+ var compositePK = objectType({
10358
+ name: stringType(),
10359
+ columns: stringType().array()
10360
+ }).strict();
10326
10361
  var table = objectType({
10327
10362
  name: stringType(),
10328
10363
  schema: stringType().optional(),
10329
10364
  columns: recordType(stringType(), column),
10330
10365
  indexes: recordType(stringType(), index),
10331
- foreignKeys: recordType(stringType(), fk)
10366
+ foreignKeys: recordType(stringType(), fk),
10367
+ compositePrimaryKeys: recordType(stringType(), compositePK)
10332
10368
  }).strict();
10333
10369
  var dialect = literalType("mysql");
10334
10370
  var schemaHash = objectType({
@@ -10365,7 +10401,8 @@ var tableSquashed = objectType({
10365
10401
  schema: stringType().optional(),
10366
10402
  columns: recordType(stringType(), column),
10367
10403
  indexes: recordType(stringType(), stringType()),
10368
- foreignKeys: recordType(stringType(), stringType())
10404
+ foreignKeys: recordType(stringType(), stringType()),
10405
+ compositePrimaryKeys: recordType(stringType(), stringType())
10369
10406
  }).strict();
10370
10407
  var schemaSquashed = objectType({
10371
10408
  version: literalType("5"),
@@ -10391,6 +10428,13 @@ var MySqlSquasher = {
10391
10428
  };
10392
10429
  return index.parse(destructed);
10393
10430
  },
10431
+ squashPK: (pk) => {
10432
+ return `${pk.name};${pk.columns.join(",")}`;
10433
+ },
10434
+ unsquashPK: (pk) => {
10435
+ const splitted = pk.split(";");
10436
+ return { name: splitted[0], columns: splitted[1].split(",") };
10437
+ },
10394
10438
  squashFK: (fk4) => {
10395
10439
  var _a, _b;
10396
10440
  return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${(_a = fk4.onUpdate) != null ? _a : ""};${(_b = fk4.onDelete) != null ? _b : ""}`;
@@ -10518,12 +10562,17 @@ var tableV32 = objectType({
10518
10562
  indexes: recordType(stringType(), index2),
10519
10563
  foreignKeys: recordType(stringType(), fk2)
10520
10564
  }).strict();
10565
+ var compositePK2 = objectType({
10566
+ name: stringType(),
10567
+ columns: stringType().array()
10568
+ }).strict();
10521
10569
  var table2 = objectType({
10522
10570
  name: stringType(),
10523
10571
  schema: stringType(),
10524
10572
  columns: recordType(stringType(), column2),
10525
10573
  indexes: recordType(stringType(), index2),
10526
- foreignKeys: recordType(stringType(), fk2)
10574
+ foreignKeys: recordType(stringType(), fk2),
10575
+ compositePrimaryKeys: recordType(stringType(), compositePK2)
10527
10576
  }).strict();
10528
10577
  var schemaHash2 = objectType({
10529
10578
  id: stringType(),
@@ -10559,7 +10608,8 @@ var tableSquashed2 = objectType({
10559
10608
  schema: stringType(),
10560
10609
  columns: recordType(stringType(), column2),
10561
10610
  indexes: recordType(stringType(), stringType()),
10562
- foreignKeys: recordType(stringType(), stringType())
10611
+ foreignKeys: recordType(stringType(), stringType()),
10612
+ compositePrimaryKeys: recordType(stringType(), stringType())
10563
10613
  }).strict();
10564
10614
  var pgSchemaSquashed = objectType({
10565
10615
  version: literalType("5"),
@@ -10596,6 +10646,12 @@ var PgSquasher = {
10596
10646
  var _a, _b;
10597
10647
  return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${(_a = fk4.onUpdate) != null ? _a : ""};${(_b = fk4.onDelete) != null ? _b : ""}`;
10598
10648
  },
10649
+ squashPK: (pk) => {
10650
+ return `${pk.columns.join(",")}`;
10651
+ },
10652
+ unsquashPK: (pk) => {
10653
+ return { name: "", columns: pk.split(",") };
10654
+ },
10599
10655
  unsquashFK: (input) => {
10600
10656
  const [
10601
10657
  name,
@@ -10627,6 +10683,9 @@ var squashPgScheme = (json) => {
10627
10683
  const squashedFKs = mapValues(it[1].foreignKeys, (fk4) => {
10628
10684
  return PgSquasher.squashFK(fk4);
10629
10685
  });
10686
+ const squashedPKs = mapValues(it[1].compositePrimaryKeys, (pk) => {
10687
+ return PgSquasher.squashPK(pk);
10688
+ });
10630
10689
  return [
10631
10690
  it[0],
10632
10691
  {
@@ -10634,7 +10693,8 @@ var squashPgScheme = (json) => {
10634
10693
  schema: it[1].schema,
10635
10694
  columns: it[1].columns,
10636
10695
  indexes: squashedIndexes,
10637
- foreignKeys: squashedFKs
10696
+ foreignKeys: squashedFKs,
10697
+ compositePrimaryKeys: squashedPKs
10638
10698
  }
10639
10699
  ];
10640
10700
  })
@@ -10678,7 +10738,7 @@ var fk3 = objectType({
10678
10738
  onUpdate: stringType().optional(),
10679
10739
  onDelete: stringType().optional()
10680
10740
  }).strict();
10681
- var compositePK = objectType({
10741
+ var compositePK3 = objectType({
10682
10742
  columns: stringType().array()
10683
10743
  }).strict();
10684
10744
  var column3 = objectType({
@@ -10700,7 +10760,7 @@ var table3 = objectType({
10700
10760
  columns: recordType(stringType(), column3),
10701
10761
  indexes: recordType(stringType(), index3),
10702
10762
  foreignKeys: recordType(stringType(), fk3),
10703
- compositePrimaryKeys: recordType(stringType(), compositePK)
10763
+ compositePrimaryKeys: recordType(stringType(), compositePK3)
10704
10764
  }).strict();
10705
10765
  var dialect2 = enumType(["sqlite"]);
10706
10766
  var schemaHash3 = objectType({
@@ -11052,13 +11112,26 @@ var pgNativeTypes = /* @__PURE__ */ new Set([
11052
11112
  "interval",
11053
11113
  "bigint",
11054
11114
  "bigserial",
11055
- "double precision"
11115
+ "double precision",
11116
+ "interval year",
11117
+ "interval month",
11118
+ "interval day",
11119
+ "interval hour",
11120
+ "interval minute",
11121
+ "interval second",
11122
+ "interval year to month",
11123
+ "interval day to hour",
11124
+ "interval day to minute",
11125
+ "interval day to second",
11126
+ "interval hour to minute",
11127
+ "interval hour to second",
11128
+ "interval minute to second"
11056
11129
  ]);
11057
11130
  var isPgNativeType = (it) => {
11058
11131
  if (pgNativeTypes.has(it))
11059
11132
  return true;
11060
11133
  const toCheck = it.replace(/ /g, "");
11061
- return toCheck.startsWith("varchar(") || toCheck.startsWith("numeric(") || toCheck.startsWith("timestamp(");
11134
+ return toCheck.startsWith("varchar(") || toCheck.startsWith("char(") || toCheck.startsWith("numeric(") || toCheck.startsWith("timestamp(");
11062
11135
  };
11063
11136
  var Convertor = class {
11064
11137
  };
@@ -11067,7 +11140,7 @@ var PgCreateTableConvertor = class extends Convertor {
11067
11140
  return statement.type === "create_table" && dialect3 === "pg";
11068
11141
  }
11069
11142
  convert(st) {
11070
- const { tableName, schema: schema3, columns } = st;
11143
+ const { tableName, schema: schema3, columns, compositePKs } = st;
11071
11144
  let statement = "";
11072
11145
  const name = schema3 ? `"${schema3}"."${tableName}"` : `"${tableName}"`;
11073
11146
  statement += `CREATE TABLE IF NOT EXISTS ${name} (
@@ -11077,13 +11150,19 @@ var PgCreateTableConvertor = class extends Convertor {
11077
11150
  const primaryKeyStatement = column4.primaryKey ? "PRIMARY KEY" : "";
11078
11151
  const notNullStatement = column4.notNull ? "NOT NULL" : "";
11079
11152
  const defaultStatement = column4.default !== void 0 ? `DEFAULT ${column4.default}` : "";
11080
- const type = isPgNativeType(column4.type) ? column4.type : `"${column4.type}"`;
11153
+ const type = isPgNativeType(column4.type) ? column4.type : `${column4.type}`;
11081
11154
  statement += " " + `"${column4.name}" ${type} ${primaryKeyStatement} ${defaultStatement} ${notNullStatement}`.replace(/ +/g, " ").trim();
11082
11155
  statement += (i === columns.length - 1 ? "" : ",") + "\n";
11083
11156
  }
11084
11157
  statement += `);`;
11085
11158
  statement += `
11086
11159
  `;
11160
+ if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
11161
+ const compositePK4 = PgSquasher.unsquashPK(compositePKs[0]);
11162
+ statement += `ALTER TABLE ${name} ADD CONSTRAINT "${st.compositePkName}" PRIMARY KEY("${compositePK4.columns.join('","')}");`;
11163
+ statement += `
11164
+ `;
11165
+ }
11087
11166
  return statement;
11088
11167
  }
11089
11168
  };
@@ -11092,7 +11171,7 @@ var MySqlCreateTableConvertor = class extends Convertor {
11092
11171
  return statement.type === "create_table" && dialect3 === "mysql";
11093
11172
  }
11094
11173
  convert(st) {
11095
- const { tableName, columns, schema: schema3 } = st;
11174
+ const { tableName, columns, schema: schema3, compositePKs } = st;
11096
11175
  let statement = "";
11097
11176
  const tName = schema3 ? `\`${schema3}\`.\`${tableName}\`` : `\`${tableName}\``;
11098
11177
  statement += `CREATE TABLE ${tName} (
@@ -11110,6 +11189,12 @@ var MySqlCreateTableConvertor = class extends Convertor {
11110
11189
  statement += `);`;
11111
11190
  statement += `
11112
11191
  `;
11192
+ if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
11193
+ const compositePK4 = MySqlSquasher.unsquashPK(compositePKs[0]);
11194
+ statement += `ALTER TABLE ${tName} ADD PRIMARY KEY(\`${compositePK4.columns.join("`,`")}\`);`;
11195
+ statement += `
11196
+ `;
11197
+ }
11113
11198
  return statement;
11114
11199
  }
11115
11200
  };
@@ -11479,6 +11564,67 @@ var SqliteAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
11479
11564
  */`;
11480
11565
  }
11481
11566
  };
11567
+ var PgAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
11568
+ can(statement, dialect3) {
11569
+ return statement.type === "create_composite_pk" && dialect3 === "pg";
11570
+ }
11571
+ convert(statement) {
11572
+ const { name, columns } = PgSquasher.unsquashPK(statement.data);
11573
+ return `ALTER TABLE "${statement.tableName}" ADD CONSTRAINT "${statement.constraintName}" PRIMARY KEY("${columns.join('","')}");`;
11574
+ }
11575
+ };
11576
+ var PgAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
11577
+ can(statement, dialect3) {
11578
+ return statement.type === "delete_composite_pk" && dialect3 === "pg";
11579
+ }
11580
+ convert(statement) {
11581
+ const { name, columns } = PgSquasher.unsquashPK(statement.data);
11582
+ return `ALTER TABLE "${statement.tableName}" DROP CONSTRAINT "${statement.constraintName}";`;
11583
+ }
11584
+ };
11585
+ var PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
11586
+ can(statement, dialect3) {
11587
+ return statement.type === "alter_composite_pk" && dialect3 === "pg";
11588
+ }
11589
+ convert(statement) {
11590
+ const { name, columns } = PgSquasher.unsquashPK(statement.old);
11591
+ const { name: newName, columns: newColumns } = PgSquasher.unsquashPK(
11592
+ statement.new
11593
+ );
11594
+ return `ALTER TABLE "${statement.tableName}" DROP CONSTRAINT ${statement.oldConstraintName};
11595
+ ALTER TABLE "${statement.tableName}" ADD CONSTRAINT ${statement.newConstraintName} PRIMARY KEY(${newColumns.join(",")});`;
11596
+ }
11597
+ };
11598
+ var MySqlAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
11599
+ can(statement, dialect3) {
11600
+ return statement.type === "create_composite_pk" && dialect3 === "mysql";
11601
+ }
11602
+ convert(statement) {
11603
+ const { name, columns } = MySqlSquasher.unsquashPK(statement.data);
11604
+ return `ALTER TABLE \`${statement.tableName}\` ADD PRIMARY KEY(\`${columns.join("`,`")}\`);`;
11605
+ }
11606
+ };
11607
+ var MySqlAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
11608
+ can(statement, dialect3) {
11609
+ return statement.type === "delete_composite_pk" && dialect3 === "mysql";
11610
+ }
11611
+ convert(statement) {
11612
+ const { name, columns } = MySqlSquasher.unsquashPK(statement.data);
11613
+ return `ALTER TABLE \`${statement.tableName}\` DROP PRIMARY KEY;`;
11614
+ }
11615
+ };
11616
+ var MySqlAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
11617
+ can(statement, dialect3) {
11618
+ return statement.type === "alter_composite_pk" && dialect3 === "mysql";
11619
+ }
11620
+ convert(statement) {
11621
+ const { name, columns } = MySqlSquasher.unsquashPK(statement.old);
11622
+ const { name: newName, columns: newColumns } = MySqlSquasher.unsquashPK(
11623
+ statement.new
11624
+ );
11625
+ return `ALTER TABLE \`${statement.tableName}\` DROP PRIMARY KEY, ADD PRIMARY KEY(\`${newColumns.join("`,`")}\`);`;
11626
+ }
11627
+ };
11482
11628
  var SqliteAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
11483
11629
  can(statement, dialect3) {
11484
11630
  return statement.type === "create_composite_pk" && dialect3 === "sqlite";
@@ -11985,6 +12131,12 @@ convertors.push(new SqliteAlterTableAlterColumnDropDefaultConvertor());
11985
12131
  convertors.push(new SqliteAlterTableCreateCompositePrimaryKeyConvertor());
11986
12132
  convertors.push(new SqliteAlterTableDeleteCompositePrimaryKeyConvertor());
11987
12133
  convertors.push(new SqliteAlterTableAlterCompositePrimaryKeyConvertor());
12134
+ convertors.push(new PgAlterTableCreateCompositePrimaryKeyConvertor());
12135
+ convertors.push(new PgAlterTableDeleteCompositePrimaryKeyConvertor());
12136
+ convertors.push(new PgAlterTableAlterCompositePrimaryKeyConvertor());
12137
+ convertors.push(new MySqlAlterTableCreateCompositePrimaryKeyConvertor());
12138
+ convertors.push(new MySqlAlterTableDeleteCompositePrimaryKeyConvertor());
12139
+ convertors.push(new MySqlAlterTableAlterCompositePrimaryKeyConvertor());
11988
12140
  var fromJson = (statements, dialect3) => {
11989
12141
  const result = statements.map((statement) => {
11990
12142
  const filtered = convertors.filter((it) => {
@@ -12025,13 +12177,30 @@ drop type __venum;
12025
12177
  `;
12026
12178
 
12027
12179
  // src/jsonStatements.ts
12028
- var prepareCreateTableJson = (table4) => {
12029
- const { name, schema: schema3, columns } = table4;
12180
+ var preparePgCreateTableJson = (table4, json2) => {
12181
+ const { name, schema: schema3, columns, compositePrimaryKeys } = table4;
12030
12182
  return {
12031
12183
  type: "create_table",
12032
12184
  tableName: name,
12033
12185
  schema: schema3,
12034
- columns: Object.values(columns)
12186
+ columns: Object.values(columns),
12187
+ compositePKs: Object.values(compositePrimaryKeys),
12188
+ compositePkName: Object.values(compositePrimaryKeys).length > 0 ? json2.tables[name].compositePrimaryKeys[`${name}_${PgSquasher.unsquashPK(
12189
+ Object.values(compositePrimaryKeys)[0]
12190
+ ).columns.join("_")}`].name : ""
12191
+ };
12192
+ };
12193
+ var prepareMySqlCreateTableJson = (table4, json2) => {
12194
+ const { name, schema: schema3, columns, compositePrimaryKeys } = table4;
12195
+ return {
12196
+ type: "create_table",
12197
+ tableName: name,
12198
+ schema: schema3,
12199
+ columns: Object.values(columns),
12200
+ compositePKs: Object.values(compositePrimaryKeys),
12201
+ compositePkName: Object.values(compositePrimaryKeys).length > 0 ? json2.tables[name].compositePrimaryKeys[`${name}_${MySqlSquasher.unsquashPK(
12202
+ Object.values(compositePrimaryKeys)[0]
12203
+ ).columns.join("_")}`].name : ""
12035
12204
  };
12036
12205
  };
12037
12206
  var prepareSQLiteCreateTable = (table4) => {
@@ -12415,6 +12584,70 @@ var prepareAlterCompositePrimaryKeySqlite = (tableName, pks) => {
12415
12584
  };
12416
12585
  });
12417
12586
  };
12587
+ var prepareAddCompositePrimaryKeyPg = (tableName, pks, json2) => {
12588
+ return Object.values(pks).map((it) => {
12589
+ return {
12590
+ type: "create_composite_pk",
12591
+ tableName,
12592
+ data: it,
12593
+ constraintName: json2.tables[tableName].compositePrimaryKeys[`${tableName}_${PgSquasher.unsquashPK(it).columns.join("_")}`].name
12594
+ };
12595
+ });
12596
+ };
12597
+ var prepareDeleteCompositePrimaryKeyPg = (tableName, pks, json1) => {
12598
+ return Object.values(pks).map((it) => {
12599
+ return {
12600
+ type: "delete_composite_pk",
12601
+ tableName,
12602
+ data: it,
12603
+ constraintName: json1.tables[tableName].compositePrimaryKeys[`${tableName}_${PgSquasher.unsquashPK(it).columns.join("_")}`].name
12604
+ };
12605
+ });
12606
+ };
12607
+ var prepareAlterCompositePrimaryKeyPg = (tableName, pks, json1, json2) => {
12608
+ return Object.values(pks).map((it) => {
12609
+ return {
12610
+ type: "alter_composite_pk",
12611
+ tableName,
12612
+ old: it.__old,
12613
+ new: it.__new,
12614
+ oldConstraintName: json1.tables[tableName].compositePrimaryKeys[`${tableName}_${PgSquasher.unsquashPK(it.__old).columns.join("_")}`].name,
12615
+ newConstraintName: json2.tables[tableName].compositePrimaryKeys[`${tableName}_${PgSquasher.unsquashPK(it.__new).columns.join("_")}`].name
12616
+ };
12617
+ });
12618
+ };
12619
+ var prepareAddCompositePrimaryKeyMySql = (tableName, pks, json2) => {
12620
+ return Object.values(pks).map((it) => {
12621
+ return {
12622
+ type: "create_composite_pk",
12623
+ tableName,
12624
+ data: it,
12625
+ constraintName: json2.tables[tableName].compositePrimaryKeys[`${tableName}_${MySqlSquasher.unsquashPK(it).columns.join("_")}`].name
12626
+ };
12627
+ });
12628
+ };
12629
+ var prepareDeleteCompositePrimaryKeyMySql = (tableName, pks, json1) => {
12630
+ return Object.values(pks).map((it) => {
12631
+ return {
12632
+ type: "delete_composite_pk",
12633
+ tableName,
12634
+ data: it,
12635
+ constraintName: json1.tables[tableName].compositePrimaryKeys[`${tableName}_${MySqlSquasher.unsquashPK(it).columns.join("_")}`].name
12636
+ };
12637
+ });
12638
+ };
12639
+ var prepareAlterCompositePrimaryKeyMySql = (tableName, pks, json1, json2) => {
12640
+ return Object.values(pks).map((it) => {
12641
+ return {
12642
+ type: "alter_composite_pk",
12643
+ tableName,
12644
+ old: it.__old,
12645
+ new: it.__new,
12646
+ oldConstraintName: json1.tables[tableName].compositePrimaryKeys[`${tableName}_${MySqlSquasher.unsquashPK(it.__old).columns.join("_")}`].name,
12647
+ newConstraintName: json2.tables[tableName].compositePrimaryKeys[`${tableName}_${MySqlSquasher.unsquashPK(it.__new).columns.join("_")}`].name
12648
+ };
12649
+ });
12650
+ };
12418
12651
 
12419
12652
  // src/snapshotsDiffer.ts
12420
12653
  var makeChanged = (schema3) => {
@@ -12556,7 +12789,7 @@ var diffResultScheme = objectType({
12556
12789
  addedSchemas: stringType().array(),
12557
12790
  deletedSchemas: stringType().array()
12558
12791
  }).strict();
12559
- var applySnapshotsDiff = async (json1, json2, dialect3, schemasResolver, tablesResolver, columnsResolver) => {
12792
+ var applySnapshotsDiff = async (json1, json2, dialect3, schemasResolver, tablesResolver, columnsResolver, prevFull, curFull) => {
12560
12793
  var _a, _b, _c, _d;
12561
12794
  const diffResult = applyJsonDiff(json1, json2);
12562
12795
  if (Object.keys(diffResult).length === 0) {
@@ -12586,9 +12819,6 @@ var applySnapshotsDiff = async (json1, json2, dialect3, schemasResolver, tablesR
12586
12819
  const jsonSQLiteCreateTables = created.map((it) => {
12587
12820
  return prepareSQLiteCreateTable(it);
12588
12821
  });
12589
- const jsonCreateTables = created.map((it) => {
12590
- return prepareCreateTableJson(it);
12591
- });
12592
12822
  const jsonCreateIndexesForCreatedTables = created.map((it) => {
12593
12823
  return prepareCreateIndexesJson(it.name, it.schema, it.indexes);
12594
12824
  }).flat();
@@ -12646,18 +12876,57 @@ var applySnapshotsDiff = async (json1, json2, dialect3, schemasResolver, tablesR
12646
12876
  const jsonRemoveTableFromSchemas = [];
12647
12877
  const jsonSetNewTableSchemas = [];
12648
12878
  allAlteredResolved.forEach((it) => {
12649
- const addedCompositePKs = prepareAddCompositePrimaryKeySqlite(
12650
- it.name,
12651
- it.addedCompositePKs
12652
- );
12653
- const deletedCompositePKs = prepareDeleteCompositePrimaryKeySqlite(
12654
- it.name,
12655
- it.deletedCompositePKs
12656
- );
12657
- const alteredCompositePKs = prepareAlterCompositePrimaryKeySqlite(
12658
- it.name,
12659
- it.alteredCompositePKs
12660
- );
12879
+ let addedCompositePKs;
12880
+ let deletedCompositePKs;
12881
+ let alteredCompositePKs;
12882
+ if (dialect3 === "sqlite") {
12883
+ addedCompositePKs = prepareAddCompositePrimaryKeySqlite(
12884
+ it.name,
12885
+ it.addedCompositePKs
12886
+ );
12887
+ deletedCompositePKs = prepareDeleteCompositePrimaryKeySqlite(
12888
+ it.name,
12889
+ it.deletedCompositePKs
12890
+ );
12891
+ alteredCompositePKs = prepareAlterCompositePrimaryKeySqlite(
12892
+ it.name,
12893
+ it.alteredCompositePKs
12894
+ );
12895
+ } else if (dialect3 === "pg") {
12896
+ addedCompositePKs = prepareAddCompositePrimaryKeyPg(
12897
+ it.name,
12898
+ it.addedCompositePKs,
12899
+ curFull
12900
+ );
12901
+ deletedCompositePKs = prepareDeleteCompositePrimaryKeyPg(
12902
+ it.name,
12903
+ it.deletedCompositePKs,
12904
+ prevFull
12905
+ );
12906
+ alteredCompositePKs = prepareAlterCompositePrimaryKeyPg(
12907
+ it.name,
12908
+ it.alteredCompositePKs,
12909
+ prevFull,
12910
+ curFull
12911
+ );
12912
+ } else {
12913
+ addedCompositePKs = prepareAddCompositePrimaryKeyMySql(
12914
+ it.name,
12915
+ it.addedCompositePKs,
12916
+ curFull
12917
+ );
12918
+ deletedCompositePKs = prepareDeleteCompositePrimaryKeyMySql(
12919
+ it.name,
12920
+ it.deletedCompositePKs,
12921
+ prevFull
12922
+ );
12923
+ alteredCompositePKs = prepareAlterCompositePrimaryKeyMySql(
12924
+ it.name,
12925
+ it.alteredCompositePKs,
12926
+ prevFull,
12927
+ curFull
12928
+ );
12929
+ }
12661
12930
  if (it.schema && typeof it.schema !== "string") {
12662
12931
  switch (it.schema.type) {
12663
12932
  case "added": {
@@ -12780,8 +13049,16 @@ var applySnapshotsDiff = async (json1, json2, dialect3, schemasResolver, tablesR
12780
13049
  jsonStatements.push(...jsonAlterEnumsWithAddedValues);
12781
13050
  if (dialect3 === "sqlite") {
12782
13051
  jsonStatements.push(...jsonSQLiteCreateTables);
13052
+ } else if (dialect3 === "pg") {
13053
+ const jsonPgCreateTables = created.map((it) => {
13054
+ return preparePgCreateTableJson(it, curFull);
13055
+ });
13056
+ jsonStatements.push(...jsonPgCreateTables);
12783
13057
  } else {
12784
- jsonStatements.push(...jsonCreateTables);
13058
+ const jsonMySqlCreateTables = created.map((it) => {
13059
+ return prepareMySqlCreateTableJson(it, curFull);
13060
+ });
13061
+ jsonStatements.push(...jsonMySqlCreateTables);
12785
13062
  }
12786
13063
  jsonStatements.push(...jsonDropTables);
12787
13064
  jsonStatements.push(...jsonRenameTables);
@@ -12810,7 +13087,11 @@ var applySnapshotsDiff = async (json1, json2, dialect3, schemasResolver, tablesR
12810
13087
  }
12811
13088
  });
12812
13089
  const _meta = prepareMigrationMeta(rSchemas, rTables, rColumns);
12813
- return { statements: jsonStatements, sqlStatements: uniqueSqlStatements, _meta };
13090
+ return {
13091
+ statements: jsonStatements,
13092
+ sqlStatements: uniqueSqlStatements,
13093
+ _meta
13094
+ };
12814
13095
  };
12815
13096
 
12816
13097
  // src/cli/commands/upFolders.ts
@@ -12945,7 +13226,7 @@ var snapshotsPriorV4 = (out) => {
12945
13226
  return pathJson;
12946
13227
  });
12947
13228
  };
12948
- var prepareOutFolder = (out, dialect3) => {
13229
+ var prepareOutFolder2 = (out, dialect3) => {
12949
13230
  const meta = (0, import_path.join)(out, "meta");
12950
13231
  const journalPath = (0, import_path.join)(meta, "_journal.json");
12951
13232
  if (!(0, import_fs.existsSync)((0, import_path.join)(out, "meta"))) {
@@ -12969,7 +13250,7 @@ var validatorForDialect = (dialect3) => {
12969
13250
  case "pg":
12970
13251
  return { validator: backwardCompatiblePgSchema, version: 5 };
12971
13252
  case "sqlite":
12972
- return { validator: backwardCompatibleSqliteSchema, version: 4 };
13253
+ return { validator: backwardCompatibleSqliteSchema, version: 5 };
12973
13254
  case "mysql":
12974
13255
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
12975
13256
  }
@@ -13018,7 +13299,7 @@ var validateWithReport = (snapshots, dialect3) => {
13018
13299
  return result;
13019
13300
  };
13020
13301
  var prepareMigrationFolder = (outFolder = "drizzle", dialect3) => {
13021
- const { snapshots, journal } = prepareOutFolder(outFolder, dialect3);
13302
+ const { snapshots, journal } = prepareOutFolder2(outFolder, dialect3);
13022
13303
  const report = validateWithReport(snapshots, dialect3);
13023
13304
  if (report.nonLatest.length > 0) {
13024
13305
  console.log(