drizzle-kit 0.21.2-3abb478 → 0.21.2-4691a9f

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.
package/bin.cjs CHANGED
@@ -15632,6 +15632,24 @@ var init_pgImports = __esm({
15632
15632
  }
15633
15633
  });
15634
15634
 
15635
+ // src/extensions/vector.ts
15636
+ var vectorOps;
15637
+ var init_vector = __esm({
15638
+ "src/extensions/vector.ts"() {
15639
+ "use strict";
15640
+ vectorOps = [
15641
+ "vector_l2_ops",
15642
+ "vector_ip_ops",
15643
+ "vector_cosine_ops",
15644
+ "vector_l1_ops",
15645
+ "bit_hamming_ops",
15646
+ "bit_jaccard_ops",
15647
+ "halfvec_l2_ops",
15648
+ "sparsevec_l2_ops"
15649
+ ];
15650
+ }
15651
+ });
15652
+
15635
15653
  // src/serializer/pgSerializer.ts
15636
15654
  var pgSerializer_exports = {};
15637
15655
  __export(pgSerializer_exports, {
@@ -15649,6 +15667,7 @@ var init_pgSerializer = __esm({
15649
15667
  init_serializer();
15650
15668
  init_source();
15651
15669
  init_outputs();
15670
+ init_vector();
15652
15671
  dialect5 = new import_pg_core2.PgDialect();
15653
15672
  indexName2 = (tableName, columns) => {
15654
15673
  return `${tableName}_${columns.join("_")}_index`;
@@ -15825,6 +15844,31 @@ ${withStyle.errorWarning(
15825
15844
  process.exit(1);
15826
15845
  }
15827
15846
  }
15847
+ it = it;
15848
+ if (!(0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL) && it.type === "PgVector" && typeof it.indexConfig.opClass === "undefined") {
15849
+ console.log(
15850
+ `
15851
+ ${withStyle.errorWarning(
15852
+ `You are specifying an index on the ${source_default.blueBright(
15853
+ it.name
15854
+ )} column inside the ${source_default.blueBright(
15855
+ tableName
15856
+ )} table with the ${source_default.blueBright(
15857
+ "vector"
15858
+ )} type without specifying an operator class. Vector extension doesn't have a default operator class, so you need to specify one of the available options. Here is a list of available op classes for the vector extension: [${vectorOps.map((it2) => `${source_default.underline(`${it2}`)}`).join(
15859
+ ", "
15860
+ )}].
15861
+
15862
+ You can specify it using current syntax: ${source_default.underline(
15863
+ `index("${value.config.name}").using("${value.config.method}", table.${it.name}.op("${vectorOps[0]}"))`
15864
+ )}
15865
+
15866
+ You can check the "pg_vector" docs for more info: https://github.com/pgvector/pgvector?tab=readme-ov-file#indexing
15867
+ `
15868
+ )}`
15869
+ );
15870
+ process.exit(1);
15871
+ }
15828
15872
  indexColumnNames.push(it.name);
15829
15873
  });
15830
15874
  const name = value.config.name ? value.config.name : indexName2(tableName, indexColumnNames);
@@ -16185,7 +16229,7 @@ ${withStyle.errorWarning(
16185
16229
  }
16186
16230
  }
16187
16231
  const dbIndexes = await db2.query(
16188
- `SELECT t.relname as table_name, ic.relname AS indexname,
16232
+ `SELECT DISTINCT ON (t.relname, ic.relname, k.i) t.relname as table_name, ic.relname AS indexname,
16189
16233
  k.i AS index_order,
16190
16234
  i.indisunique as is_unique,
16191
16235
  am.amname as method,
@@ -22397,7 +22441,8 @@ var init_migrate = __esm({
22397
22441
  tablesResolver,
22398
22442
  columnsResolver,
22399
22443
  validatedPrev,
22400
- validatedCur
22444
+ validatedCur,
22445
+ "push"
22401
22446
  );
22402
22447
  return { sqlStatements, statements, squashedPrev, squashedCur };
22403
22448
  };
@@ -108896,6 +108941,7 @@ var init_introspect_pg = __esm({
108896
108941
  init_utils3();
108897
108942
  init_pgSerializer();
108898
108943
  init_global();
108944
+ init_vector();
108899
108945
  pgImportsList = /* @__PURE__ */ new Set([
108900
108946
  "pgTable",
108901
108947
  "pgEnum",
@@ -109456,7 +109502,7 @@ var init_introspect_pg = __esm({
109456
109502
  if (it2.isExpression) {
109457
109503
  return `sql\`${it2.expression}\``;
109458
109504
  } else {
109459
- return `table.${withCasing2(it2.expression, casing2)}`;
109505
+ return `table.${withCasing2(it2.expression, casing2)}${it2.opclass && vectorOps.includes(it2.opclass) ? `.op("${it2.opclass}")` : ""}`;
109460
109506
  }
109461
109507
  }).join(", ")})`;
109462
109508
  statement += it.where ? `.where(sql\`${it.where}\`)` : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.21.2-3abb478",
3
+ "version": "0.21.2-4691a9f",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "dockerode": "^3.3.4",
62
62
  "dotenv": "^16.0.3",
63
63
  "drizzle-kit": "0.21.2",
64
- "drizzle-orm": "0.30.9-fc4ded5",
64
+ "drizzle-orm": "0.30.9-b473fa9",
65
65
  "esbuild-node-externals": "^1.9.0",
66
66
  "eslint": "^8.57.0",
67
67
  "eslint-config-prettier": "^9.1.0",