drizzle-kit 0.17.1-f8bb071 → 0.17.2-5f6da95

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 (5) hide show
  1. package/index.js +20841 -22081
  2. package/package.json +5 -9
  3. package/readme.md +20 -13
  4. package/utils.js +159 -269
  5. package/index.d.ts +0 -14
package/utils.js CHANGED
@@ -7169,7 +7169,7 @@ var info = (msg, greyMsg = "") => {
7169
7169
  var originUUID = "00000000-0000-0000-0000-000000000000";
7170
7170
  var snapshotVersion = "5";
7171
7171
 
7172
- // node_modules/.pnpm/zod@3.20.6/node_modules/zod/lib/index.mjs
7172
+ // node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
7173
7173
  var util;
7174
7174
  (function(util2) {
7175
7175
  util2.assertEqual = (val) => val;
@@ -7584,7 +7584,7 @@ var OK = (value) => ({ status: "valid", value });
7584
7584
  var isAborted = (x) => x.status === "aborted";
7585
7585
  var isDirty = (x) => x.status === "dirty";
7586
7586
  var isValid = (x) => x.status === "valid";
7587
- var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
7587
+ var isAsync = (x) => typeof Promise !== void 0 && x instanceof Promise;
7588
7588
  var errorUtil;
7589
7589
  (function(errorUtil2) {
7590
7590
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
@@ -7800,29 +7800,28 @@ var ZodType = class {
7800
7800
  return this._refinement(refinement);
7801
7801
  }
7802
7802
  optional() {
7803
- return ZodOptional.create(this, this._def);
7803
+ return ZodOptional.create(this);
7804
7804
  }
7805
7805
  nullable() {
7806
- return ZodNullable.create(this, this._def);
7806
+ return ZodNullable.create(this);
7807
7807
  }
7808
7808
  nullish() {
7809
- return this.nullable().optional();
7809
+ return this.optional().nullable();
7810
7810
  }
7811
7811
  array() {
7812
- return ZodArray.create(this, this._def);
7812
+ return ZodArray.create(this);
7813
7813
  }
7814
7814
  promise() {
7815
- return ZodPromise.create(this, this._def);
7815
+ return ZodPromise.create(this);
7816
7816
  }
7817
7817
  or(option) {
7818
- return ZodUnion.create([this, option], this._def);
7818
+ return ZodUnion.create([this, option]);
7819
7819
  }
7820
7820
  and(incoming) {
7821
- return ZodIntersection.create(this, incoming, this._def);
7821
+ return ZodIntersection.create(this, incoming);
7822
7822
  }
7823
7823
  transform(transform) {
7824
7824
  return new ZodEffects({
7825
- ...processCreateParams(this._def),
7826
7825
  schema: this,
7827
7826
  typeName: ZodFirstPartyTypeKind.ZodEffects,
7828
7827
  effect: { type: "transform", transform }
@@ -7831,7 +7830,6 @@ var ZodType = class {
7831
7830
  default(def) {
7832
7831
  const defaultValueFunc = typeof def === "function" ? def : () => def;
7833
7832
  return new ZodDefault({
7834
- ...processCreateParams(this._def),
7835
7833
  innerType: this,
7836
7834
  defaultValue: defaultValueFunc,
7837
7835
  typeName: ZodFirstPartyTypeKind.ZodDefault
@@ -7841,15 +7839,14 @@ var ZodType = class {
7841
7839
  return new ZodBranded({
7842
7840
  typeName: ZodFirstPartyTypeKind.ZodBranded,
7843
7841
  type: this,
7844
- ...processCreateParams(this._def)
7842
+ ...processCreateParams(void 0)
7845
7843
  });
7846
7844
  }
7847
7845
  catch(def) {
7848
- const catchValueFunc = typeof def === "function" ? def : () => def;
7846
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
7849
7847
  return new ZodCatch({
7850
- ...processCreateParams(this._def),
7851
7848
  innerType: this,
7852
- catchValue: catchValueFunc,
7849
+ defaultValue: defaultValueFunc,
7853
7850
  typeName: ZodFirstPartyTypeKind.ZodCatch
7854
7851
  });
7855
7852
  }
@@ -7871,25 +7868,24 @@ var ZodType = class {
7871
7868
  }
7872
7869
  };
7873
7870
  var cuidRegex = /^c[^\s-]{8,}$/i;
7874
- var cuid2Regex = /^[a-z][a-z0-9]*$/;
7875
7871
  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;
7876
- 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,}))$/;
7872
+ var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
7877
7873
  var datetimeRegex = (args) => {
7878
7874
  if (args.precision) {
7879
7875
  if (args.offset) {
7880
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
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
7877
  } else {
7882
7878
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
7883
7879
  }
7884
7880
  } else if (args.precision === 0) {
7885
7881
  if (args.offset) {
7886
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
7882
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
7887
7883
  } else {
7888
7884
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
7889
7885
  }
7890
7886
  } else {
7891
7887
  if (args.offset) {
7892
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
7888
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
7893
7889
  } else {
7894
7890
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
7895
7891
  }
@@ -8011,16 +8007,6 @@ var ZodString = class extends ZodType {
8011
8007
  });
8012
8008
  status.dirty();
8013
8009
  }
8014
- } else if (check.kind === "cuid2") {
8015
- if (!cuid2Regex.test(input.data)) {
8016
- ctx = this._getOrReturnCtx(input, ctx);
8017
- addIssueToContext(ctx, {
8018
- validation: "cuid2",
8019
- code: ZodIssueCode.invalid_string,
8020
- message: check.message
8021
- });
8022
- status.dirty();
8023
- }
8024
8010
  } else if (check.kind === "url") {
8025
8011
  try {
8026
8012
  new URL(input.data);
@@ -8102,9 +8088,6 @@ var ZodString = class extends ZodType {
8102
8088
  cuid(message) {
8103
8089
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
8104
8090
  }
8105
- cuid2(message) {
8106
- return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
8107
- }
8108
8091
  datetime(options) {
8109
8092
  var _a;
8110
8093
  if (typeof options === "string") {
@@ -8179,9 +8162,6 @@ var ZodString = class extends ZodType {
8179
8162
  get isCUID() {
8180
8163
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
8181
8164
  }
8182
- get isCUID2() {
8183
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
8184
- }
8185
8165
  get minLength() {
8186
8166
  let min = null;
8187
8167
  for (const ch of this._def.checks) {
@@ -8412,22 +8392,7 @@ var ZodNumber = class extends ZodType {
8412
8392
  return max;
8413
8393
  }
8414
8394
  get isInt() {
8415
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
8416
- }
8417
- get isFinite() {
8418
- let max = null, min = null;
8419
- for (const ch of this._def.checks) {
8420
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
8421
- return true;
8422
- } else if (ch.kind === "min") {
8423
- if (min === null || ch.value > min)
8424
- min = ch.value;
8425
- } else if (ch.kind === "max") {
8426
- if (max === null || ch.value < max)
8427
- max = ch.value;
8428
- }
8429
- }
8430
- return Number.isFinite(min) && Number.isFinite(max);
8395
+ return !!this._def.checks.find((ch) => ch.kind === "int");
8431
8396
  }
8432
8397
  };
8433
8398
  ZodNumber.create = (params) => {
@@ -8784,13 +8749,13 @@ var ZodArray = class extends ZodType {
8784
8749
  }
8785
8750
  }
8786
8751
  if (ctx.common.async) {
8787
- return Promise.all([...ctx.data].map((item, i) => {
8752
+ return Promise.all(ctx.data.map((item, i) => {
8788
8753
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
8789
8754
  })).then((result2) => {
8790
8755
  return ParseStatus.mergeArray(status, result2);
8791
8756
  });
8792
8757
  }
8793
- const result = [...ctx.data].map((item, i) => {
8758
+ const result = ctx.data.map((item, i) => {
8794
8759
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
8795
8760
  });
8796
8761
  return ParseStatus.mergeArray(status, result);
@@ -8839,6 +8804,15 @@ var objectUtil;
8839
8804
  };
8840
8805
  };
8841
8806
  })(objectUtil || (objectUtil = {}));
8807
+ var AugmentFactory = (def) => (augmentation) => {
8808
+ return new ZodObject({
8809
+ ...def,
8810
+ shape: () => ({
8811
+ ...def.shape(),
8812
+ ...augmentation
8813
+ })
8814
+ });
8815
+ };
8842
8816
  function deepPartialify(schema3) {
8843
8817
  if (schema3 instanceof ZodObject) {
8844
8818
  const newShape = {};
@@ -8867,7 +8841,8 @@ var ZodObject = class extends ZodType {
8867
8841
  super(...arguments);
8868
8842
  this._cached = null;
8869
8843
  this.nonstrict = this.passthrough;
8870
- this.augment = this.extend;
8844
+ this.augment = AugmentFactory(this._def);
8845
+ this.extend = AugmentFactory(this._def);
8871
8846
  }
8872
8847
  _getCached() {
8873
8848
  if (this._cached !== null)
@@ -8996,14 +8971,8 @@ var ZodObject = class extends ZodType {
8996
8971
  unknownKeys: "passthrough"
8997
8972
  });
8998
8973
  }
8999
- extend(augmentation) {
9000
- return new ZodObject({
9001
- ...this._def,
9002
- shape: () => ({
9003
- ...this._def.shape(),
9004
- ...augmentation
9005
- })
9006
- });
8974
+ setKey(key, schema3) {
8975
+ return this.augment({ [key]: schema3 });
9007
8976
  }
9008
8977
  merge(merging) {
9009
8978
  const merged = new ZodObject({
@@ -9014,9 +8983,6 @@ var ZodObject = class extends ZodType {
9014
8983
  });
9015
8984
  return merged;
9016
8985
  }
9017
- setKey(key, schema3) {
9018
- return this.augment({ [key]: schema3 });
9019
- }
9020
8986
  catchall(index4) {
9021
8987
  return new ZodObject({
9022
8988
  ...this._def,
@@ -9025,10 +8991,9 @@ var ZodObject = class extends ZodType {
9025
8991
  }
9026
8992
  pick(mask) {
9027
8993
  const shape = {};
9028
- util.objectKeys(mask).forEach((key) => {
9029
- if (mask[key] && this.shape[key]) {
8994
+ util.objectKeys(mask).map((key) => {
8995
+ if (this.shape[key])
9030
8996
  shape[key] = this.shape[key];
9031
- }
9032
8997
  });
9033
8998
  return new ZodObject({
9034
8999
  ...this._def,
@@ -9037,8 +9002,8 @@ var ZodObject = class extends ZodType {
9037
9002
  }
9038
9003
  omit(mask) {
9039
9004
  const shape = {};
9040
- util.objectKeys(this.shape).forEach((key) => {
9041
- if (!mask[key]) {
9005
+ util.objectKeys(this.shape).map((key) => {
9006
+ if (util.objectKeys(mask).indexOf(key) === -1) {
9042
9007
  shape[key] = this.shape[key];
9043
9008
  }
9044
9009
  });
@@ -9052,14 +9017,24 @@ var ZodObject = class extends ZodType {
9052
9017
  }
9053
9018
  partial(mask) {
9054
9019
  const newShape = {};
9055
- util.objectKeys(this.shape).forEach((key) => {
9056
- const fieldSchema = this.shape[key];
9057
- if (mask && !mask[key]) {
9058
- newShape[key] = fieldSchema;
9059
- } else {
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];
9060
9035
  newShape[key] = fieldSchema.optional();
9061
9036
  }
9062
- });
9037
+ }
9063
9038
  return new ZodObject({
9064
9039
  ...this._def,
9065
9040
  shape: () => newShape
@@ -9067,10 +9042,21 @@ var ZodObject = class extends ZodType {
9067
9042
  }
9068
9043
  required(mask) {
9069
9044
  const newShape = {};
9070
- util.objectKeys(this.shape).forEach((key) => {
9071
- if (mask && !mask[key]) {
9072
- newShape[key] = this.shape[key];
9073
- } else {
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) {
9074
9060
  const fieldSchema = this.shape[key];
9075
9061
  let newField = fieldSchema;
9076
9062
  while (newField instanceof ZodOptional) {
@@ -9078,7 +9064,7 @@ var ZodObject = class extends ZodType {
9078
9064
  }
9079
9065
  newShape[key] = newField;
9080
9066
  }
9081
- });
9067
+ }
9082
9068
  return new ZodObject({
9083
9069
  ...this._def,
9084
9070
  shape: () => newShape
@@ -9418,7 +9404,7 @@ var ZodTuple = class extends ZodType {
9418
9404
  });
9419
9405
  status.dirty();
9420
9406
  }
9421
- const items = [...ctx.data].map((item, itemIndex) => {
9407
+ const items = ctx.data.map((item, itemIndex) => {
9422
9408
  const schema3 = this._def.items[itemIndex] || this._def.rest;
9423
9409
  if (!schema3)
9424
9410
  return null;
@@ -9785,7 +9771,6 @@ var ZodLiteral = class extends ZodType {
9785
9771
  if (input.data !== this._def.value) {
9786
9772
  const ctx = this._getOrReturnCtx(input);
9787
9773
  addIssueToContext(ctx, {
9788
- received: ctx.data,
9789
9774
  code: ZodIssueCode.invalid_literal,
9790
9775
  expected: this._def.value
9791
9776
  });
@@ -9859,12 +9844,6 @@ var ZodEnum = class extends ZodType {
9859
9844
  }
9860
9845
  return enumValues;
9861
9846
  }
9862
- extract(values) {
9863
- return ZodEnum.create(values);
9864
- }
9865
- exclude(values) {
9866
- return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
9867
- }
9868
9847
  };
9869
9848
  ZodEnum.create = createZodEnum;
9870
9849
  var ZodNativeEnum = class extends ZodType {
@@ -9903,9 +9882,6 @@ ZodNativeEnum.create = (values, params) => {
9903
9882
  });
9904
9883
  };
9905
9884
  var ZodPromise = class extends ZodType {
9906
- unwrap() {
9907
- return this._def.type;
9908
- }
9909
9885
  _parse(input) {
9910
9886
  const { ctx } = this._processInputParams(input);
9911
9887
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
@@ -10119,29 +10095,23 @@ var ZodCatch = class extends ZodType {
10119
10095
  const result = this._def.innerType._parse({
10120
10096
  data: ctx.data,
10121
10097
  path: ctx.path,
10122
- parent: {
10123
- ...ctx,
10124
- common: {
10125
- ...ctx.common,
10126
- issues: []
10127
- }
10128
- }
10098
+ parent: ctx
10129
10099
  });
10130
10100
  if (isAsync(result)) {
10131
10101
  return result.then((result2) => {
10132
10102
  return {
10133
10103
  status: "valid",
10134
- value: result2.status === "valid" ? result2.value : this._def.catchValue()
10104
+ value: result2.status === "valid" ? result2.value : this._def.defaultValue()
10135
10105
  };
10136
10106
  });
10137
10107
  } else {
10138
10108
  return {
10139
10109
  status: "valid",
10140
- value: result.status === "valid" ? result.value : this._def.catchValue()
10110
+ value: result.status === "valid" ? result.value : this._def.defaultValue()
10141
10111
  };
10142
10112
  }
10143
10113
  }
10144
- removeCatch() {
10114
+ removeDefault() {
10145
10115
  return this._def.innerType;
10146
10116
  }
10147
10117
  };
@@ -10149,7 +10119,7 @@ ZodCatch.create = (type, params) => {
10149
10119
  return new ZodCatch({
10150
10120
  innerType: type,
10151
10121
  typeName: ZodFirstPartyTypeKind.ZodCatch,
10152
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
10122
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
10153
10123
  ...processCreateParams(params)
10154
10124
  });
10155
10125
  };
@@ -11095,19 +11065,6 @@ var alternationsInColumn = (column4) => {
11095
11065
  return { ...others, notNull: { type: "deleted", value: it.notNull__deleted } };
11096
11066
  }
11097
11067
  return it;
11098
- }).map((it) => {
11099
- if ("primaryKey" in it) {
11100
- return { ...it, primaryKey: { type: "changed", old: it.primaryKey.__old, new: it.primaryKey.__new } };
11101
- }
11102
- if ("primaryKey__added" in it) {
11103
- const { notNull__added, ...others } = it;
11104
- return { ...others, primaryKey: { type: "added", value: it.primaryKey__added } };
11105
- }
11106
- if ("primaryKey__deleted" in it) {
11107
- const { notNull__deleted, ...others } = it;
11108
- return { ...others, primaryKey: { type: "deleted", value: it.primaryKey__deleted } };
11109
- }
11110
- return it;
11111
11068
  }).map((it) => {
11112
11069
  if ("onUpdate" in it) {
11113
11070
  return { ...it, onUpdate: { type: "changed", old: it.onUpdate.__old, new: it.onUpdate.__new } };
@@ -11231,24 +11188,23 @@ var MySqlCreateTableConvertor = class extends Convertor {
11231
11188
  `;
11232
11189
  for (let i = 0; i < columns.length; i++) {
11233
11190
  const column4 = columns[i];
11234
- const primaryKeyStatement = column4.primaryKey ? " PRIMARY KEY" : "";
11235
- const notNullStatement = column4.notNull ? " NOT NULL" : "";
11236
- const defaultStatement = column4.default !== void 0 ? ` DEFAULT ${column4.default}` : "";
11237
- const onUpdateStatement = column4.onUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
11238
- const autoincrementStatement = column4.autoincrement ? " AUTO_INCREMENT" : "";
11239
- statement += " " + `\`${column4.name}\` ${column4.type}${autoincrementStatement}${primaryKeyStatement}${notNullStatement}${defaultStatement}${onUpdateStatement}`.trim();
11240
- statement += i === columns.length - 1 ? "" : ",\n";
11191
+ const primaryKeyStatement = column4.primaryKey ? "PRIMARY KEY" : "";
11192
+ const notNullStatement = column4.notNull ? "NOT NULL" : "";
11193
+ const defaultStatement = column4.default !== void 0 ? `DEFAULT ${column4.default}` : "";
11194
+ const onUpdateStatement = column4.onUpdate ? `ON UPDATE CURRENT_TIMESTAMP` : "";
11195
+ const autoincrementStatement = column4.autoincrement ? "AUTO_INCREMENT" : "";
11196
+ statement += " " + `\`${column4.name}\` ${column4.type} ${autoincrementStatement} ${primaryKeyStatement} ${notNullStatement} ${defaultStatement} ${onUpdateStatement}`.replace(/ +/g, " ").trim();
11197
+ statement += (i === columns.length - 1 ? "" : ",") + "\n";
11241
11198
  }
11199
+ statement += `);`;
11200
+ statement += `
11201
+ `;
11242
11202
  if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
11243
- statement += ",\n";
11244
11203
  const compositePK4 = MySqlSquasher.unsquashPK(compositePKs[0]);
11245
- statement += ` PRIMARY KEY(\`${compositePK4.columns.join("`,`")}\`)`;
11204
+ statement += `ALTER TABLE ${tName} ADD PRIMARY KEY(\`${compositePK4.columns.join("`,`")}\`);`;
11246
11205
  statement += `
11247
11206
  `;
11248
11207
  }
11249
- statement += `);`;
11250
- statement += `
11251
- `;
11252
11208
  return statement;
11253
11209
  }
11254
11210
  };
@@ -11339,7 +11295,7 @@ var DropTableConvertor = class extends Convertor {
11339
11295
  }
11340
11296
  convert(statement) {
11341
11297
  const { tableName } = statement;
11342
- return `DROP TABLE \`${tableName}\`;`;
11298
+ return `DROP TABLE ${tableName};`;
11343
11299
  }
11344
11300
  };
11345
11301
  var PgRenameTableConvertor = class extends Convertor {
@@ -11447,13 +11403,12 @@ var MySqlAlterTableAddColumnConvertor = class extends Convertor {
11447
11403
  }
11448
11404
  convert(statement) {
11449
11405
  const { tableName, column: column4 } = statement;
11450
- const { name, type, notNull, primaryKey, autoincrement, onUpdate } = column4;
11451
- const defaultStatement = `${column4.default !== void 0 ? ` DEFAULT ${column4.default}` : ""}`;
11452
- const notNullStatement = `${notNull ? " NOT NULL" : ""}`;
11453
- const primaryKeyStatement = `${primaryKey ? " PRIMARY KEY" : ""}`;
11454
- const autoincrementStatement = `${autoincrement ? " AUTO_INCREMENT" : ""}`;
11455
- const onUpdateStatement = `${onUpdate ? " ON UPDATE CURRENT_TIMESTAMP" : ""}`;
11456
- return `ALTER TABLE ${tableName} ADD \`${name}\` ${type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${notNullStatement}${onUpdateStatement};`;
11406
+ const { name, type, notNull, primaryKey, autoincrement } = column4;
11407
+ const defaultStatement = `${column4.default !== void 0 ? `DEFAULT ${column4.default}` : ""}`;
11408
+ const notNullStatement = `${notNull ? "NOT NULL" : ""}`;
11409
+ const primaryKeyStatement = `${primaryKey ? "PRIMARY KEY" : ""}`;
11410
+ const autoincrementStatement = `${autoincrement ? "AUTO_INCREMENT" : ""}`;
11411
+ return `ALTER TABLE ${tableName} ADD \`${name}\` ${type} ${primaryKeyStatement} ${autoincrementStatement} ${defaultStatement} ${notNullStatement}`.replace(/ +/g, " ").trim() + ";";
11457
11412
  }
11458
11413
  };
11459
11414
  var SQLiteAlterTableAddColumnConvertor = class extends Convertor {
@@ -11528,25 +11483,27 @@ var PgAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
11528
11483
  return `ALTER TABLE ${tableName} ALTER COLUMN "${columnName}" DROP DEFAULT;`;
11529
11484
  }
11530
11485
  };
11531
- var MySqlAlterTableAddPk = class extends Convertor {
11486
+ var MySqlAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
11532
11487
  can(statement, dialect3) {
11533
- return statement.type === "alter_table_alter_column_set_pk" && dialect3 === "mysql";
11488
+ return statement.type === "alter_table_alter_column_set_default" && dialect3 === "mysql";
11534
11489
  }
11535
11490
  convert(statement) {
11536
- return `ALTER TABLE \`${statement.tableName}\` ADD PRIMARY KEY (\`${statement.columnName}\`);`;
11491
+ const { tableName, columnName } = statement;
11492
+ return `ALTER TABLE ${tableName} ALTER COLUMN \`${columnName}\` SET DEFAULT ${statement.newDefaultValue};`;
11537
11493
  }
11538
11494
  };
11539
- var MySqlAlterTableDropPk = class extends Convertor {
11495
+ var MySqlAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
11540
11496
  can(statement, dialect3) {
11541
- return statement.type === "alter_table_alter_column_drop_pk" && dialect3 === "mysql";
11497
+ return statement.type === "alter_table_alter_column_drop_default" && dialect3 === "mysql";
11542
11498
  }
11543
11499
  convert(statement) {
11544
- return `ALTER TABLE \`${statement.tableName}\` DROP PRIMARY KEY`;
11500
+ const { tableName, columnName } = statement;
11501
+ return `ALTER TABLE ${tableName} ALTER COLUMN \`${columnName}\` DROP DEFAULT;`;
11545
11502
  }
11546
11503
  };
11547
11504
  var MySqlModifyColumn = class extends Convertor {
11548
11505
  can(statement, dialect3) {
11549
- return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_drop_on_update" || statement.type === "alter_table_alter_column_set_on_update" || statement.type === "alter_table_alter_column_set_autoincrement" || statement.type === "alter_table_alter_column_drop_autoincrement" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default") && dialect3 === "mysql";
11506
+ return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_drop_on_update" || statement.type === "alter_table_alter_column_set_on_update" || statement.type === "alter_table_alter_column_set_autoincrement" || statement.type === "alter_table_alter_column_drop_autoincrement") && dialect3 === "mysql";
11550
11507
  }
11551
11508
  convert(statement) {
11552
11509
  const { tableName, columnName } = statement;
@@ -11555,7 +11512,6 @@ var MySqlModifyColumn = class extends Convertor {
11555
11512
  let columnNotNull = "";
11556
11513
  let columnOnUpdate = "";
11557
11514
  let columnAutoincrement = "";
11558
- let primaryKey = statement.columnPk ? " PRIMARY KEY" : "";
11559
11515
  if (statement.type === "alter_table_alter_column_drop_notnull") {
11560
11516
  columnType = ` ${statement.newDataType}`;
11561
11517
  columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
@@ -11585,31 +11541,19 @@ var MySqlModifyColumn = class extends Convertor {
11585
11541
  columnOnUpdate = columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
11586
11542
  columnType = ` ${statement.newDataType}`;
11587
11543
  columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
11588
- columnAutoincrement = " AUTO_INCREMENT";
11544
+ columnAutoincrement = "AUTO_INCREMENT";
11589
11545
  } else if (statement.type === "alter_table_alter_column_drop_autoincrement") {
11590
11546
  columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
11591
11547
  columnOnUpdate = columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
11592
11548
  columnType = ` ${statement.newDataType}`;
11593
11549
  columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
11594
11550
  columnAutoincrement = "";
11595
- } else if (statement.type === "alter_table_alter_column_set_default") {
11596
- columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
11597
- columnOnUpdate = columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
11598
- columnType = ` ${statement.newDataType}`;
11599
- columnDefault = ` DEFAULT ${statement.newDefaultValue}`;
11600
- columnAutoincrement = statement.columnAutoIncrement ? " AUTO_INCREMENT" : "";
11601
- } else if (statement.type === "alter_table_alter_column_drop_default") {
11602
- columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
11603
- columnOnUpdate = columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
11604
- columnType = ` ${statement.newDataType}`;
11605
- columnDefault = "";
11606
- columnAutoincrement = statement.columnAutoIncrement ? " AUTO_INCREMENT" : "";
11607
11551
  } else {
11608
11552
  columnType = ` ${statement.newDataType}`;
11609
11553
  columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
11610
11554
  columnOnUpdate = columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
11611
11555
  columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
11612
- columnAutoincrement = statement.columnAutoIncrement ? " AUTO_INCREMENT" : "";
11556
+ columnAutoincrement = statement.columnAutoIncrement ? "AUTO_INCREMENT" : "";
11613
11557
  }
11614
11558
  columnDefault = columnDefault instanceof Date ? columnDefault.toISOString() : columnDefault;
11615
11559
  return `ALTER TABLE ${tableName} MODIFY COLUMN \`${columnName}\`${columnType}${columnAutoincrement}${columnNotNull}${columnDefault}${columnOnUpdate};`;
@@ -11900,6 +11844,7 @@ var PgAlterForeignKeyConvertor = class extends Convertor {
11900
11844
  sql += " WHEN duplicate_object THEN null;\n";
11901
11845
  sql += "END $$;\n";
11902
11846
  return sql;
11847
+ throw new Error("TODO");
11903
11848
  }
11904
11849
  };
11905
11850
  var SqliteAlterForeignKeyConvertor = class extends Convertor {
@@ -12167,6 +12112,8 @@ convertors.push(new PgAlterTableAlterColumnDropNotNullConvertor());
12167
12112
  convertors.push(new PgAlterTableAlterColumnSetDefaultConvertor());
12168
12113
  convertors.push(new PgAlterTableAlterColumnDropDefaultConvertor());
12169
12114
  convertors.push(new MySqlModifyColumn());
12115
+ convertors.push(new MySqlAlterTableAlterColumnSetDefaultConvertor());
12116
+ convertors.push(new MySqlAlterTableAlterColumnDropDefaultConvertor());
12170
12117
  convertors.push(new PgCreateForeignKeyConvertor());
12171
12118
  convertors.push(new MySqlCreateForeignKeyConvertor());
12172
12119
  convertors.push(new PgAlterForeignKeyConvertor());
@@ -12197,10 +12144,8 @@ convertors.push(new SqliteAlterTableAlterCompositePrimaryKeyConvertor());
12197
12144
  convertors.push(new PgAlterTableCreateCompositePrimaryKeyConvertor());
12198
12145
  convertors.push(new PgAlterTableDeleteCompositePrimaryKeyConvertor());
12199
12146
  convertors.push(new PgAlterTableAlterCompositePrimaryKeyConvertor());
12200
- convertors.push(new MySqlAlterTableDeleteCompositePrimaryKeyConvertor());
12201
- convertors.push(new MySqlAlterTableDropPk());
12202
12147
  convertors.push(new MySqlAlterTableCreateCompositePrimaryKeyConvertor());
12203
- convertors.push(new MySqlAlterTableAddPk());
12148
+ convertors.push(new MySqlAlterTableDeleteCompositePrimaryKeyConvertor());
12204
12149
  convertors.push(new MySqlAlterTableAlterCompositePrimaryKeyConvertor());
12205
12150
  var fromJson = (statements, dialect3) => {
12206
12151
  const result = statements.map((statement) => {
@@ -12210,10 +12155,10 @@ var fromJson = (statements, dialect3) => {
12210
12155
  const convertor = filtered.length === 1 ? filtered[0] : void 0;
12211
12156
  if (!convertor) {
12212
12157
  console.log("no convertor:", statement.type, dialect3);
12213
- return "";
12158
+ return "dry run";
12214
12159
  }
12215
12160
  return convertor.convert(statement);
12216
- }).filter((it) => it !== "");
12161
+ });
12217
12162
  return result;
12218
12163
  };
12219
12164
  https:
@@ -12404,7 +12349,7 @@ var _prepareSQLiteAddColumns = (tableName, columns, referenceData) => {
12404
12349
  });
12405
12350
  };
12406
12351
  var _prepareAlterColumns = (tableName, schema3, columns, json2) => {
12407
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
12352
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
12408
12353
  let statements = [];
12409
12354
  for (const column4 of columns) {
12410
12355
  const columnName = typeof column4.name !== "string" ? column4.name.new : column4.name;
@@ -12413,134 +12358,97 @@ var _prepareAlterColumns = (tableName, schema3, columns, json2) => {
12413
12358
  const columnOnUpdate = json2.tables[tableName].columns[columnName].onUpdate;
12414
12359
  const columnNotNull = json2.tables[tableName].columns[columnName].notNull;
12415
12360
  const columnAutoIncrement = json2.tables[tableName].columns[columnName].autoincrement;
12416
- const columnPk = json2.tables[tableName].columns[columnName].primaryKey;
12417
- if (((_a = column4.autoincrement) == null ? void 0 : _a.type) === "added") {
12361
+ if (typeof column4.name !== "string") {
12418
12362
  statements.push({
12419
- type: "alter_table_alter_column_set_autoincrement",
12363
+ type: "alter_table_rename_column",
12420
12364
  tableName,
12421
- columnName,
12422
- schema: schema3,
12423
- newDataType: columnType,
12424
- columnDefault,
12425
- columnOnUpdate,
12426
- columnNotNull,
12427
- columnAutoIncrement,
12428
- columnPk
12365
+ oldColumnName: column4.name.old,
12366
+ newColumnName: column4.name.new,
12367
+ schema: schema3
12429
12368
  });
12430
12369
  }
12431
- if (((_b = column4.autoincrement) == null ? void 0 : _b.type) === "changed") {
12432
- const type = column4.autoincrement.new ? "alter_table_alter_column_set_autoincrement" : "alter_table_alter_column_drop_autoincrement";
12370
+ if (((_a = column4.type) == null ? void 0 : _a.type) === "changed") {
12433
12371
  statements.push({
12434
- type,
12372
+ type: "alter_table_alter_column_set_type",
12435
12373
  tableName,
12436
12374
  columnName,
12375
+ newDataType: column4.type.new,
12437
12376
  schema: schema3,
12438
- newDataType: columnType,
12439
12377
  columnDefault,
12440
12378
  columnOnUpdate,
12441
12379
  columnNotNull,
12442
- columnAutoIncrement,
12443
- columnPk
12380
+ columnAutoIncrement
12444
12381
  });
12445
12382
  }
12446
- if (((_c = column4.autoincrement) == null ? void 0 : _c.type) === "deleted") {
12383
+ if (((_b = column4.default) == null ? void 0 : _b.type) === "added") {
12447
12384
  statements.push({
12448
- type: "alter_table_alter_column_drop_autoincrement",
12385
+ type: "alter_table_alter_column_set_default",
12449
12386
  tableName,
12450
12387
  columnName,
12451
- schema: schema3,
12452
- newDataType: columnType,
12453
- columnDefault,
12454
- columnOnUpdate,
12455
- columnNotNull,
12456
- columnAutoIncrement,
12457
- columnPk
12458
- });
12459
- }
12460
- }
12461
- for (const column4 of columns) {
12462
- const columnName = typeof column4.name !== "string" ? column4.name.new : column4.name;
12463
- const columnType = json2.tables[tableName].columns[columnName].type;
12464
- const columnDefault = json2.tables[tableName].columns[columnName].default;
12465
- const columnOnUpdate = json2.tables[tableName].columns[columnName].onUpdate;
12466
- const columnNotNull = json2.tables[tableName].columns[columnName].notNull;
12467
- const columnAutoIncrement = json2.tables[tableName].columns[columnName].autoincrement;
12468
- const columnPk = json2.tables[tableName].columns[columnName].primaryKey;
12469
- if (typeof column4.name !== "string") {
12470
- statements.push({
12471
- type: "alter_table_rename_column",
12472
- tableName,
12473
- oldColumnName: column4.name.old,
12474
- newColumnName: column4.name.new,
12388
+ newDefaultValue: column4.default.value,
12475
12389
  schema: schema3
12476
12390
  });
12477
12391
  }
12478
- if (((_d = column4.type) == null ? void 0 : _d.type) === "changed") {
12392
+ if (((_c = column4.default) == null ? void 0 : _c.type) === "changed") {
12479
12393
  statements.push({
12480
- type: "alter_table_alter_column_set_type",
12394
+ type: "alter_table_alter_column_set_default",
12481
12395
  tableName,
12482
12396
  columnName,
12483
- newDataType: column4.type.new,
12484
- schema: schema3,
12485
- columnDefault,
12486
- columnOnUpdate,
12487
- columnNotNull,
12488
- columnAutoIncrement,
12489
- columnPk
12397
+ newDefaultValue: column4.default.new,
12398
+ schema: schema3
12490
12399
  });
12491
12400
  }
12492
- if (((_e = column4.primaryKey) == null ? void 0 : _e.type) === "deleted" || ((_f = column4.primaryKey) == null ? void 0 : _f.type) === "changed" && !column4.primaryKey.new) {
12401
+ if (((_d = column4.default) == null ? void 0 : _d.type) === "deleted") {
12493
12402
  statements.push({
12494
- type: "alter_table_alter_column_drop_pk",
12403
+ type: "alter_table_alter_column_drop_default",
12495
12404
  tableName,
12496
- columnName
12405
+ columnName,
12406
+ schema: schema3
12497
12407
  });
12498
12408
  }
12499
- if (((_g = column4.default) == null ? void 0 : _g.type) === "added") {
12409
+ if (((_e = column4.notNull) == null ? void 0 : _e.type) === "added") {
12500
12410
  statements.push({
12501
- type: "alter_table_alter_column_set_default",
12411
+ type: "alter_table_alter_column_set_notnull",
12502
12412
  tableName,
12503
12413
  columnName,
12504
- newDefaultValue: column4.default.value,
12505
12414
  schema: schema3,
12415
+ newDataType: columnType,
12416
+ columnDefault,
12506
12417
  columnOnUpdate,
12507
12418
  columnNotNull,
12508
- columnAutoIncrement,
12509
- newDataType: columnType,
12510
- columnPk
12419
+ columnAutoIncrement
12511
12420
  });
12512
12421
  }
12513
- if (((_h = column4.default) == null ? void 0 : _h.type) === "changed") {
12422
+ if (((_f = column4.notNull) == null ? void 0 : _f.type) === "changed") {
12423
+ const type = column4.notNull.new ? "alter_table_alter_column_set_notnull" : "alter_table_alter_column_drop_notnull";
12514
12424
  statements.push({
12515
- type: "alter_table_alter_column_set_default",
12425
+ type,
12516
12426
  tableName,
12517
12427
  columnName,
12518
- newDefaultValue: column4.default.new,
12519
12428
  schema: schema3,
12429
+ newDataType: columnType,
12430
+ columnDefault,
12520
12431
  columnOnUpdate,
12521
12432
  columnNotNull,
12522
- columnAutoIncrement,
12523
- newDataType: columnType,
12524
- columnPk
12433
+ columnAutoIncrement
12525
12434
  });
12526
12435
  }
12527
- if (((_i = column4.default) == null ? void 0 : _i.type) === "deleted") {
12436
+ if (((_g = column4.notNull) == null ? void 0 : _g.type) === "deleted") {
12528
12437
  statements.push({
12529
- type: "alter_table_alter_column_drop_default",
12438
+ type: "alter_table_alter_column_drop_notnull",
12530
12439
  tableName,
12531
12440
  columnName,
12532
12441
  schema: schema3,
12442
+ newDataType: columnType,
12533
12443
  columnDefault,
12534
12444
  columnOnUpdate,
12535
12445
  columnNotNull,
12536
- columnAutoIncrement,
12537
- newDataType: columnType,
12538
- columnPk
12446
+ columnAutoIncrement
12539
12447
  });
12540
12448
  }
12541
- if (((_j = column4.notNull) == null ? void 0 : _j.type) === "added") {
12449
+ if (((_h = column4.autoincrement) == null ? void 0 : _h.type) === "added") {
12542
12450
  statements.push({
12543
- type: "alter_table_alter_column_set_notnull",
12451
+ type: "alter_table_alter_column_set_autoincrement",
12544
12452
  tableName,
12545
12453
  columnName,
12546
12454
  schema: schema3,
@@ -12548,12 +12456,11 @@ var _prepareAlterColumns = (tableName, schema3, columns, json2) => {
12548
12456
  columnDefault,
12549
12457
  columnOnUpdate,
12550
12458
  columnNotNull,
12551
- columnAutoIncrement,
12552
- columnPk
12459
+ columnAutoIncrement
12553
12460
  });
12554
12461
  }
12555
- if (((_k = column4.notNull) == null ? void 0 : _k.type) === "changed") {
12556
- const type = column4.notNull.new ? "alter_table_alter_column_set_notnull" : "alter_table_alter_column_drop_notnull";
12462
+ if (((_i = column4.autoincrement) == null ? void 0 : _i.type) === "changed") {
12463
+ const type = column4.autoincrement.new ? "alter_table_alter_column_set_notnull" : "alter_table_alter_column_drop_notnull";
12557
12464
  statements.push({
12558
12465
  type,
12559
12466
  tableName,
@@ -12563,13 +12470,12 @@ var _prepareAlterColumns = (tableName, schema3, columns, json2) => {
12563
12470
  columnDefault,
12564
12471
  columnOnUpdate,
12565
12472
  columnNotNull,
12566
- columnAutoIncrement,
12567
- columnPk
12473
+ columnAutoIncrement
12568
12474
  });
12569
12475
  }
12570
- if (((_l = column4.notNull) == null ? void 0 : _l.type) === "deleted") {
12476
+ if (((_j = column4.autoincrement) == null ? void 0 : _j.type) === "deleted") {
12571
12477
  statements.push({
12572
- type: "alter_table_alter_column_drop_notnull",
12478
+ type: "alter_table_alter_column_drop_autoincrement",
12573
12479
  tableName,
12574
12480
  columnName,
12575
12481
  schema: schema3,
@@ -12577,23 +12483,10 @@ var _prepareAlterColumns = (tableName, schema3, columns, json2) => {
12577
12483
  columnDefault,
12578
12484
  columnOnUpdate,
12579
12485
  columnNotNull,
12580
- columnAutoIncrement,
12581
- columnPk
12486
+ columnAutoIncrement
12582
12487
  });
12583
12488
  }
12584
- if (((_m = column4.primaryKey) == null ? void 0 : _m.type) === "added" || ((_n = column4.primaryKey) == null ? void 0 : _n.type) === "changed" && column4.primaryKey.new) {
12585
- const wasAutoincrement = statements.filter(
12586
- (it) => it.type === "alter_table_alter_column_set_autoincrement"
12587
- );
12588
- if (wasAutoincrement.length === 0) {
12589
- statements.push({
12590
- type: "alter_table_alter_column_set_pk",
12591
- tableName,
12592
- columnName
12593
- });
12594
- }
12595
- }
12596
- if (((_o = column4.onUpdate) == null ? void 0 : _o.type) === "added") {
12489
+ if (((_k = column4.onUpdate) == null ? void 0 : _k.type) === "added") {
12597
12490
  statements.push({
12598
12491
  type: "alter_table_alter_column_set_on_update",
12599
12492
  tableName,
@@ -12603,11 +12496,10 @@ var _prepareAlterColumns = (tableName, schema3, columns, json2) => {
12603
12496
  columnDefault,
12604
12497
  columnOnUpdate,
12605
12498
  columnNotNull,
12606
- columnAutoIncrement,
12607
- columnPk
12499
+ columnAutoIncrement
12608
12500
  });
12609
12501
  }
12610
- if (((_p = column4.onUpdate) == null ? void 0 : _p.type) === "deleted") {
12502
+ if (((_l = column4.onUpdate) == null ? void 0 : _l.type) === "deleted") {
12611
12503
  statements.push({
12612
12504
  type: "alter_table_alter_column_drop_on_update",
12613
12505
  tableName,
@@ -12617,8 +12509,7 @@ var _prepareAlterColumns = (tableName, schema3, columns, json2) => {
12617
12509
  columnDefault,
12618
12510
  columnOnUpdate,
12619
12511
  columnNotNull,
12620
- columnAutoIncrement,
12621
- columnPk
12512
+ columnAutoIncrement
12622
12513
  });
12623
12514
  }
12624
12515
  }
@@ -12850,7 +12741,6 @@ var alteredColumnSchema = objectType({
12850
12741
  name: makeSelfOrChanged(stringType()),
12851
12742
  type: makeChanged(stringType()).optional(),
12852
12743
  default: makePatched(anyType()).optional(),
12853
- primaryKey: makePatched(booleanType()).optional(),
12854
12744
  notNull: makePatched(booleanType()).optional(),
12855
12745
  onUpdate: makePatched(booleanType()).optional(),
12856
12746
  autoincrement: makePatched(booleanType()).optional()
@@ -13183,7 +13073,6 @@ var applySnapshotsDiff = async (json1, json2, dialect3, schemasResolver, tablesR
13183
13073
  jsonStatements.push(...jsonDropTables);
13184
13074
  jsonStatements.push(...jsonRenameTables);
13185
13075
  jsonStatements.push(...jsonRenameColumnsStatements);
13186
- jsonStatements.push(...jsonDeletedCompositePKs);
13187
13076
  jsonStatements.push(...jsonTableAlternations.alterColumns);
13188
13077
  jsonStatements.push(...jsonTableAlternations.createColumns);
13189
13078
  jsonStatements.push(...jsonAlterReferencesForAlteredTables);
@@ -13193,6 +13082,7 @@ var applySnapshotsDiff = async (json1, json2, dialect3, schemasResolver, tablesR
13193
13082
  jsonStatements.push(...jsonDropIndexesForAllAlteredTables);
13194
13083
  jsonStatements.push(...jsonCreateIndexesForCreatedTables);
13195
13084
  jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
13085
+ jsonStatements.push(...jsonDeletedCompositePKs);
13196
13086
  jsonStatements.push(...jsonAddedCompositePKs);
13197
13087
  jsonStatements.push(...jsonAlteredCompositePKs);
13198
13088
  jsonStatements.push(...jsonSetTableSchemas);