drizzle-kit 0.27.0 → 0.27.1-19f042a

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 (4) hide show
  1. package/api.js +45 -17
  2. package/api.mjs +45 -17
  3. package/bin.cjs +47537 -47507
  4. package/package.json +4 -1
package/api.js CHANGED
@@ -17520,6 +17520,7 @@ var init_snapshotsDiffer = __esm({
17520
17520
  jsonStatements.push(...jsonCreatedCheckConstraints);
17521
17521
  jsonStatements.push(...jsonAlteredUniqueConstraints);
17522
17522
  jsonStatements.push(...jsonAlterEnumsWithDroppedValues);
17523
+ jsonStatements.push(...createViews);
17523
17524
  jsonStatements.push(...jsonRenamePoliciesStatements);
17524
17525
  jsonStatements.push(...jsonDropPoliciesStatements);
17525
17526
  jsonStatements.push(...jsonCreatePoliciesStatements);
@@ -17528,7 +17529,6 @@ var init_snapshotsDiffer = __esm({
17528
17529
  jsonStatements.push(...jsonDropIndPoliciesStatements);
17529
17530
  jsonStatements.push(...jsonCreateIndPoliciesStatements);
17530
17531
  jsonStatements.push(...jsonAlterIndPoliciesStatements);
17531
- jsonStatements.push(...createViews);
17532
17532
  jsonStatements.push(...dropEnums);
17533
17533
  jsonStatements.push(...dropSequences);
17534
17534
  jsonStatements.push(...dropSchemas);
@@ -34679,7 +34679,7 @@ var init_datetime = __esm({
34679
34679
  // ../drizzle-orm/dist/mysql-core/columns/decimal.js
34680
34680
  function decimal(a, b = {}) {
34681
34681
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34682
- return new MySqlDecimalBuilder(name2, config.precision, config.scale);
34682
+ return new MySqlDecimalBuilder(name2, config);
34683
34683
  }
34684
34684
  var _a259, _b182, MySqlDecimalBuilder, _a260, _b183, MySqlDecimal;
34685
34685
  var init_decimal = __esm({
@@ -34689,10 +34689,11 @@ var init_decimal = __esm({
34689
34689
  init_utils2();
34690
34690
  init_common4();
34691
34691
  MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b182) {
34692
- constructor(name2, precision, scale) {
34692
+ constructor(name2, config) {
34693
34693
  super(name2, "string", "MySqlDecimal");
34694
- this.config.precision = precision;
34695
- this.config.scale = scale;
34694
+ this.config.precision = config?.precision;
34695
+ this.config.scale = config?.scale;
34696
+ this.config.unsigned = config?.unsigned;
34696
34697
  }
34697
34698
  /** @internal */
34698
34699
  build(table4) {
@@ -34708,15 +34709,19 @@ var init_decimal = __esm({
34708
34709
  super(...arguments);
34709
34710
  __publicField(this, "precision", this.config.precision);
34710
34711
  __publicField(this, "scale", this.config.scale);
34712
+ __publicField(this, "unsigned", this.config.unsigned);
34711
34713
  }
34712
34714
  getSQLType() {
34715
+ let type = "";
34713
34716
  if (this.precision !== void 0 && this.scale !== void 0) {
34714
- return `decimal(${this.precision},${this.scale})`;
34717
+ type += `decimal(${this.precision},${this.scale})`;
34715
34718
  } else if (this.precision === void 0) {
34716
- return "decimal";
34719
+ type += "decimal";
34717
34720
  } else {
34718
- return `decimal(${this.precision})`;
34721
+ type += `decimal(${this.precision})`;
34719
34722
  }
34723
+ type = type === "decimal(10,0)" || type === "decimal(10)" ? "decimal" : type;
34724
+ return this.unsigned ? `${type} unsigned` : type;
34720
34725
  }
34721
34726
  };
34722
34727
  __publicField(MySqlDecimal, _a260, "MySqlDecimal");
@@ -34740,6 +34745,7 @@ var init_double = __esm({
34740
34745
  super(name2, "number", "MySqlDouble");
34741
34746
  this.config.precision = config?.precision;
34742
34747
  this.config.scale = config?.scale;
34748
+ this.config.unsigned = config?.unsigned;
34743
34749
  }
34744
34750
  /** @internal */
34745
34751
  build(table4) {
@@ -34752,15 +34758,18 @@ var init_double = __esm({
34752
34758
  super(...arguments);
34753
34759
  __publicField(this, "precision", this.config.precision);
34754
34760
  __publicField(this, "scale", this.config.scale);
34761
+ __publicField(this, "unsigned", this.config.unsigned);
34755
34762
  }
34756
34763
  getSQLType() {
34764
+ let type = "";
34757
34765
  if (this.precision !== void 0 && this.scale !== void 0) {
34758
- return `double(${this.precision},${this.scale})`;
34766
+ type += `double(${this.precision},${this.scale})`;
34759
34767
  } else if (this.precision === void 0) {
34760
- return "double";
34768
+ type += "double";
34761
34769
  } else {
34762
- return `double(${this.precision})`;
34770
+ type += `double(${this.precision})`;
34763
34771
  }
34772
+ return this.unsigned ? `${type} unsigned` : type;
34764
34773
  }
34765
34774
  };
34766
34775
  __publicField(MySqlDouble, _a262, "MySqlDouble");
@@ -34810,18 +34819,23 @@ var init_enum2 = __esm({
34810
34819
  });
34811
34820
 
34812
34821
  // ../drizzle-orm/dist/mysql-core/columns/float.js
34813
- function float(name2) {
34814
- return new MySqlFloatBuilder(name2 ?? "");
34822
+ function float(a, b) {
34823
+ const { name: name2, config } = getColumnNameAndConfig(a, b);
34824
+ return new MySqlFloatBuilder(name2, config);
34815
34825
  }
34816
34826
  var _a265, _b188, MySqlFloatBuilder, _a266, _b189, MySqlFloat;
34817
34827
  var init_float = __esm({
34818
34828
  "../drizzle-orm/dist/mysql-core/columns/float.js"() {
34819
34829
  "use strict";
34820
34830
  init_entity();
34831
+ init_utils2();
34821
34832
  init_common4();
34822
34833
  MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b188) {
34823
- constructor(name2) {
34834
+ constructor(name2, config) {
34824
34835
  super(name2, "number", "MySqlFloat");
34836
+ this.config.precision = config?.precision;
34837
+ this.config.scale = config?.scale;
34838
+ this.config.unsigned = config?.unsigned;
34825
34839
  }
34826
34840
  /** @internal */
34827
34841
  build(table4) {
@@ -34830,8 +34844,22 @@ var init_float = __esm({
34830
34844
  };
34831
34845
  __publicField(MySqlFloatBuilder, _a265, "MySqlFloatBuilder");
34832
34846
  MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b189) {
34847
+ constructor() {
34848
+ super(...arguments);
34849
+ __publicField(this, "precision", this.config.precision);
34850
+ __publicField(this, "scale", this.config.scale);
34851
+ __publicField(this, "unsigned", this.config.unsigned);
34852
+ }
34833
34853
  getSQLType() {
34834
- return "float";
34854
+ let type = "";
34855
+ if (this.precision !== void 0 && this.scale !== void 0) {
34856
+ type += `float(${this.precision},${this.scale})`;
34857
+ } else if (this.precision === void 0) {
34858
+ type += "float";
34859
+ } else {
34860
+ type += `float(${this.precision})`;
34861
+ }
34862
+ return this.unsigned ? `${type} unsigned` : type;
34835
34863
  }
34836
34864
  };
34837
34865
  __publicField(MySqlFloat, _a266, "MySqlFloat");
@@ -38823,8 +38851,8 @@ ${withStyle.errorWarning(
38823
38851
  changedType = columnType.replace("bigint unsigned", "serial");
38824
38852
  }
38825
38853
  }
38826
- if (columnType.startsWith("tinyint")) {
38827
- changedType = "tinyint";
38854
+ if (columnType.includes("decimal(10,0)")) {
38855
+ changedType = columnType.replace("decimal(10,0)", "decimal");
38828
38856
  }
38829
38857
  let onUpdate = void 0;
38830
38858
  if (columnType.startsWith("timestamp") && typeof columnExtra !== "undefined" && columnExtra.includes("on update CURRENT_TIMESTAMP")) {
package/api.mjs CHANGED
@@ -17525,6 +17525,7 @@ var init_snapshotsDiffer = __esm({
17525
17525
  jsonStatements.push(...jsonCreatedCheckConstraints);
17526
17526
  jsonStatements.push(...jsonAlteredUniqueConstraints);
17527
17527
  jsonStatements.push(...jsonAlterEnumsWithDroppedValues);
17528
+ jsonStatements.push(...createViews);
17528
17529
  jsonStatements.push(...jsonRenamePoliciesStatements);
17529
17530
  jsonStatements.push(...jsonDropPoliciesStatements);
17530
17531
  jsonStatements.push(...jsonCreatePoliciesStatements);
@@ -17533,7 +17534,6 @@ var init_snapshotsDiffer = __esm({
17533
17534
  jsonStatements.push(...jsonDropIndPoliciesStatements);
17534
17535
  jsonStatements.push(...jsonCreateIndPoliciesStatements);
17535
17536
  jsonStatements.push(...jsonAlterIndPoliciesStatements);
17536
- jsonStatements.push(...createViews);
17537
17537
  jsonStatements.push(...dropEnums);
17538
17538
  jsonStatements.push(...dropSequences);
17539
17539
  jsonStatements.push(...dropSchemas);
@@ -34684,7 +34684,7 @@ var init_datetime = __esm({
34684
34684
  // ../drizzle-orm/dist/mysql-core/columns/decimal.js
34685
34685
  function decimal(a, b = {}) {
34686
34686
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34687
- return new MySqlDecimalBuilder(name2, config.precision, config.scale);
34687
+ return new MySqlDecimalBuilder(name2, config);
34688
34688
  }
34689
34689
  var _a259, _b182, MySqlDecimalBuilder, _a260, _b183, MySqlDecimal;
34690
34690
  var init_decimal = __esm({
@@ -34694,10 +34694,11 @@ var init_decimal = __esm({
34694
34694
  init_utils2();
34695
34695
  init_common4();
34696
34696
  MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b182) {
34697
- constructor(name2, precision, scale) {
34697
+ constructor(name2, config) {
34698
34698
  super(name2, "string", "MySqlDecimal");
34699
- this.config.precision = precision;
34700
- this.config.scale = scale;
34699
+ this.config.precision = config?.precision;
34700
+ this.config.scale = config?.scale;
34701
+ this.config.unsigned = config?.unsigned;
34701
34702
  }
34702
34703
  /** @internal */
34703
34704
  build(table4) {
@@ -34713,15 +34714,19 @@ var init_decimal = __esm({
34713
34714
  super(...arguments);
34714
34715
  __publicField(this, "precision", this.config.precision);
34715
34716
  __publicField(this, "scale", this.config.scale);
34717
+ __publicField(this, "unsigned", this.config.unsigned);
34716
34718
  }
34717
34719
  getSQLType() {
34720
+ let type = "";
34718
34721
  if (this.precision !== void 0 && this.scale !== void 0) {
34719
- return `decimal(${this.precision},${this.scale})`;
34722
+ type += `decimal(${this.precision},${this.scale})`;
34720
34723
  } else if (this.precision === void 0) {
34721
- return "decimal";
34724
+ type += "decimal";
34722
34725
  } else {
34723
- return `decimal(${this.precision})`;
34726
+ type += `decimal(${this.precision})`;
34724
34727
  }
34728
+ type = type === "decimal(10,0)" || type === "decimal(10)" ? "decimal" : type;
34729
+ return this.unsigned ? `${type} unsigned` : type;
34725
34730
  }
34726
34731
  };
34727
34732
  __publicField(MySqlDecimal, _a260, "MySqlDecimal");
@@ -34745,6 +34750,7 @@ var init_double = __esm({
34745
34750
  super(name2, "number", "MySqlDouble");
34746
34751
  this.config.precision = config?.precision;
34747
34752
  this.config.scale = config?.scale;
34753
+ this.config.unsigned = config?.unsigned;
34748
34754
  }
34749
34755
  /** @internal */
34750
34756
  build(table4) {
@@ -34757,15 +34763,18 @@ var init_double = __esm({
34757
34763
  super(...arguments);
34758
34764
  __publicField(this, "precision", this.config.precision);
34759
34765
  __publicField(this, "scale", this.config.scale);
34766
+ __publicField(this, "unsigned", this.config.unsigned);
34760
34767
  }
34761
34768
  getSQLType() {
34769
+ let type = "";
34762
34770
  if (this.precision !== void 0 && this.scale !== void 0) {
34763
- return `double(${this.precision},${this.scale})`;
34771
+ type += `double(${this.precision},${this.scale})`;
34764
34772
  } else if (this.precision === void 0) {
34765
- return "double";
34773
+ type += "double";
34766
34774
  } else {
34767
- return `double(${this.precision})`;
34775
+ type += `double(${this.precision})`;
34768
34776
  }
34777
+ return this.unsigned ? `${type} unsigned` : type;
34769
34778
  }
34770
34779
  };
34771
34780
  __publicField(MySqlDouble, _a262, "MySqlDouble");
@@ -34815,18 +34824,23 @@ var init_enum2 = __esm({
34815
34824
  });
34816
34825
 
34817
34826
  // ../drizzle-orm/dist/mysql-core/columns/float.js
34818
- function float(name2) {
34819
- return new MySqlFloatBuilder(name2 ?? "");
34827
+ function float(a, b) {
34828
+ const { name: name2, config } = getColumnNameAndConfig(a, b);
34829
+ return new MySqlFloatBuilder(name2, config);
34820
34830
  }
34821
34831
  var _a265, _b188, MySqlFloatBuilder, _a266, _b189, MySqlFloat;
34822
34832
  var init_float = __esm({
34823
34833
  "../drizzle-orm/dist/mysql-core/columns/float.js"() {
34824
34834
  "use strict";
34825
34835
  init_entity();
34836
+ init_utils2();
34826
34837
  init_common4();
34827
34838
  MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b188) {
34828
- constructor(name2) {
34839
+ constructor(name2, config) {
34829
34840
  super(name2, "number", "MySqlFloat");
34841
+ this.config.precision = config?.precision;
34842
+ this.config.scale = config?.scale;
34843
+ this.config.unsigned = config?.unsigned;
34830
34844
  }
34831
34845
  /** @internal */
34832
34846
  build(table4) {
@@ -34835,8 +34849,22 @@ var init_float = __esm({
34835
34849
  };
34836
34850
  __publicField(MySqlFloatBuilder, _a265, "MySqlFloatBuilder");
34837
34851
  MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b189) {
34852
+ constructor() {
34853
+ super(...arguments);
34854
+ __publicField(this, "precision", this.config.precision);
34855
+ __publicField(this, "scale", this.config.scale);
34856
+ __publicField(this, "unsigned", this.config.unsigned);
34857
+ }
34838
34858
  getSQLType() {
34839
- return "float";
34859
+ let type = "";
34860
+ if (this.precision !== void 0 && this.scale !== void 0) {
34861
+ type += `float(${this.precision},${this.scale})`;
34862
+ } else if (this.precision === void 0) {
34863
+ type += "float";
34864
+ } else {
34865
+ type += `float(${this.precision})`;
34866
+ }
34867
+ return this.unsigned ? `${type} unsigned` : type;
34840
34868
  }
34841
34869
  };
34842
34870
  __publicField(MySqlFloat, _a266, "MySqlFloat");
@@ -38828,8 +38856,8 @@ ${withStyle.errorWarning(
38828
38856
  changedType = columnType.replace("bigint unsigned", "serial");
38829
38857
  }
38830
38858
  }
38831
- if (columnType.startsWith("tinyint")) {
38832
- changedType = "tinyint";
38859
+ if (columnType.includes("decimal(10,0)")) {
38860
+ changedType = columnType.replace("decimal(10,0)", "decimal");
38833
38861
  }
38834
38862
  let onUpdate = void 0;
38835
38863
  if (columnType.startsWith("timestamp") && typeof columnExtra !== "undefined" && columnExtra.includes("on update CURRENT_TIMESTAMP")) {