drizzle-kit 1.0.0-beta.1-fd8bfcc → 1.0.0-beta.1-17c242e

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 +36 -7
  2. package/api.mjs +36 -7
  3. package/bin.cjs +261 -2223
  4. package/package.json +1 -1
package/api.js CHANGED
@@ -23732,7 +23732,10 @@ function mapRelationalRow(row, buildQueryResultSelection, mapColumnValue = (valu
23732
23732
  if (selectionItem.selection) {
23733
23733
  const currentPath = `${path2 ? `${path2}.` : ""}${selectionItem.key}`;
23734
23734
  if (row[selectionItem.key] === null) continue;
23735
- if (parseJson) row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
23735
+ if (parseJson) {
23736
+ row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
23737
+ if (row[selectionItem.key] === null) continue;
23738
+ }
23736
23739
  if (parseJsonIfString && typeof row[selectionItem.key] === "string") {
23737
23740
  row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
23738
23741
  }
@@ -37796,8 +37799,12 @@ var init_bigint2 = __esm({
37796
37799
  getSQLType() {
37797
37800
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
37798
37801
  }
37802
+ mapToDriverValue(value) {
37803
+ return value.toString();
37804
+ }
37799
37805
  // eslint-disable-next-line unicorn/prefer-native-coercion-functions
37800
37806
  mapFromDriverValue(value) {
37807
+ if (typeof value === "bigint") return value;
37801
37808
  return BigInt(value);
37802
37809
  }
37803
37810
  };
@@ -37987,9 +37994,7 @@ var init_custom3 = __esm({
37987
37994
  const type = parenPos + 1 ? rawType.slice(0, parenPos) : rawType;
37988
37995
  switch (type) {
37989
37996
  case "binary":
37990
- case "varbinary": {
37991
- return sql2`hex(${identifier})`;
37992
- }
37997
+ case "varbinary":
37993
37998
  case "time":
37994
37999
  case "datetime":
37995
38000
  case "decimal":
@@ -38067,6 +38072,10 @@ var init_date2 = __esm({
38067
38072
  getSQLType() {
38068
38073
  return `date`;
38069
38074
  }
38075
+ mapFromDriverValue(value) {
38076
+ if (typeof value === "string") return value;
38077
+ return value.toISOString().slice(0, -14);
38078
+ }
38070
38079
  };
38071
38080
  __publicField(MySqlDateString, _a283, "MySqlDateString");
38072
38081
  }
@@ -38115,7 +38124,8 @@ var init_datetime = __esm({
38115
38124
  return value.toISOString().replace("T", " ").replace("Z", "");
38116
38125
  }
38117
38126
  mapFromDriverValue(value) {
38118
- return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
38127
+ if (typeof value === "string") return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
38128
+ return value;
38119
38129
  }
38120
38130
  };
38121
38131
  __publicField(MySqlDateTime, _a285, "MySqlDateTime");
@@ -38143,6 +38153,10 @@ var init_datetime = __esm({
38143
38153
  const precision = this.fsp === void 0 ? "" : `(${this.fsp})`;
38144
38154
  return `datetime${precision}`;
38145
38155
  }
38156
+ mapFromDriverValue(value) {
38157
+ if (typeof value === "string") return value;
38158
+ return value.toISOString().slice(0, -5).replace("T", " ");
38159
+ }
38146
38160
  };
38147
38161
  __publicField(MySqlDateTimeString, _a287, "MySqlDateTimeString");
38148
38162
  }
@@ -38797,6 +38811,10 @@ var init_time2 = __esm({
38797
38811
  const precision = this.fsp === void 0 ? "" : `(${this.fsp})`;
38798
38812
  return `time${precision}`;
38799
38813
  }
38814
+ mapFromDriverValue(value) {
38815
+ if (typeof value === "string") return value;
38816
+ return value.toTimeString().split(" ").shift();
38817
+ }
38800
38818
  };
38801
38819
  __publicField(MySqlTime, _a317, "MySqlTime");
38802
38820
  }
@@ -38871,7 +38889,8 @@ var init_timestamp2 = __esm({
38871
38889
  return `timestamp${precision}`;
38872
38890
  }
38873
38891
  mapFromDriverValue(value) {
38874
- return /* @__PURE__ */ new Date(value + "+0000");
38892
+ if (typeof value === "string") return /* @__PURE__ */ new Date(value + "+0000");
38893
+ return value;
38875
38894
  }
38876
38895
  mapToDriverValue(value) {
38877
38896
  return value.toISOString().slice(0, -1).replace("T", " ");
@@ -38901,6 +38920,12 @@ var init_timestamp2 = __esm({
38901
38920
  const precision = this.fsp === void 0 ? "" : `(${this.fsp})`;
38902
38921
  return `timestamp${precision}`;
38903
38922
  }
38923
+ mapFromDriverValue(value) {
38924
+ if (typeof value === "string") return value;
38925
+ const shortened = value.toISOString().slice(0, -1).replace("T", " ");
38926
+ if (shortened.endsWith(".000")) return shortened.slice(0, -4);
38927
+ return shortened;
38928
+ }
38904
38929
  };
38905
38930
  __publicField(MySqlTimestampString, _a323, "MySqlTimestampString");
38906
38931
  }
@@ -39057,6 +39082,10 @@ var init_year = __esm({
39057
39082
  getSQLType() {
39058
39083
  return `year`;
39059
39084
  }
39085
+ mapFromDriverValue(value) {
39086
+ if (typeof value === "number") return value;
39087
+ return Number(value);
39088
+ }
39060
39089
  };
39061
39090
  __publicField(MySqlYear, _a331, "MySqlYear");
39062
39091
  }
@@ -39556,7 +39585,7 @@ var init_utils8 = __esm({
39556
39585
  "../drizzle-orm/dist/mysql-core/utils.js"() {
39557
39586
  "use strict";
39558
39587
  init_entity();
39559
- init_dist();
39588
+ init_sql();
39560
39589
  init_subquery();
39561
39590
  init_table();
39562
39591
  init_view_common();
package/api.mjs CHANGED
@@ -23737,7 +23737,10 @@ function mapRelationalRow(row, buildQueryResultSelection, mapColumnValue = (valu
23737
23737
  if (selectionItem.selection) {
23738
23738
  const currentPath = `${path2 ? `${path2}.` : ""}${selectionItem.key}`;
23739
23739
  if (row[selectionItem.key] === null) continue;
23740
- if (parseJson) row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
23740
+ if (parseJson) {
23741
+ row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
23742
+ if (row[selectionItem.key] === null) continue;
23743
+ }
23741
23744
  if (parseJsonIfString && typeof row[selectionItem.key] === "string") {
23742
23745
  row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
23743
23746
  }
@@ -37801,8 +37804,12 @@ var init_bigint2 = __esm({
37801
37804
  getSQLType() {
37802
37805
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
37803
37806
  }
37807
+ mapToDriverValue(value) {
37808
+ return value.toString();
37809
+ }
37804
37810
  // eslint-disable-next-line unicorn/prefer-native-coercion-functions
37805
37811
  mapFromDriverValue(value) {
37812
+ if (typeof value === "bigint") return value;
37806
37813
  return BigInt(value);
37807
37814
  }
37808
37815
  };
@@ -37992,9 +37999,7 @@ var init_custom3 = __esm({
37992
37999
  const type = parenPos + 1 ? rawType.slice(0, parenPos) : rawType;
37993
38000
  switch (type) {
37994
38001
  case "binary":
37995
- case "varbinary": {
37996
- return sql2`hex(${identifier})`;
37997
- }
38002
+ case "varbinary":
37998
38003
  case "time":
37999
38004
  case "datetime":
38000
38005
  case "decimal":
@@ -38072,6 +38077,10 @@ var init_date2 = __esm({
38072
38077
  getSQLType() {
38073
38078
  return `date`;
38074
38079
  }
38080
+ mapFromDriverValue(value) {
38081
+ if (typeof value === "string") return value;
38082
+ return value.toISOString().slice(0, -14);
38083
+ }
38075
38084
  };
38076
38085
  __publicField(MySqlDateString, _a283, "MySqlDateString");
38077
38086
  }
@@ -38120,7 +38129,8 @@ var init_datetime = __esm({
38120
38129
  return value.toISOString().replace("T", " ").replace("Z", "");
38121
38130
  }
38122
38131
  mapFromDriverValue(value) {
38123
- return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
38132
+ if (typeof value === "string") return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
38133
+ return value;
38124
38134
  }
38125
38135
  };
38126
38136
  __publicField(MySqlDateTime, _a285, "MySqlDateTime");
@@ -38148,6 +38158,10 @@ var init_datetime = __esm({
38148
38158
  const precision = this.fsp === void 0 ? "" : `(${this.fsp})`;
38149
38159
  return `datetime${precision}`;
38150
38160
  }
38161
+ mapFromDriverValue(value) {
38162
+ if (typeof value === "string") return value;
38163
+ return value.toISOString().slice(0, -5).replace("T", " ");
38164
+ }
38151
38165
  };
38152
38166
  __publicField(MySqlDateTimeString, _a287, "MySqlDateTimeString");
38153
38167
  }
@@ -38802,6 +38816,10 @@ var init_time2 = __esm({
38802
38816
  const precision = this.fsp === void 0 ? "" : `(${this.fsp})`;
38803
38817
  return `time${precision}`;
38804
38818
  }
38819
+ mapFromDriverValue(value) {
38820
+ if (typeof value === "string") return value;
38821
+ return value.toTimeString().split(" ").shift();
38822
+ }
38805
38823
  };
38806
38824
  __publicField(MySqlTime, _a317, "MySqlTime");
38807
38825
  }
@@ -38876,7 +38894,8 @@ var init_timestamp2 = __esm({
38876
38894
  return `timestamp${precision}`;
38877
38895
  }
38878
38896
  mapFromDriverValue(value) {
38879
- return /* @__PURE__ */ new Date(value + "+0000");
38897
+ if (typeof value === "string") return /* @__PURE__ */ new Date(value + "+0000");
38898
+ return value;
38880
38899
  }
38881
38900
  mapToDriverValue(value) {
38882
38901
  return value.toISOString().slice(0, -1).replace("T", " ");
@@ -38906,6 +38925,12 @@ var init_timestamp2 = __esm({
38906
38925
  const precision = this.fsp === void 0 ? "" : `(${this.fsp})`;
38907
38926
  return `timestamp${precision}`;
38908
38927
  }
38928
+ mapFromDriverValue(value) {
38929
+ if (typeof value === "string") return value;
38930
+ const shortened = value.toISOString().slice(0, -1).replace("T", " ");
38931
+ if (shortened.endsWith(".000")) return shortened.slice(0, -4);
38932
+ return shortened;
38933
+ }
38909
38934
  };
38910
38935
  __publicField(MySqlTimestampString, _a323, "MySqlTimestampString");
38911
38936
  }
@@ -39062,6 +39087,10 @@ var init_year = __esm({
39062
39087
  getSQLType() {
39063
39088
  return `year`;
39064
39089
  }
39090
+ mapFromDriverValue(value) {
39091
+ if (typeof value === "number") return value;
39092
+ return Number(value);
39093
+ }
39065
39094
  };
39066
39095
  __publicField(MySqlYear, _a331, "MySqlYear");
39067
39096
  }
@@ -39561,7 +39590,7 @@ var init_utils8 = __esm({
39561
39590
  "../drizzle-orm/dist/mysql-core/utils.js"() {
39562
39591
  "use strict";
39563
39592
  init_entity();
39564
- init_dist();
39593
+ init_sql();
39565
39594
  init_subquery();
39566
39595
  init_table();
39567
39596
  init_view_common();