drizzle-kit 0.24.2-417b0fa → 0.24.2-50ebd0a

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 +661 -583
  2. package/api.mjs +661 -583
  3. package/bin.cjs +44 -55
  4. package/package.json +1 -1
package/bin.cjs CHANGED
@@ -19143,11 +19143,12 @@ ${withStyle.errorWarning(
19143
19143
  }
19144
19144
  columnTypeMapped = columnTypeMapped.replace("character varying", "varchar").replace(" without time zone", "").replace("character", "char");
19145
19145
  columnTypeMapped = trimChar(columnTypeMapped, '"');
19146
+ columnTypeMapped = columnTypeMapped.replace("geography(Point,4326)", "geography(point)");
19146
19147
  columnToReturn[columnName] = {
19147
19148
  name: columnName,
19148
19149
  type: (
19149
19150
  // filter vectors, but in future we should filter any extension that was installed by user
19150
- columnAdditionalDT === "USER-DEFINED" && !["vector", "geometry"].includes(enumType2) ? enumType2 : columnTypeMapped
19151
+ columnAdditionalDT === "USER-DEFINED" && !["vector", "geometry", "geography"].includes(enumType2) ? enumType2 : columnTypeMapped
19151
19152
  ),
19152
19153
  typeSchema: enumsToReturn[`${typeSchema}.${enumType2}`] !== void 0 ? enumsToReturn[`${typeSchema}.${enumType2}`].schema : void 0,
19153
19154
  primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
@@ -22972,7 +22973,7 @@ var init_sqlgenerator = __esm({
22972
22973
  if (pgNativeTypes.has(it))
22973
22974
  return true;
22974
22975
  const toCheck = it.replace(/ /g, "");
22975
- return toCheck.startsWith("varchar(") || toCheck.startsWith("char(") || toCheck.startsWith("numeric(") || toCheck.startsWith("timestamp(") || toCheck.startsWith("doubleprecision[") || toCheck.startsWith("intervalyear(") || toCheck.startsWith("intervalmonth(") || toCheck.startsWith("intervalday(") || toCheck.startsWith("intervalhour(") || toCheck.startsWith("intervalminute(") || toCheck.startsWith("intervalsecond(") || toCheck.startsWith("intervalyeartomonth(") || toCheck.startsWith("intervaldaytohour(") || toCheck.startsWith("intervaldaytominute(") || toCheck.startsWith("intervaldaytosecond(") || toCheck.startsWith("intervalhourtominute(") || toCheck.startsWith("intervalhourtosecond(") || toCheck.startsWith("intervalminutetosecond(") || toCheck.startsWith("vector(") || toCheck.startsWith("geometry(") || /^(\w+)(\[\d*])+$/.test(it);
22976
+ return toCheck.startsWith("varchar(") || toCheck.startsWith("char(") || toCheck.startsWith("numeric(") || toCheck.startsWith("timestamp(") || toCheck.startsWith("doubleprecision[") || toCheck.startsWith("intervalyear(") || toCheck.startsWith("intervalmonth(") || toCheck.startsWith("intervalday(") || toCheck.startsWith("intervalhour(") || toCheck.startsWith("intervalminute(") || toCheck.startsWith("intervalsecond(") || toCheck.startsWith("intervalyeartomonth(") || toCheck.startsWith("intervaldaytohour(") || toCheck.startsWith("intervaldaytominute(") || toCheck.startsWith("intervaldaytosecond(") || toCheck.startsWith("intervalhourtominute(") || toCheck.startsWith("intervalhourtosecond(") || toCheck.startsWith("intervalminutetosecond(") || toCheck.startsWith("vector(") || toCheck.startsWith("geometry(") || toCheck.startsWith("geography(") || /^(\w+)(\[\d*])+$/.test(it);
22976
22977
  };
22977
22978
  Convertor = class {
22978
22979
  };
@@ -71837,7 +71838,7 @@ var init_connections = __esm({
71837
71838
  }
71838
71839
  if (driver2 === "pglite") {
71839
71840
  assertPackages("@electric-sql/pglite");
71840
- const { PGlite, types: types3 } = await import("@electric-sql/pglite");
71841
+ const { PGlite } = await import("@electric-sql/pglite");
71841
71842
  const { drizzle } = await import("drizzle-orm/pglite");
71842
71843
  const { migrate: migrate2 } = await import("drizzle-orm/pglite/migrator");
71843
71844
  const pglite = new PGlite(normalisePGliteUrl(credentials2.url));
@@ -71846,30 +71847,19 @@ var init_connections = __esm({
71846
71847
  const migrateFn = async (config) => {
71847
71848
  return migrate2(drzl, config);
71848
71849
  };
71849
- const parsers = {
71850
- [types3.TIMESTAMP]: (value) => value,
71851
- [types3.TIMESTAMPTZ]: (value) => value,
71852
- [types3.INTERVAL]: (value) => value,
71853
- [types3.DATE]: (value) => value
71854
- };
71855
71850
  const query = async (sql, params = []) => {
71856
- const result = await pglite.query(sql, params, {
71857
- parsers
71858
- });
71851
+ const result = await pglite.query(sql, params);
71859
71852
  return result.rows;
71860
71853
  };
71861
71854
  const proxy = async (params) => {
71862
71855
  const preparedParams = preparePGliteParams(params.params);
71863
71856
  if (params.method === "values" || params.method === "get" || params.method === "all") {
71864
71857
  const result2 = await pglite.query(params.sql, preparedParams, {
71865
- rowMode: params.mode,
71866
- parsers
71858
+ rowMode: params.mode
71867
71859
  });
71868
71860
  return result2.rows;
71869
71861
  }
71870
- const result = await pglite.query(params.sql, preparedParams, {
71871
- parsers
71872
- });
71862
+ const result = await pglite.query(params.sql, preparedParams);
71873
71863
  return result.rows;
71874
71864
  };
71875
71865
  return { query, proxy, migrate: migrateFn };
@@ -71878,15 +71868,11 @@ var init_connections = __esm({
71878
71868
  }
71879
71869
  if (await checkPackage("pg")) {
71880
71870
  console.log(withStyle.info(`Using 'pg' driver for database querying`));
71881
- const { default: pg } = await import("pg");
71871
+ const pg = await import("pg");
71882
71872
  const { drizzle } = await import("drizzle-orm/node-postgres");
71883
71873
  const { migrate: migrate2 } = await import("drizzle-orm/node-postgres/migrator");
71884
71874
  const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
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
+ const client = "url" in credentials2 ? new pg.default.Pool({ connectionString: credentials2.url, max: 1 }) : new pg.default.Pool({ ...credentials2, ssl, max: 1 });
71890
71876
  const db = drizzle(client);
71891
71877
  const migrateFn = async (config) => {
71892
71878
  return migrate2(db, config);
@@ -71913,13 +71899,6 @@ var init_connections = __esm({
71913
71899
  const { drizzle } = await import("drizzle-orm/postgres-js");
71914
71900
  const { migrate: migrate2 } = await import("drizzle-orm/postgres-js/migrator");
71915
71901
  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;
71923
71902
  const db = drizzle(client);
71924
71903
  const migrateFn = async (config) => {
71925
71904
  return migrate2(db, config);
@@ -71945,14 +71924,10 @@ var init_connections = __esm({
71945
71924
  "'@vercel/postgres' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
71946
71925
  )
71947
71926
  );
71948
- const { VercelPool, types: types3 } = await import("@vercel/postgres");
71927
+ const { VercelPool } = await import("@vercel/postgres");
71949
71928
  const { drizzle } = await import("drizzle-orm/vercel-postgres");
71950
71929
  const { migrate: migrate2 } = await import("drizzle-orm/vercel-postgres/migrator");
71951
71930
  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);
71956
71931
  const client = "url" in credentials2 ? new VercelPool({ connectionString: credentials2.url }) : new VercelPool({ ...credentials2, ssl });
71957
71932
  await client.connect();
71958
71933
  const db = drizzle(client);
@@ -71984,14 +71959,10 @@ var init_connections = __esm({
71984
71959
  "'@neondatabase/serverless' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
71985
71960
  )
71986
71961
  );
71987
- const { Pool, neonConfig, types: types3 } = await import("@neondatabase/serverless");
71962
+ const { Pool, neonConfig } = await import("@neondatabase/serverless");
71988
71963
  const { drizzle } = await import("drizzle-orm/neon-serverless");
71989
71964
  const { migrate: migrate2 } = await import("drizzle-orm/neon-serverless/migrator");
71990
71965
  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);
71995
71966
  const client = "url" in credentials2 ? new Pool({ connectionString: credentials2.url, max: 1 }) : new Pool({ ...credentials2, max: 1, ssl });
71996
71967
  neonConfig.webSocketConstructor = wrapper_default;
71997
71968
  const db = drizzle(client);
@@ -72048,27 +72019,16 @@ var init_connections = __esm({
72048
72019
  const migrateFn = async (config) => {
72049
72020
  return migrate2(db, config);
72050
72021
  };
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
- };
72057
72022
  await connection.connect();
72058
72023
  const query = async (sql, params) => {
72059
- const res = await connection.execute({
72060
- sql,
72061
- values: params,
72062
- typeCast
72063
- });
72024
+ const res = await connection.execute(sql, params);
72064
72025
  return res[0];
72065
72026
  };
72066
72027
  const proxy = async (params) => {
72067
72028
  const result2 = await connection.query({
72068
72029
  sql: params.sql,
72069
72030
  values: params.params,
72070
- rowsAsArray: params.mode === "array",
72071
- typeCast
72031
+ rowsAsArray: params.mode === "array"
72072
72032
  });
72073
72033
  return result2[0];
72074
72034
  };
@@ -75954,7 +75914,8 @@ var init_introspect_pg = __esm({
75954
75914
  "vector",
75955
75915
  "point",
75956
75916
  "line",
75957
- "geometry"
75917
+ "geometry",
75918
+ "geography"
75958
75919
  ]);
75959
75920
  timeConfig2 = (json) => {
75960
75921
  json = Object.fromEntries(Object.entries(json).filter((it) => it[1]));
@@ -76097,6 +76058,7 @@ var init_introspect_pg = __esm({
76097
76058
  patched = patched.startsWith("timestamp(") ? "timestamp" : patched;
76098
76059
  patched = patched.startsWith("vector(") ? "vector" : patched;
76099
76060
  patched = patched.startsWith("geometry(") ? "geometry" : patched;
76061
+ patched = patched.startsWith("geography(") ? "geography" : patched;
76100
76062
  return patched;
76101
76063
  }).filter((type) => {
76102
76064
  return pgImportsList.has(type);
@@ -76323,6 +76285,9 @@ var init_introspect_pg = __esm({
76323
76285
  if (lowered.startsWith("geometry")) {
76324
76286
  return typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault3(defaultValue, isExpression)})` : "";
76325
76287
  }
76288
+ if (lowered.startsWith("geography")) {
76289
+ return typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault3(defaultValue, isExpression)})` : "";
76290
+ }
76326
76291
  if (lowered.startsWith("vector")) {
76327
76292
  return typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault3(defaultValue, isExpression)})` : "";
76328
76293
  }
@@ -76495,6 +76460,30 @@ var init_introspect_pg = __esm({
76495
76460
  if (isGeoUnknown) {
76496
76461
  let unknown2 = `// TODO: failed to parse geometry type because found more than 2 options inside geometry function '${type}'
76497
76462
  // Introspect is currently supporting only type and srid options
76463
+ `;
76464
+ unknown2 += ` ${withCasing2(name, casing2)}: unknown("${name}")`;
76465
+ return unknown2;
76466
+ }
76467
+ return out;
76468
+ }
76469
+ if (lowered.startsWith("geography")) {
76470
+ let out = "";
76471
+ let isGeoUnknown = false;
76472
+ if (lowered.length !== 9) {
76473
+ const geographyOptions = lowered.slice(10, -1).split(",");
76474
+ if (geographyOptions.length === 1 && geographyOptions[0] !== "") {
76475
+ out = `${withCasing2(name, casing2)}: geography("${name}", { type: "${geographyOptions[0]}" })`;
76476
+ } else if (geographyOptions.length === 2) {
76477
+ out = `${withCasing2(name, casing2)}: geography("${name}", { type: "${geographyOptions[0]}", srid: ${geographyOptions[1]} })`;
76478
+ } else {
76479
+ isGeoUnknown = true;
76480
+ }
76481
+ } else {
76482
+ out = `${withCasing2(name, casing2)}: geography("${name}")`;
76483
+ }
76484
+ if (isGeoUnknown) {
76485
+ let unknown2 = `// TODO: failed to parse geography type because found more than 2 options inside geography function '${type}'
76486
+ // Introspect is currently supporting only type and srid options
76498
76487
  `;
76499
76488
  unknown2 += ` ${withCasing2(name, casing2)}: unknown("${name}")`;
76500
76489
  return unknown2;
@@ -84069,7 +84058,7 @@ init_utils2();
84069
84058
  var version2 = async () => {
84070
84059
  const { npmVersion } = await ormCoreVersions();
84071
84060
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
84072
- const envVersion = "0.24.2-417b0fa";
84061
+ const envVersion = "0.24.2-50ebd0a";
84073
84062
  const kitVersion = envVersion ? `v${envVersion}` : "--";
84074
84063
  const versions = `drizzle-kit: ${kitVersion}
84075
84064
  ${ormVersion}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.24.2-417b0fa",
3
+ "version": "0.24.2-50ebd0a",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",