drizzle-kit 0.21.2-4691a9f → 0.21.2-7202142

Sign up to get free protection for your applications and to get access to all the features.
package/bin.cjs CHANGED
@@ -1435,7 +1435,7 @@ var init_global = __esm({
1435
1435
  "src/global.ts"() {
1436
1436
  "use strict";
1437
1437
  originUUID = "00000000-0000-0000-0000-000000000000";
1438
- snapshotVersion = "7";
1438
+ snapshotVersion = "6";
1439
1439
  mapValues = (obj, map) => {
1440
1440
  const result = Object.keys(obj).reduce(function(result2, key) {
1441
1441
  result2[key] = map(obj[key]);
@@ -5637,7 +5637,7 @@ var init_mysqlSchema = __esm({
5637
5637
  });
5638
5638
 
5639
5639
  // src/serializer/pgSchema.ts
5640
- var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, column2, tableV32, compositePK2, uniqueConstraint2, tableV42, tableV6, tableV5, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
5640
+ var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, fk2, column2, tableV32, compositePK2, uniqueConstraint2, tableV42, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaExternal, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
5641
5641
  var init_pgSchema = __esm({
5642
5642
  "src/serializer/pgSchema.ts"() {
5643
5643
  "use strict";
@@ -5721,33 +5721,6 @@ var init_pgSchema = __esm({
5721
5721
  where: stringType().optional(),
5722
5722
  concurrently: booleanType().default(false)
5723
5723
  }).strict();
5724
- indexV4 = objectType({
5725
- name: stringType(),
5726
- columns: stringType().array(),
5727
- isUnique: booleanType(),
5728
- with: recordType(stringType(), stringType()).optional(),
5729
- method: stringType().default("btree"),
5730
- where: stringType().optional(),
5731
- concurrently: booleanType().default(false)
5732
- }).strict();
5733
- indexV5 = objectType({
5734
- name: stringType(),
5735
- columns: stringType().array(),
5736
- isUnique: booleanType(),
5737
- with: recordType(stringType(), stringType()).optional(),
5738
- method: stringType().default("btree"),
5739
- where: stringType().optional(),
5740
- concurrently: booleanType().default(false)
5741
- }).strict();
5742
- indexV6 = objectType({
5743
- name: stringType(),
5744
- columns: stringType().array(),
5745
- isUnique: booleanType(),
5746
- with: recordType(stringType(), stringType()).optional(),
5747
- method: stringType().default("btree"),
5748
- where: stringType().optional(),
5749
- concurrently: booleanType().default(false)
5750
- }).strict();
5751
5724
  fk2 = objectType({
5752
5725
  name: stringType(),
5753
5726
  tableFrom: stringType(),
@@ -5788,27 +5761,9 @@ var init_pgSchema = __esm({
5788
5761
  name: stringType(),
5789
5762
  schema: stringType(),
5790
5763
  columns: recordType(stringType(), column2),
5791
- indexes: recordType(stringType(), indexV4),
5764
+ indexes: recordType(stringType(), index2),
5792
5765
  foreignKeys: recordType(stringType(), fk2)
5793
5766
  }).strict();
5794
- tableV6 = objectType({
5795
- name: stringType(),
5796
- schema: stringType(),
5797
- columns: recordType(stringType(), column2),
5798
- indexes: recordType(stringType(), indexV6),
5799
- foreignKeys: recordType(stringType(), fk2),
5800
- compositePrimaryKeys: recordType(stringType(), compositePK2),
5801
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5802
- }).strict();
5803
- tableV5 = objectType({
5804
- name: stringType(),
5805
- schema: stringType(),
5806
- columns: recordType(stringType(), column2),
5807
- indexes: recordType(stringType(), indexV5),
5808
- foreignKeys: recordType(stringType(), fk2),
5809
- compositePrimaryKeys: recordType(stringType(), compositePK2),
5810
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5811
- }).strict();
5812
5767
  table2 = objectType({
5813
5768
  name: stringType(),
5814
5769
  schema: stringType(),
@@ -5853,7 +5808,7 @@ var init_pgSchema = __esm({
5853
5808
  pgSchemaInternalV5 = objectType({
5854
5809
  version: literalType("5"),
5855
5810
  dialect: literalType("pg"),
5856
- tables: recordType(stringType(), tableV5),
5811
+ tables: recordType(stringType(), table2),
5857
5812
  enums: recordType(stringType(), enumSchemaV1),
5858
5813
  schemas: recordType(stringType(), stringType()),
5859
5814
  _meta: objectType({
@@ -5863,19 +5818,6 @@ var init_pgSchema = __esm({
5863
5818
  }),
5864
5819
  internal: kitInternals2
5865
5820
  }).strict();
5866
- pgSchemaInternalV6 = objectType({
5867
- version: literalType("6"),
5868
- dialect: literalType("postgresql"),
5869
- tables: recordType(stringType(), tableV6),
5870
- enums: recordType(stringType(), enumSchema),
5871
- schemas: recordType(stringType(), stringType()),
5872
- _meta: objectType({
5873
- schemas: recordType(stringType(), stringType()),
5874
- tables: recordType(stringType(), stringType()),
5875
- columns: recordType(stringType(), stringType())
5876
- }),
5877
- internal: kitInternals2
5878
- }).strict();
5879
5821
  pgSchemaExternal = objectType({
5880
5822
  version: literalType("5"),
5881
5823
  dialect: literalType("pg"),
@@ -5889,7 +5831,7 @@ var init_pgSchema = __esm({
5889
5831
  })
5890
5832
  }).strict();
5891
5833
  pgSchemaInternal = objectType({
5892
- version: literalType("7"),
5834
+ version: literalType("6"),
5893
5835
  dialect: literalType("postgresql"),
5894
5836
  tables: recordType(stringType(), table2),
5895
5837
  enums: recordType(stringType(), enumSchema),
@@ -5924,15 +5866,8 @@ var init_pgSchema = __esm({
5924
5866
  enums: recordType(stringType(), enumSchemaV1),
5925
5867
  schemas: recordType(stringType(), stringType())
5926
5868
  }).strict();
5927
- pgSchemaSquashedV6 = objectType({
5928
- version: literalType("6"),
5929
- dialect: literalType("postgresql"),
5930
- tables: recordType(stringType(), tableSquashed2),
5931
- enums: recordType(stringType(), enumSchema),
5932
- schemas: recordType(stringType(), stringType())
5933
- }).strict();
5934
5869
  pgSchemaSquashed = objectType({
5935
- version: literalType("7"),
5870
+ version: literalType("6"),
5936
5871
  dialect: literalType("postgresql"),
5937
5872
  tables: recordType(stringType(), tableSquashed2),
5938
5873
  enums: recordType(stringType(), enumSchema),
@@ -5941,13 +5876,8 @@ var init_pgSchema = __esm({
5941
5876
  pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
5942
5877
  pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
5943
5878
  pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash2);
5944
- pgSchemaV6 = pgSchemaInternalV6.merge(schemaHash2);
5945
5879
  pgSchema = pgSchemaInternal.merge(schemaHash2);
5946
- backwardCompatiblePgSchema = unionType([
5947
- pgSchemaV5,
5948
- pgSchemaV6,
5949
- pgSchema
5950
- ]);
5880
+ backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema]);
5951
5881
  PgSquasher = {
5952
5882
  squashIdx: (idx) => {
5953
5883
  index2.parse(idx);
@@ -6093,7 +6023,7 @@ var init_pgSchema = __esm({
6093
6023
  })
6094
6024
  );
6095
6025
  return {
6096
- version: "7",
6026
+ version: "6",
6097
6027
  dialect: json.dialect,
6098
6028
  tables: mappedTables,
6099
6029
  enums: json.enums,
@@ -6391,7 +6321,7 @@ var init_utils = __esm({
6391
6321
  validatorForDialect = (dialect7) => {
6392
6322
  switch (dialect7) {
6393
6323
  case "postgresql":
6394
- return { validator: backwardCompatiblePgSchema, version: 7 };
6324
+ return { validator: backwardCompatiblePgSchema, version: 6 };
6395
6325
  case "sqlite":
6396
6326
  return { validator: backwardCompatibleSqliteSchema, version: 6 };
6397
6327
  case "mysql":
@@ -15632,24 +15562,6 @@ var init_pgImports = __esm({
15632
15562
  }
15633
15563
  });
15634
15564
 
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
-
15653
15565
  // src/serializer/pgSerializer.ts
15654
15566
  var pgSerializer_exports = {};
15655
15567
  __export(pgSerializer_exports, {
@@ -15667,7 +15579,6 @@ var init_pgSerializer = __esm({
15667
15579
  init_serializer();
15668
15580
  init_source();
15669
15581
  init_outputs();
15670
- init_vector();
15671
15582
  dialect5 = new import_pg_core2.PgDialect();
15672
15583
  indexName2 = (tableName, columns) => {
15673
15584
  return `${tableName}_${columns.join("_")}_index`;
@@ -15844,31 +15755,6 @@ ${withStyle.errorWarning(
15844
15755
  process.exit(1);
15845
15756
  }
15846
15757
  }
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
- }
15872
15758
  indexColumnNames.push(it.name);
15873
15759
  });
15874
15760
  const name = value.config.name ? value.config.name : indexName2(tableName, indexColumnNames);
@@ -15943,7 +15829,7 @@ ${withStyle.errorWarning(
15943
15829
  }).map((it) => [it.schemaName, it.schemaName])
15944
15830
  );
15945
15831
  return {
15946
- version: "7",
15832
+ version: "6",
15947
15833
  dialect: "postgresql",
15948
15834
  tables: result,
15949
15835
  enums: enumsToReturn,
@@ -16229,7 +16115,7 @@ ${withStyle.errorWarning(
16229
16115
  }
16230
16116
  }
16231
16117
  const dbIndexes = await db2.query(
16232
- `SELECT DISTINCT ON (t.relname, ic.relname, k.i) t.relname as table_name, ic.relname AS indexname,
16118
+ `SELECT t.relname as table_name, ic.relname AS indexname,
16233
16119
  k.i AS index_order,
16234
16120
  i.indisunique as is_unique,
16235
16121
  am.amname as method,
@@ -16361,7 +16247,7 @@ ${withStyle.errorWarning(
16361
16247
  }
16362
16248
  const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
16363
16249
  return {
16364
- version: "7",
16250
+ version: "6",
16365
16251
  dialect: "postgresql",
16366
16252
  tables: result,
16367
16253
  enums: enumsToReturn,
@@ -22441,8 +22327,7 @@ var init_migrate = __esm({
22441
22327
  tablesResolver,
22442
22328
  columnsResolver,
22443
22329
  validatedPrev,
22444
- validatedCur,
22445
- "push"
22330
+ validatedCur
22446
22331
  );
22447
22332
  return { sqlStatements, statements, squashedPrev, squashedCur };
22448
22333
  };
@@ -108941,7 +108826,6 @@ var init_introspect_pg = __esm({
108941
108826
  init_utils3();
108942
108827
  init_pgSerializer();
108943
108828
  init_global();
108944
- init_vector();
108945
108829
  pgImportsList = /* @__PURE__ */ new Set([
108946
108830
  "pgTable",
108947
108831
  "pgEnum",
@@ -109502,7 +109386,7 @@ var init_introspect_pg = __esm({
109502
109386
  if (it2.isExpression) {
109503
109387
  return `sql\`${it2.expression}\``;
109504
109388
  } else {
109505
- return `table.${withCasing2(it2.expression, casing2)}${it2.opclass && vectorOps.includes(it2.opclass) ? `.op("${it2.opclass}")` : ""}`;
109389
+ return `table.${withCasing2(it2.expression, casing2)}`;
109506
109390
  }
109507
109391
  }).join(", ")})`;
109508
109392
  statement += it.where ? `.where(sql\`${it.where}\`)` : "";
@@ -113947,11 +113831,7 @@ var upPgHandler = (out) => {
113947
113831
  raw: report.rawMap[it]
113948
113832
  })).forEach((it) => {
113949
113833
  const path5 = it.path;
113950
- let resultV6 = it.raw;
113951
- if (it.raw.version === "5") {
113952
- resultV6 = updateUpToV6(it.raw);
113953
- }
113954
- const result = updateUpToV7(resultV6);
113834
+ const result = updateUpToV6(it.raw);
113955
113835
  console.log(`[${source_default.green("\u2713")}] ${path5}`);
113956
113836
  (0, import_fs2.writeFileSync)(path5, JSON.stringify(result, null, 2));
113957
113837
  });
@@ -113987,36 +113867,6 @@ var updateUpToV6 = (json) => {
113987
113867
  enums
113988
113868
  };
113989
113869
  };
113990
- var updateUpToV7 = (json) => {
113991
- const schema5 = pgSchemaV6.parse(json);
113992
- const tables = Object.fromEntries(
113993
- Object.entries(schema5.tables).map((it) => {
113994
- const table4 = it[1];
113995
- const mappedIndexes = Object.fromEntries(
113996
- Object.entries(table4.indexes).map((idx) => {
113997
- const { columns, ...rest } = idx[1];
113998
- const mappedColumns = columns.map((it2) => {
113999
- return {
114000
- expression: it2,
114001
- isExpression: false,
114002
- asc: true,
114003
- nulls: "last",
114004
- opClass: void 0
114005
- };
114006
- });
114007
- return [idx[0], { columns: mappedColumns, ...rest }];
114008
- })
114009
- );
114010
- return [it[0], { ...table4, indexes: mappedIndexes }];
114011
- })
114012
- );
114013
- return {
114014
- ...schema5,
114015
- version: "7",
114016
- dialect: "postgresql",
114017
- tables
114018
- };
114019
- };
114020
113870
 
114021
113871
  // src/cli/commands/sqliteUp.ts
114022
113872
  init_source();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.21.2-4691a9f",
3
+ "version": "0.21.2-7202142",
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-b473fa9",
64
+ "drizzle-orm": "0.30.9-fc4ded5",
65
65
  "esbuild-node-externals": "^1.9.0",
66
66
  "eslint": "^8.57.0",
67
67
  "eslint-config-prettier": "^9.1.0",
package/payload.d.mts CHANGED
@@ -5,7 +5,7 @@ import { MySql2Database } from 'drizzle-orm/mysql2';
5
5
  import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
6
6
 
7
7
  declare const pgSchema: zod.ZodObject<zod.objectUtil.extendShape<{
8
- version: zod.ZodLiteral<"7">;
8
+ version: zod.ZodLiteral<"6">;
9
9
  dialect: zod.ZodLiteral<"postgresql">;
10
10
  tables: zod.ZodRecord<zod.ZodString, zod.ZodObject<{
11
11
  name: zod.ZodString;
@@ -371,7 +371,7 @@ declare const pgSchema: zod.ZodObject<zod.objectUtil.extendShape<{
371
371
  }>;
372
372
  id: string;
373
373
  prevId: string;
374
- version: "7";
374
+ version: "6";
375
375
  dialect: "postgresql";
376
376
  schemas: Record<string, string>;
377
377
  _meta: {
@@ -445,7 +445,7 @@ declare const pgSchema: zod.ZodObject<zod.objectUtil.extendShape<{
445
445
  }>;
446
446
  id: string;
447
447
  prevId: string;
448
- version: "7";
448
+ version: "6";
449
449
  dialect: "postgresql";
450
450
  schemas: Record<string, string>;
451
451
  _meta: {
@@ -1099,11 +1099,17 @@ declare const upPgSnapshot: (snapshot: Record<string, unknown>) => {
1099
1099
  }>;
1100
1100
  indexes: Record<string, {
1101
1101
  name: string;
1102
- columns: string[];
1102
+ columns: {
1103
+ expression: string;
1104
+ isExpression: boolean;
1105
+ asc: boolean;
1106
+ nulls?: string | undefined;
1107
+ opclass?: string | undefined;
1108
+ }[];
1103
1109
  isUnique: boolean;
1104
1110
  method: string;
1105
1111
  concurrently: boolean;
1106
- with?: Record<string, string> | undefined;
1112
+ with?: Record<string, any> | undefined;
1107
1113
  where?: string | undefined;
1108
1114
  }>;
1109
1115
  foreignKeys: Record<string, {
package/payload.d.ts CHANGED
@@ -5,7 +5,7 @@ import { MySql2Database } from 'drizzle-orm/mysql2';
5
5
  import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
6
6
 
7
7
  declare const pgSchema: zod.ZodObject<zod.objectUtil.extendShape<{
8
- version: zod.ZodLiteral<"7">;
8
+ version: zod.ZodLiteral<"6">;
9
9
  dialect: zod.ZodLiteral<"postgresql">;
10
10
  tables: zod.ZodRecord<zod.ZodString, zod.ZodObject<{
11
11
  name: zod.ZodString;
@@ -371,7 +371,7 @@ declare const pgSchema: zod.ZodObject<zod.objectUtil.extendShape<{
371
371
  }>;
372
372
  id: string;
373
373
  prevId: string;
374
- version: "7";
374
+ version: "6";
375
375
  dialect: "postgresql";
376
376
  schemas: Record<string, string>;
377
377
  _meta: {
@@ -445,7 +445,7 @@ declare const pgSchema: zod.ZodObject<zod.objectUtil.extendShape<{
445
445
  }>;
446
446
  id: string;
447
447
  prevId: string;
448
- version: "7";
448
+ version: "6";
449
449
  dialect: "postgresql";
450
450
  schemas: Record<string, string>;
451
451
  _meta: {
@@ -1099,11 +1099,17 @@ declare const upPgSnapshot: (snapshot: Record<string, unknown>) => {
1099
1099
  }>;
1100
1100
  indexes: Record<string, {
1101
1101
  name: string;
1102
- columns: string[];
1102
+ columns: {
1103
+ expression: string;
1104
+ isExpression: boolean;
1105
+ asc: boolean;
1106
+ nulls?: string | undefined;
1107
+ opclass?: string | undefined;
1108
+ }[];
1103
1109
  isUnique: boolean;
1104
1110
  method: string;
1105
1111
  concurrently: boolean;
1106
- with?: Record<string, string> | undefined;
1112
+ with?: Record<string, any> | undefined;
1107
1113
  where?: string | undefined;
1108
1114
  }>;
1109
1115
  foreignKeys: Record<string, {