drizzle-kit 0.27.1-19f042a → 0.27.1-82368

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. package/api.js +18 -45
  2. package/api.mjs +18 -45
  3. package/bin.cjs +47378 -47407
  4. package/package.json +1 -4
package/api.js CHANGED
@@ -17217,7 +17217,8 @@ var init_snapshotsDiffer = __esm({
17217
17217
  if (policiesInPreviousState.length > 0 && policiesInCurrentState.length === 0 && !table4.isRLSEnabled) {
17218
17218
  jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
17219
17219
  }
17220
- if (table4.isRLSEnabled !== tableInPreviousState.isRLSEnabled) {
17220
+ const wasRlsEnabled = tableInPreviousState ? tableInPreviousState.isRLSEnabled : false;
17221
+ if (table4.isRLSEnabled !== wasRlsEnabled) {
17221
17222
  if (table4.isRLSEnabled) {
17222
17223
  jsonEnableRLSStatements.push({ type: "enable_rls", tableName: table4.name, schema: table4.schema });
17223
17224
  } else if (!table4.isRLSEnabled && policiesInCurrentState.length === 0) {
@@ -34679,7 +34680,7 @@ var init_datetime = __esm({
34679
34680
  // ../drizzle-orm/dist/mysql-core/columns/decimal.js
34680
34681
  function decimal(a, b = {}) {
34681
34682
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34682
- return new MySqlDecimalBuilder(name2, config);
34683
+ return new MySqlDecimalBuilder(name2, config.precision, config.scale);
34683
34684
  }
34684
34685
  var _a259, _b182, MySqlDecimalBuilder, _a260, _b183, MySqlDecimal;
34685
34686
  var init_decimal = __esm({
@@ -34689,11 +34690,10 @@ var init_decimal = __esm({
34689
34690
  init_utils2();
34690
34691
  init_common4();
34691
34692
  MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b182) {
34692
- constructor(name2, config) {
34693
+ constructor(name2, precision, scale) {
34693
34694
  super(name2, "string", "MySqlDecimal");
34694
- this.config.precision = config?.precision;
34695
- this.config.scale = config?.scale;
34696
- this.config.unsigned = config?.unsigned;
34695
+ this.config.precision = precision;
34696
+ this.config.scale = scale;
34697
34697
  }
34698
34698
  /** @internal */
34699
34699
  build(table4) {
@@ -34709,19 +34709,15 @@ var init_decimal = __esm({
34709
34709
  super(...arguments);
34710
34710
  __publicField(this, "precision", this.config.precision);
34711
34711
  __publicField(this, "scale", this.config.scale);
34712
- __publicField(this, "unsigned", this.config.unsigned);
34713
34712
  }
34714
34713
  getSQLType() {
34715
- let type = "";
34716
34714
  if (this.precision !== void 0 && this.scale !== void 0) {
34717
- type += `decimal(${this.precision},${this.scale})`;
34715
+ return `decimal(${this.precision},${this.scale})`;
34718
34716
  } else if (this.precision === void 0) {
34719
- type += "decimal";
34717
+ return "decimal";
34720
34718
  } else {
34721
- type += `decimal(${this.precision})`;
34719
+ return `decimal(${this.precision})`;
34722
34720
  }
34723
- type = type === "decimal(10,0)" || type === "decimal(10)" ? "decimal" : type;
34724
- return this.unsigned ? `${type} unsigned` : type;
34725
34721
  }
34726
34722
  };
34727
34723
  __publicField(MySqlDecimal, _a260, "MySqlDecimal");
@@ -34745,7 +34741,6 @@ var init_double = __esm({
34745
34741
  super(name2, "number", "MySqlDouble");
34746
34742
  this.config.precision = config?.precision;
34747
34743
  this.config.scale = config?.scale;
34748
- this.config.unsigned = config?.unsigned;
34749
34744
  }
34750
34745
  /** @internal */
34751
34746
  build(table4) {
@@ -34758,18 +34753,15 @@ var init_double = __esm({
34758
34753
  super(...arguments);
34759
34754
  __publicField(this, "precision", this.config.precision);
34760
34755
  __publicField(this, "scale", this.config.scale);
34761
- __publicField(this, "unsigned", this.config.unsigned);
34762
34756
  }
34763
34757
  getSQLType() {
34764
- let type = "";
34765
34758
  if (this.precision !== void 0 && this.scale !== void 0) {
34766
- type += `double(${this.precision},${this.scale})`;
34759
+ return `double(${this.precision},${this.scale})`;
34767
34760
  } else if (this.precision === void 0) {
34768
- type += "double";
34761
+ return "double";
34769
34762
  } else {
34770
- type += `double(${this.precision})`;
34763
+ return `double(${this.precision})`;
34771
34764
  }
34772
- return this.unsigned ? `${type} unsigned` : type;
34773
34765
  }
34774
34766
  };
34775
34767
  __publicField(MySqlDouble, _a262, "MySqlDouble");
@@ -34819,23 +34811,18 @@ var init_enum2 = __esm({
34819
34811
  });
34820
34812
 
34821
34813
  // ../drizzle-orm/dist/mysql-core/columns/float.js
34822
- function float(a, b) {
34823
- const { name: name2, config } = getColumnNameAndConfig(a, b);
34824
- return new MySqlFloatBuilder(name2, config);
34814
+ function float(name2) {
34815
+ return new MySqlFloatBuilder(name2 ?? "");
34825
34816
  }
34826
34817
  var _a265, _b188, MySqlFloatBuilder, _a266, _b189, MySqlFloat;
34827
34818
  var init_float = __esm({
34828
34819
  "../drizzle-orm/dist/mysql-core/columns/float.js"() {
34829
34820
  "use strict";
34830
34821
  init_entity();
34831
- init_utils2();
34832
34822
  init_common4();
34833
34823
  MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b188) {
34834
- constructor(name2, config) {
34824
+ constructor(name2) {
34835
34825
  super(name2, "number", "MySqlFloat");
34836
- this.config.precision = config?.precision;
34837
- this.config.scale = config?.scale;
34838
- this.config.unsigned = config?.unsigned;
34839
34826
  }
34840
34827
  /** @internal */
34841
34828
  build(table4) {
@@ -34844,22 +34831,8 @@ var init_float = __esm({
34844
34831
  };
34845
34832
  __publicField(MySqlFloatBuilder, _a265, "MySqlFloatBuilder");
34846
34833
  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
- }
34853
34834
  getSQLType() {
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
+ return "float";
34863
34836
  }
34864
34837
  };
34865
34838
  __publicField(MySqlFloat, _a266, "MySqlFloat");
@@ -38851,8 +38824,8 @@ ${withStyle.errorWarning(
38851
38824
  changedType = columnType.replace("bigint unsigned", "serial");
38852
38825
  }
38853
38826
  }
38854
- if (columnType.includes("decimal(10,0)")) {
38855
- changedType = columnType.replace("decimal(10,0)", "decimal");
38827
+ if (columnType.startsWith("tinyint")) {
38828
+ changedType = "tinyint";
38856
38829
  }
38857
38830
  let onUpdate = void 0;
38858
38831
  if (columnType.startsWith("timestamp") && typeof columnExtra !== "undefined" && columnExtra.includes("on update CURRENT_TIMESTAMP")) {
package/api.mjs CHANGED
@@ -17222,7 +17222,8 @@ var init_snapshotsDiffer = __esm({
17222
17222
  if (policiesInPreviousState.length > 0 && policiesInCurrentState.length === 0 && !table4.isRLSEnabled) {
17223
17223
  jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
17224
17224
  }
17225
- if (table4.isRLSEnabled !== tableInPreviousState.isRLSEnabled) {
17225
+ const wasRlsEnabled = tableInPreviousState ? tableInPreviousState.isRLSEnabled : false;
17226
+ if (table4.isRLSEnabled !== wasRlsEnabled) {
17226
17227
  if (table4.isRLSEnabled) {
17227
17228
  jsonEnableRLSStatements.push({ type: "enable_rls", tableName: table4.name, schema: table4.schema });
17228
17229
  } else if (!table4.isRLSEnabled && policiesInCurrentState.length === 0) {
@@ -34684,7 +34685,7 @@ var init_datetime = __esm({
34684
34685
  // ../drizzle-orm/dist/mysql-core/columns/decimal.js
34685
34686
  function decimal(a, b = {}) {
34686
34687
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34687
- return new MySqlDecimalBuilder(name2, config);
34688
+ return new MySqlDecimalBuilder(name2, config.precision, config.scale);
34688
34689
  }
34689
34690
  var _a259, _b182, MySqlDecimalBuilder, _a260, _b183, MySqlDecimal;
34690
34691
  var init_decimal = __esm({
@@ -34694,11 +34695,10 @@ var init_decimal = __esm({
34694
34695
  init_utils2();
34695
34696
  init_common4();
34696
34697
  MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b182) {
34697
- constructor(name2, config) {
34698
+ constructor(name2, precision, scale) {
34698
34699
  super(name2, "string", "MySqlDecimal");
34699
- this.config.precision = config?.precision;
34700
- this.config.scale = config?.scale;
34701
- this.config.unsigned = config?.unsigned;
34700
+ this.config.precision = precision;
34701
+ this.config.scale = scale;
34702
34702
  }
34703
34703
  /** @internal */
34704
34704
  build(table4) {
@@ -34714,19 +34714,15 @@ var init_decimal = __esm({
34714
34714
  super(...arguments);
34715
34715
  __publicField(this, "precision", this.config.precision);
34716
34716
  __publicField(this, "scale", this.config.scale);
34717
- __publicField(this, "unsigned", this.config.unsigned);
34718
34717
  }
34719
34718
  getSQLType() {
34720
- let type = "";
34721
34719
  if (this.precision !== void 0 && this.scale !== void 0) {
34722
- type += `decimal(${this.precision},${this.scale})`;
34720
+ return `decimal(${this.precision},${this.scale})`;
34723
34721
  } else if (this.precision === void 0) {
34724
- type += "decimal";
34722
+ return "decimal";
34725
34723
  } else {
34726
- type += `decimal(${this.precision})`;
34724
+ return `decimal(${this.precision})`;
34727
34725
  }
34728
- type = type === "decimal(10,0)" || type === "decimal(10)" ? "decimal" : type;
34729
- return this.unsigned ? `${type} unsigned` : type;
34730
34726
  }
34731
34727
  };
34732
34728
  __publicField(MySqlDecimal, _a260, "MySqlDecimal");
@@ -34750,7 +34746,6 @@ var init_double = __esm({
34750
34746
  super(name2, "number", "MySqlDouble");
34751
34747
  this.config.precision = config?.precision;
34752
34748
  this.config.scale = config?.scale;
34753
- this.config.unsigned = config?.unsigned;
34754
34749
  }
34755
34750
  /** @internal */
34756
34751
  build(table4) {
@@ -34763,18 +34758,15 @@ var init_double = __esm({
34763
34758
  super(...arguments);
34764
34759
  __publicField(this, "precision", this.config.precision);
34765
34760
  __publicField(this, "scale", this.config.scale);
34766
- __publicField(this, "unsigned", this.config.unsigned);
34767
34761
  }
34768
34762
  getSQLType() {
34769
- let type = "";
34770
34763
  if (this.precision !== void 0 && this.scale !== void 0) {
34771
- type += `double(${this.precision},${this.scale})`;
34764
+ return `double(${this.precision},${this.scale})`;
34772
34765
  } else if (this.precision === void 0) {
34773
- type += "double";
34766
+ return "double";
34774
34767
  } else {
34775
- type += `double(${this.precision})`;
34768
+ return `double(${this.precision})`;
34776
34769
  }
34777
- return this.unsigned ? `${type} unsigned` : type;
34778
34770
  }
34779
34771
  };
34780
34772
  __publicField(MySqlDouble, _a262, "MySqlDouble");
@@ -34824,23 +34816,18 @@ var init_enum2 = __esm({
34824
34816
  });
34825
34817
 
34826
34818
  // ../drizzle-orm/dist/mysql-core/columns/float.js
34827
- function float(a, b) {
34828
- const { name: name2, config } = getColumnNameAndConfig(a, b);
34829
- return new MySqlFloatBuilder(name2, config);
34819
+ function float(name2) {
34820
+ return new MySqlFloatBuilder(name2 ?? "");
34830
34821
  }
34831
34822
  var _a265, _b188, MySqlFloatBuilder, _a266, _b189, MySqlFloat;
34832
34823
  var init_float = __esm({
34833
34824
  "../drizzle-orm/dist/mysql-core/columns/float.js"() {
34834
34825
  "use strict";
34835
34826
  init_entity();
34836
- init_utils2();
34837
34827
  init_common4();
34838
34828
  MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b188) {
34839
- constructor(name2, config) {
34829
+ constructor(name2) {
34840
34830
  super(name2, "number", "MySqlFloat");
34841
- this.config.precision = config?.precision;
34842
- this.config.scale = config?.scale;
34843
- this.config.unsigned = config?.unsigned;
34844
34831
  }
34845
34832
  /** @internal */
34846
34833
  build(table4) {
@@ -34849,22 +34836,8 @@ var init_float = __esm({
34849
34836
  };
34850
34837
  __publicField(MySqlFloatBuilder, _a265, "MySqlFloatBuilder");
34851
34838
  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
- }
34858
34839
  getSQLType() {
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
+ return "float";
34868
34841
  }
34869
34842
  };
34870
34843
  __publicField(MySqlFloat, _a266, "MySqlFloat");
@@ -38856,8 +38829,8 @@ ${withStyle.errorWarning(
38856
38829
  changedType = columnType.replace("bigint unsigned", "serial");
38857
38830
  }
38858
38831
  }
38859
- if (columnType.includes("decimal(10,0)")) {
38860
- changedType = columnType.replace("decimal(10,0)", "decimal");
38832
+ if (columnType.startsWith("tinyint")) {
38833
+ changedType = "tinyint";
38861
38834
  }
38862
38835
  let onUpdate = void 0;
38863
38836
  if (columnType.startsWith("timestamp") && typeof columnExtra !== "undefined" && columnExtra.includes("on update CURRENT_TIMESTAMP")) {