drizzle-kit 0.24.2-30e7661 → 0.24.2-417b0fa

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/bin.cjs +52 -11
  2. package/package.json +1 -1
package/bin.cjs CHANGED
@@ -71837,7 +71837,7 @@ var init_connections = __esm({
71837
71837
  }
71838
71838
  if (driver2 === "pglite") {
71839
71839
  assertPackages("@electric-sql/pglite");
71840
- const { PGlite } = await import("@electric-sql/pglite");
71840
+ const { PGlite, types: types3 } = await import("@electric-sql/pglite");
71841
71841
  const { drizzle } = await import("drizzle-orm/pglite");
71842
71842
  const { migrate: migrate2 } = await import("drizzle-orm/pglite/migrator");
71843
71843
  const pglite = new PGlite(normalisePGliteUrl(credentials2.url));
@@ -71846,19 +71846,30 @@ var init_connections = __esm({
71846
71846
  const migrateFn = async (config) => {
71847
71847
  return migrate2(drzl, config);
71848
71848
  };
71849
+ const parsers = {
71850
+ [types3.TIMESTAMP]: (value) => value,
71851
+ [types3.TIMESTAMPTZ]: (value) => value,
71852
+ [types3.INTERVAL]: (value) => value,
71853
+ [types3.DATE]: (value) => value
71854
+ };
71849
71855
  const query = async (sql, params = []) => {
71850
- const result = await pglite.query(sql, params);
71856
+ const result = await pglite.query(sql, params, {
71857
+ parsers
71858
+ });
71851
71859
  return result.rows;
71852
71860
  };
71853
71861
  const proxy = async (params) => {
71854
71862
  const preparedParams = preparePGliteParams(params.params);
71855
71863
  if (params.method === "values" || params.method === "get" || params.method === "all") {
71856
71864
  const result2 = await pglite.query(params.sql, preparedParams, {
71857
- rowMode: params.mode
71865
+ rowMode: params.mode,
71866
+ parsers
71858
71867
  });
71859
71868
  return result2.rows;
71860
71869
  }
71861
- const result = await pglite.query(params.sql, preparedParams);
71870
+ const result = await pglite.query(params.sql, preparedParams, {
71871
+ parsers
71872
+ });
71862
71873
  return result.rows;
71863
71874
  };
71864
71875
  return { query, proxy, migrate: migrateFn };
@@ -71867,11 +71878,15 @@ var init_connections = __esm({
71867
71878
  }
71868
71879
  if (await checkPackage("pg")) {
71869
71880
  console.log(withStyle.info(`Using 'pg' driver for database querying`));
71870
- const pg = await import("pg");
71881
+ const { default: pg } = await import("pg");
71871
71882
  const { drizzle } = await import("drizzle-orm/node-postgres");
71872
71883
  const { migrate: migrate2 } = await import("drizzle-orm/node-postgres/migrator");
71873
71884
  const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
71874
- const client = "url" in credentials2 ? new pg.default.Pool({ connectionString: credentials2.url, max: 1 }) : new pg.default.Pool({ ...credentials2, ssl, max: 1 });
71885
+ pg.types.setTypeParser(pg.types.builtins.TIMESTAMPTZ, (val2) => val2);
71886
+ pg.types.setTypeParser(pg.types.builtins.TIMESTAMP, (val2) => val2);
71887
+ pg.types.setTypeParser(pg.types.builtins.DATE, (val2) => val2);
71888
+ pg.types.setTypeParser(pg.types.builtins.INTERVAL, (val2) => val2);
71889
+ const client = "url" in credentials2 ? new pg.Pool({ connectionString: credentials2.url, max: 1 }) : new pg.Pool({ ...credentials2, ssl, max: 1 });
71875
71890
  const db = drizzle(client);
71876
71891
  const migrateFn = async (config) => {
71877
71892
  return migrate2(db, config);
@@ -71898,6 +71913,13 @@ var init_connections = __esm({
71898
71913
  const { drizzle } = await import("drizzle-orm/postgres-js");
71899
71914
  const { migrate: migrate2 } = await import("drizzle-orm/postgres-js/migrator");
71900
71915
  const client = "url" in credentials2 ? postgres.default(credentials2.url, { max: 1 }) : postgres.default({ ...credentials2, max: 1 });
71916
+ const transparentParser = (val2) => val2;
71917
+ for (const type of ["1184", "1082", "1083", "1114"]) {
71918
+ client.options.parsers[type] = transparentParser;
71919
+ client.options.serializers[type] = transparentParser;
71920
+ }
71921
+ client.options.serializers["114"] = transparentParser;
71922
+ client.options.serializers["3802"] = transparentParser;
71901
71923
  const db = drizzle(client);
71902
71924
  const migrateFn = async (config) => {
71903
71925
  return migrate2(db, config);
@@ -71923,10 +71945,14 @@ var init_connections = __esm({
71923
71945
  "'@vercel/postgres' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
71924
71946
  )
71925
71947
  );
71926
- const { VercelPool } = await import("@vercel/postgres");
71948
+ const { VercelPool, types: types3 } = await import("@vercel/postgres");
71927
71949
  const { drizzle } = await import("drizzle-orm/vercel-postgres");
71928
71950
  const { migrate: migrate2 } = await import("drizzle-orm/vercel-postgres/migrator");
71929
71951
  const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
71952
+ types3.setTypeParser(types3.builtins.TIMESTAMPTZ, (val2) => val2);
71953
+ types3.setTypeParser(types3.builtins.TIMESTAMP, (val2) => val2);
71954
+ types3.setTypeParser(types3.builtins.DATE, (val2) => val2);
71955
+ types3.setTypeParser(types3.builtins.INTERVAL, (val2) => val2);
71930
71956
  const client = "url" in credentials2 ? new VercelPool({ connectionString: credentials2.url }) : new VercelPool({ ...credentials2, ssl });
71931
71957
  await client.connect();
71932
71958
  const db = drizzle(client);
@@ -71958,10 +71984,14 @@ var init_connections = __esm({
71958
71984
  "'@neondatabase/serverless' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
71959
71985
  )
71960
71986
  );
71961
- const { Pool, neonConfig } = await import("@neondatabase/serverless");
71987
+ const { Pool, neonConfig, types: types3 } = await import("@neondatabase/serverless");
71962
71988
  const { drizzle } = await import("drizzle-orm/neon-serverless");
71963
71989
  const { migrate: migrate2 } = await import("drizzle-orm/neon-serverless/migrator");
71964
71990
  const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
71991
+ types3.setTypeParser(types3.builtins.TIMESTAMPTZ, (val2) => val2);
71992
+ types3.setTypeParser(types3.builtins.TIMESTAMP, (val2) => val2);
71993
+ types3.setTypeParser(types3.builtins.DATE, (val2) => val2);
71994
+ types3.setTypeParser(types3.builtins.INTERVAL, (val2) => val2);
71965
71995
  const client = "url" in credentials2 ? new Pool({ connectionString: credentials2.url, max: 1 }) : new Pool({ ...credentials2, max: 1, ssl });
71966
71996
  neonConfig.webSocketConstructor = wrapper_default;
71967
71997
  const db = drizzle(client);
@@ -72018,16 +72048,27 @@ var init_connections = __esm({
72018
72048
  const migrateFn = async (config) => {
72019
72049
  return migrate2(db, config);
72020
72050
  };
72051
+ const typeCast = (field, next) => {
72052
+ if (field.type === "TIMESTAMP" || field.type === "DATETIME" || field.type === "DATE") {
72053
+ return field.string();
72054
+ }
72055
+ return next();
72056
+ };
72021
72057
  await connection.connect();
72022
72058
  const query = async (sql, params) => {
72023
- const res = await connection.execute(sql, params);
72059
+ const res = await connection.execute({
72060
+ sql,
72061
+ values: params,
72062
+ typeCast
72063
+ });
72024
72064
  return res[0];
72025
72065
  };
72026
72066
  const proxy = async (params) => {
72027
72067
  const result2 = await connection.query({
72028
72068
  sql: params.sql,
72029
72069
  values: params.params,
72030
- rowsAsArray: params.mode === "array"
72070
+ rowsAsArray: params.mode === "array",
72071
+ typeCast
72031
72072
  });
72032
72073
  return result2[0];
72033
72074
  };
@@ -84028,7 +84069,7 @@ init_utils2();
84028
84069
  var version2 = async () => {
84029
84070
  const { npmVersion } = await ormCoreVersions();
84030
84071
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
84031
- const envVersion = "0.24.2-30e7661";
84072
+ const envVersion = "0.24.2-417b0fa";
84032
84073
  const kitVersion = envVersion ? `v${envVersion}` : "--";
84033
84074
  const versions = `drizzle-kit: ${kitVersion}
84034
84075
  ${ormVersion}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.24.2-30e7661",
3
+ "version": "0.24.2-417b0fa",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",