drizzle-kit 0.21.2-ae19ee7 → 0.21.2-cf9fe8d

Sign up to get free protection for your applications and to get access to all the features.
package/utils-studio.mjs CHANGED
@@ -570,7 +570,7 @@ var init_global = __esm({
570
570
  "src/global.ts"() {
571
571
  "use strict";
572
572
  originUUID = "00000000-0000-0000-0000-000000000000";
573
- snapshotVersion = "6";
573
+ snapshotVersion = "7";
574
574
  }
575
575
  });
576
576
 
@@ -4499,7 +4499,7 @@ var init_mysqlSchema = __esm({
4499
4499
  });
4500
4500
 
4501
4501
  // src/serializer/pgSchema.ts
4502
- var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, index2, fk2, column2, tableV32, compositePK2, uniqueConstraint2, tableV42, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaExternal, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchema2, backwardCompatiblePgSchema, dryPg;
4502
+ 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, pgSchema2, backwardCompatiblePgSchema, dryPg;
4503
4503
  var init_pgSchema = __esm({
4504
4504
  "src/serializer/pgSchema.ts"() {
4505
4505
  "use strict";
@@ -4567,10 +4567,48 @@ var init_pgSchema = __esm({
4567
4567
  tables: recordType(stringType(), tableV1),
4568
4568
  enums: recordType(stringType(), enumSchemaV1)
4569
4569
  }).strict();
4570
+ indexColumn = objectType({
4571
+ expression: stringType(),
4572
+ isExpression: booleanType(),
4573
+ asc: booleanType(),
4574
+ nulls: stringType().optional(),
4575
+ opclass: stringType().optional()
4576
+ });
4570
4577
  index2 = objectType({
4578
+ name: stringType(),
4579
+ columns: indexColumn.array(),
4580
+ isUnique: booleanType(),
4581
+ with: recordType(stringType(), anyType()).optional(),
4582
+ method: stringType().default("btree"),
4583
+ where: stringType().optional(),
4584
+ concurrently: booleanType().default(false)
4585
+ }).strict();
4586
+ indexV4 = objectType({
4571
4587
  name: stringType(),
4572
4588
  columns: stringType().array(),
4573
- isUnique: booleanType()
4589
+ isUnique: booleanType(),
4590
+ with: recordType(stringType(), stringType()).optional(),
4591
+ method: stringType().default("btree"),
4592
+ where: stringType().optional(),
4593
+ concurrently: booleanType().default(false)
4594
+ }).strict();
4595
+ indexV5 = objectType({
4596
+ name: stringType(),
4597
+ columns: stringType().array(),
4598
+ isUnique: booleanType(),
4599
+ with: recordType(stringType(), stringType()).optional(),
4600
+ method: stringType().default("btree"),
4601
+ where: stringType().optional(),
4602
+ concurrently: booleanType().default(false)
4603
+ }).strict();
4604
+ indexV6 = objectType({
4605
+ name: stringType(),
4606
+ columns: stringType().array(),
4607
+ isUnique: booleanType(),
4608
+ with: recordType(stringType(), stringType()).optional(),
4609
+ method: stringType().default("btree"),
4610
+ where: stringType().optional(),
4611
+ concurrently: booleanType().default(false)
4574
4612
  }).strict();
4575
4613
  fk2 = objectType({
4576
4614
  name: stringType(),
@@ -4612,9 +4650,27 @@ var init_pgSchema = __esm({
4612
4650
  name: stringType(),
4613
4651
  schema: stringType(),
4614
4652
  columns: recordType(stringType(), column2),
4615
- indexes: recordType(stringType(), index2),
4653
+ indexes: recordType(stringType(), indexV4),
4616
4654
  foreignKeys: recordType(stringType(), fk2)
4617
4655
  }).strict();
4656
+ tableV6 = objectType({
4657
+ name: stringType(),
4658
+ schema: stringType(),
4659
+ columns: recordType(stringType(), column2),
4660
+ indexes: recordType(stringType(), indexV6),
4661
+ foreignKeys: recordType(stringType(), fk2),
4662
+ compositePrimaryKeys: recordType(stringType(), compositePK2),
4663
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
4664
+ }).strict();
4665
+ tableV5 = objectType({
4666
+ name: stringType(),
4667
+ schema: stringType(),
4668
+ columns: recordType(stringType(), column2),
4669
+ indexes: recordType(stringType(), indexV5),
4670
+ foreignKeys: recordType(stringType(), fk2),
4671
+ compositePrimaryKeys: recordType(stringType(), compositePK2),
4672
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
4673
+ }).strict();
4618
4674
  table2 = objectType({
4619
4675
  name: stringType(),
4620
4676
  schema: stringType(),
@@ -4659,7 +4715,7 @@ var init_pgSchema = __esm({
4659
4715
  pgSchemaInternalV5 = objectType({
4660
4716
  version: literalType("5"),
4661
4717
  dialect: literalType("pg"),
4662
- tables: recordType(stringType(), table2),
4718
+ tables: recordType(stringType(), tableV5),
4663
4719
  enums: recordType(stringType(), enumSchemaV1),
4664
4720
  schemas: recordType(stringType(), stringType()),
4665
4721
  _meta: objectType({
@@ -4669,6 +4725,19 @@ var init_pgSchema = __esm({
4669
4725
  }),
4670
4726
  internal: kitInternals2
4671
4727
  }).strict();
4728
+ pgSchemaInternalV6 = objectType({
4729
+ version: literalType("6"),
4730
+ dialect: literalType("postgresql"),
4731
+ tables: recordType(stringType(), tableV6),
4732
+ enums: recordType(stringType(), enumSchema),
4733
+ schemas: recordType(stringType(), stringType()),
4734
+ _meta: objectType({
4735
+ schemas: recordType(stringType(), stringType()),
4736
+ tables: recordType(stringType(), stringType()),
4737
+ columns: recordType(stringType(), stringType())
4738
+ }),
4739
+ internal: kitInternals2
4740
+ }).strict();
4672
4741
  pgSchemaExternal = objectType({
4673
4742
  version: literalType("5"),
4674
4743
  dialect: literalType("pg"),
@@ -4682,7 +4751,7 @@ var init_pgSchema = __esm({
4682
4751
  })
4683
4752
  }).strict();
4684
4753
  pgSchemaInternal = objectType({
4685
- version: literalType("6"),
4754
+ version: literalType("7"),
4686
4755
  dialect: literalType("postgresql"),
4687
4756
  tables: recordType(stringType(), table2),
4688
4757
  enums: recordType(stringType(), enumSchema),
@@ -4717,18 +4786,30 @@ var init_pgSchema = __esm({
4717
4786
  enums: recordType(stringType(), enumSchemaV1),
4718
4787
  schemas: recordType(stringType(), stringType())
4719
4788
  }).strict();
4720
- pgSchemaSquashed = objectType({
4789
+ pgSchemaSquashedV6 = objectType({
4721
4790
  version: literalType("6"),
4722
4791
  dialect: literalType("postgresql"),
4723
4792
  tables: recordType(stringType(), tableSquashed2),
4724
4793
  enums: recordType(stringType(), enumSchema),
4725
4794
  schemas: recordType(stringType(), stringType())
4726
4795
  }).strict();
4796
+ pgSchemaSquashed = objectType({
4797
+ version: literalType("7"),
4798
+ dialect: literalType("postgresql"),
4799
+ tables: recordType(stringType(), tableSquashed2),
4800
+ enums: recordType(stringType(), enumSchema),
4801
+ schemas: recordType(stringType(), stringType())
4802
+ }).strict();
4727
4803
  pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
4728
4804
  pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
4729
4805
  pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash2);
4806
+ pgSchemaV6 = pgSchemaInternalV6.merge(schemaHash2);
4730
4807
  pgSchema2 = pgSchemaInternal.merge(schemaHash2);
4731
- backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema2]);
4808
+ backwardCompatiblePgSchema = unionType([
4809
+ pgSchemaV5,
4810
+ pgSchemaV6,
4811
+ pgSchema2
4812
+ ]);
4732
4813
  dryPg = pgSchema2.parse({
4733
4814
  version: snapshotVersion,
4734
4815
  dialect: "postgresql",
@@ -4971,24 +5052,12 @@ var init_sqliteSerializer = __esm({
4971
5052
  `SELECT
4972
5053
  m.name as "tableName", p.name as "columnName", p.type as "columnType", p."notnull" as "notNull", p.dflt_value as "defaultValue", p.pk as pk
4973
5054
  FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
4974
- WHERE m.type = 'table'
4975
- and m.tbl_name != 'sqlite_sequence'
4976
- and m.tbl_name != 'sqlite_stat1'
4977
- and m.tbl_name != '_litestream_seq'
4978
- and m.tbl_name != '_litestream_lock'
4979
- and m.tbl_name != 'libsql_wasm_func_table'
4980
- and m.tbl_name != '__drizzle_migrations'
4981
- and m.tbl_name != '_cf_KV';
5055
+ WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock' and m.tbl_name != 'libsql_wasm_func_table' and m.tbl_name != '__drizzle_migrations';
4982
5056
  `
4983
5057
  );
4984
5058
  const tablesWithSeq = [];
4985
5059
  const seq = await db.query(
4986
- `SELECT * FROM sqlite_master WHERE name != 'sqlite_sequence'
4987
- and name != 'sqlite_stat1'
4988
- and name != '_litestream_seq'
4989
- and name != '_litestream_lock'
4990
- and tbl_name != '_cf_KV'
4991
- and sql GLOB '*[ *' || CHAR(9) || CHAR(10) || CHAR(13) || ']AUTOINCREMENT[^'']*';`
5060
+ `SELECT * FROM sqlite_master WHERE name != 'sqlite_sequence' and name != 'sqlite_stat1' and name != '_litestream_seq' and name != '_litestream_lock' and sql GLOB '*[ *' || CHAR(9) || CHAR(10) || CHAR(13) || ']AUTOINCREMENT[^'']*';`
4992
5061
  );
4993
5062
  for (const s of seq) {
4994
5063
  tablesWithSeq.push(s.name);
@@ -5073,8 +5142,7 @@ var init_sqliteSerializer = __esm({
5073
5142
  try {
5074
5143
  const fks = await db.query(
5075
5144
  `SELECT m.name as "tableFrom", f.id as "id", f."table" as "tableTo", f."from", f."to", f."on_update" as "onUpdate", f."on_delete" as "onDelete", f.seq as "seq"
5076
- FROM sqlite_master m, pragma_foreign_key_list(m.name) as f
5077
- where m.tbl_name != '_cf_KV';`
5145
+ FROM sqlite_master m, pragma_foreign_key_list(m.name) as f;`
5078
5146
  );
5079
5147
  const fkByTableName = {};
5080
5148
  for (const fkRow of fks) {
@@ -5133,9 +5201,7 @@ FROM sqlite_master AS m,
5133
5201
  pragma_index_list(m.name) AS il,
5134
5202
  pragma_index_info(il.name) AS ii
5135
5203
  WHERE
5136
- m.type = 'table'
5137
- and il.name NOT LIKE 'sqlite_autoindex_%'
5138
- and m.tbl_name != '_cf_KV';`
5204
+ m.type = 'table' and il.name NOT LIKE 'sqlite_autoindex_%';`
5139
5205
  );
5140
5206
  for (const idxRow of idxs) {
5141
5207
  const tableName = idxRow.tableName;
@@ -5663,7 +5729,10 @@ var init_pgSerializer = __esm({
5663
5729
  columnTypeMapped = trimChar(columnTypeMapped, '"');
5664
5730
  columnToReturn[columnName] = {
5665
5731
  name: columnName,
5666
- type: columnAdditionalDT === "USER-DEFINED" ? enumType3 : columnTypeMapped,
5732
+ type: (
5733
+ // filter vectors, but in future we should filter any extension that was installed by user
5734
+ columnAdditionalDT === "USER-DEFINED" && enumType3 !== "vector" ? enumType3 : columnTypeMapped
5735
+ ),
5667
5736
  typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
5668
5737
  primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
5669
5738
  // default: isSerial ? undefined : defaultValue,
@@ -5674,15 +5743,42 @@ var init_pgSerializer = __esm({
5674
5743
  }
5675
5744
  }
5676
5745
  const dbIndexes = await db.query(
5677
- `SELECT t.relname as table_name, i.relname AS index_name, ix.indisunique AS is_unique, a.attname AS column_name
5678
- FROM pg_class t
5679
- JOIN pg_index ix ON t.oid = ix.indrelid
5680
- JOIN pg_class i ON i.oid = ix.indexrelid
5681
- JOIN pg_attribute a ON a.attrelid = t.oid AND a.attnum = ANY(ix.indkey)
5682
- JOIN pg_namespace ns ON ns.oid = t.relnamespace
5683
- WHERE ns.nspname = '${tableSchema}'
5684
- AND t.relname = '${tableName}'
5685
- and ix.indisprimary = false;`
5746
+ `SELECT t.relname as table_name, ic.relname AS indexname,
5747
+ k.i AS index_order,
5748
+ i.indisunique as is_unique,
5749
+ am.amname as method,
5750
+ ic.reloptions as with,
5751
+ coalesce(a.attname,
5752
+ (('{' || pg_get_expr(
5753
+ i.indexprs,
5754
+ i.indrelid
5755
+ )
5756
+ || '}')::text[]
5757
+ )[k.i]
5758
+ ) AS column_name,
5759
+ CASE
5760
+ WHEN pg_get_expr(i.indexprs, i.indrelid) IS NOT NULL THEN 1
5761
+ ELSE 0
5762
+ END AS is_expression,
5763
+ i.indoption[k.i-1] & 1 = 1 AS descending,
5764
+ i.indoption[k.i-1] & 2 = 2 AS nulls_first,
5765
+ pg_get_expr(
5766
+ i.indpred,
5767
+ i.indrelid
5768
+ ) as where,
5769
+ opc.opcname
5770
+ FROM pg_class t
5771
+ LEFT JOIN pg_index i ON t.oid = i.indrelid
5772
+ LEFT JOIN pg_class ic ON ic.oid = i.indexrelid
5773
+ CROSS JOIN LATERAL (SELECT unnest(i.indkey), generate_subscripts(i.indkey, 1) + 1) AS k(attnum, i)
5774
+ LEFT JOIN pg_attribute AS a
5775
+ ON i.indrelid = a.attrelid AND k.attnum = a.attnum
5776
+ JOIN pg_namespace c on c.oid = t.relnamespace
5777
+ LEFT JOIN pg_am AS am ON ic.relam = am.oid
5778
+ JOIN pg_opclass opc ON opc.oid = ANY(i.indclass)
5779
+ WHERE
5780
+ c.nspname = '${tableSchema}' AND
5781
+ t.relname = '${tableName}';`
5686
5782
  );
5687
5783
  const dbIndexFromConstraint = await db.query(
5688
5784
  `SELECT
@@ -5699,18 +5795,51 @@ var init_pgSerializer = __esm({
5699
5795
  );
5700
5796
  const idxsInConsteraint = dbIndexFromConstraint.filter((it) => it.generated_by_constraint === 1).map((it) => it.index_name);
5701
5797
  for (const dbIndex of dbIndexes) {
5702
- const indexName = dbIndex.index_name;
5798
+ const indexName = dbIndex.indexname;
5703
5799
  const indexColumnName = dbIndex.column_name;
5704
5800
  const indexIsUnique = dbIndex.is_unique;
5801
+ const indexMethod = dbIndex.method;
5802
+ const indexWith = dbIndex.with;
5803
+ const indexWhere = dbIndex.where;
5804
+ const opclass = dbIndex.opcname;
5805
+ const isExpression = dbIndex.is_expression === 1;
5806
+ const desc = dbIndex.descending;
5807
+ const nullsFirst = dbIndex.nulls_first;
5808
+ const mappedWith = {};
5809
+ if (indexWith !== null) {
5810
+ indexWith.forEach((it) => {
5811
+ const splitted = it.split("=");
5812
+ mappedWith[splitted[0]] = splitted[1];
5813
+ });
5814
+ }
5705
5815
  if (idxsInConsteraint.includes(indexName))
5706
5816
  continue;
5707
5817
  if (typeof indexToReturn[indexName] !== "undefined") {
5708
- indexToReturn[indexName].columns.push(indexColumnName);
5818
+ indexToReturn[indexName].columns.push({
5819
+ expression: indexColumnName,
5820
+ asc: !desc,
5821
+ nulls: nullsFirst ? "first" : "last",
5822
+ opclass,
5823
+ isExpression
5824
+ });
5709
5825
  } else {
5710
5826
  indexToReturn[indexName] = {
5711
5827
  name: indexName,
5712
- columns: [indexColumnName],
5713
- isUnique: indexIsUnique
5828
+ columns: [
5829
+ {
5830
+ expression: indexColumnName,
5831
+ asc: !desc,
5832
+ nulls: nullsFirst ? "first" : "last",
5833
+ opclass,
5834
+ isExpression
5835
+ }
5836
+ ],
5837
+ isUnique: indexIsUnique,
5838
+ // should not be a part of diff detecs
5839
+ concurrently: false,
5840
+ method: indexMethod,
5841
+ where: indexWhere === null ? void 0 : indexWhere,
5842
+ with: mappedWith
5714
5843
  };
5715
5844
  }
5716
5845
  }
@@ -5746,7 +5875,7 @@ var init_pgSerializer = __esm({
5746
5875
  }
5747
5876
  const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
5748
5877
  return {
5749
- version: "6",
5878
+ version: "7",
5750
5879
  dialect: "postgresql",
5751
5880
  tables: result,
5752
5881
  enums: enumsToReturn,
@@ -5768,7 +5897,6 @@ var init_pgSerializer = __esm({
5768
5897
  "time without time zone": "::time without time zone",
5769
5898
  // "timestamp with time zone": "::timestamp with time zone",
5770
5899
  "timestamp without time zone": "::timestamp without time zone",
5771
- "timestamp(": "::timestamp without time zone",
5772
5900
  // date: "::date",
5773
5901
  // interval: "::interval",
5774
5902
  // character: "::bpchar",
@@ -5781,15 +5909,15 @@ var init_pgSerializer = __esm({
5781
5909
  "character(": "::bpchar"
5782
5910
  };
5783
5911
  defaultForColumn = (column4) => {
5784
- if (column4.column_default === null) {
5785
- return void 0;
5786
- }
5787
5912
  if (column4.data_type === "serial" || column4.data_type === "smallserial" || column4.data_type === "bigserial") {
5788
5913
  return void 0;
5789
5914
  }
5790
5915
  const hasDifferentDefaultCast = Object.keys(columnToDefault).find(
5791
5916
  (it) => column4.data_type.startsWith(it)
5792
5917
  );
5918
+ if (column4.column_default === null) {
5919
+ return void 0;
5920
+ }
5793
5921
  const columnDefaultAsString = column4.column_default.toString();
5794
5922
  if (columnDefaultAsString.endsWith(
5795
5923
  hasDifferentDefaultCast ? columnToDefault[hasDifferentDefaultCast] : column4.data_type
package/utils.js CHANGED
@@ -1077,7 +1077,7 @@ var info = (msg, greyMsg = "") => {
1077
1077
 
1078
1078
  // src/global.ts
1079
1079
  var originUUID = "00000000-0000-0000-0000-000000000000";
1080
- var snapshotVersion = "6";
1080
+ var snapshotVersion = "7";
1081
1081
 
1082
1082
  // node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs
1083
1083
  var util;
@@ -5060,10 +5060,48 @@ var pgSchemaV1 = objectType({
5060
5060
  tables: recordType(stringType(), tableV1),
5061
5061
  enums: recordType(stringType(), enumSchemaV1)
5062
5062
  }).strict();
5063
+ var indexColumn = objectType({
5064
+ expression: stringType(),
5065
+ isExpression: booleanType(),
5066
+ asc: booleanType(),
5067
+ nulls: stringType().optional(),
5068
+ opclass: stringType().optional()
5069
+ });
5063
5070
  var index2 = objectType({
5071
+ name: stringType(),
5072
+ columns: indexColumn.array(),
5073
+ isUnique: booleanType(),
5074
+ with: recordType(stringType(), anyType()).optional(),
5075
+ method: stringType().default("btree"),
5076
+ where: stringType().optional(),
5077
+ concurrently: booleanType().default(false)
5078
+ }).strict();
5079
+ var indexV4 = objectType({
5064
5080
  name: stringType(),
5065
5081
  columns: stringType().array(),
5066
- isUnique: booleanType()
5082
+ isUnique: booleanType(),
5083
+ with: recordType(stringType(), stringType()).optional(),
5084
+ method: stringType().default("btree"),
5085
+ where: stringType().optional(),
5086
+ concurrently: booleanType().default(false)
5087
+ }).strict();
5088
+ var indexV5 = objectType({
5089
+ name: stringType(),
5090
+ columns: stringType().array(),
5091
+ isUnique: booleanType(),
5092
+ with: recordType(stringType(), stringType()).optional(),
5093
+ method: stringType().default("btree"),
5094
+ where: stringType().optional(),
5095
+ concurrently: booleanType().default(false)
5096
+ }).strict();
5097
+ var indexV6 = objectType({
5098
+ name: stringType(),
5099
+ columns: stringType().array(),
5100
+ isUnique: booleanType(),
5101
+ with: recordType(stringType(), stringType()).optional(),
5102
+ method: stringType().default("btree"),
5103
+ where: stringType().optional(),
5104
+ concurrently: booleanType().default(false)
5067
5105
  }).strict();
5068
5106
  var fk2 = objectType({
5069
5107
  name: stringType(),
@@ -5105,9 +5143,27 @@ var tableV42 = objectType({
5105
5143
  name: stringType(),
5106
5144
  schema: stringType(),
5107
5145
  columns: recordType(stringType(), column2),
5108
- indexes: recordType(stringType(), index2),
5146
+ indexes: recordType(stringType(), indexV4),
5109
5147
  foreignKeys: recordType(stringType(), fk2)
5110
5148
  }).strict();
5149
+ var tableV6 = objectType({
5150
+ name: stringType(),
5151
+ schema: stringType(),
5152
+ columns: recordType(stringType(), column2),
5153
+ indexes: recordType(stringType(), indexV6),
5154
+ foreignKeys: recordType(stringType(), fk2),
5155
+ compositePrimaryKeys: recordType(stringType(), compositePK2),
5156
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5157
+ }).strict();
5158
+ var tableV5 = objectType({
5159
+ name: stringType(),
5160
+ schema: stringType(),
5161
+ columns: recordType(stringType(), column2),
5162
+ indexes: recordType(stringType(), indexV5),
5163
+ foreignKeys: recordType(stringType(), fk2),
5164
+ compositePrimaryKeys: recordType(stringType(), compositePK2),
5165
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5166
+ }).strict();
5111
5167
  var table2 = objectType({
5112
5168
  name: stringType(),
5113
5169
  schema: stringType(),
@@ -5152,7 +5208,7 @@ var pgSchemaInternalV4 = objectType({
5152
5208
  var pgSchemaInternalV5 = objectType({
5153
5209
  version: literalType("5"),
5154
5210
  dialect: literalType("pg"),
5155
- tables: recordType(stringType(), table2),
5211
+ tables: recordType(stringType(), tableV5),
5156
5212
  enums: recordType(stringType(), enumSchemaV1),
5157
5213
  schemas: recordType(stringType(), stringType()),
5158
5214
  _meta: objectType({
@@ -5162,6 +5218,19 @@ var pgSchemaInternalV5 = objectType({
5162
5218
  }),
5163
5219
  internal: kitInternals2
5164
5220
  }).strict();
5221
+ var pgSchemaInternalV6 = objectType({
5222
+ version: literalType("6"),
5223
+ dialect: literalType("postgresql"),
5224
+ tables: recordType(stringType(), tableV6),
5225
+ enums: recordType(stringType(), enumSchema),
5226
+ schemas: recordType(stringType(), stringType()),
5227
+ _meta: objectType({
5228
+ schemas: recordType(stringType(), stringType()),
5229
+ tables: recordType(stringType(), stringType()),
5230
+ columns: recordType(stringType(), stringType())
5231
+ }),
5232
+ internal: kitInternals2
5233
+ }).strict();
5165
5234
  var pgSchemaExternal = objectType({
5166
5235
  version: literalType("5"),
5167
5236
  dialect: literalType("pg"),
@@ -5175,7 +5244,7 @@ var pgSchemaExternal = objectType({
5175
5244
  })
5176
5245
  }).strict();
5177
5246
  var pgSchemaInternal = objectType({
5178
- version: literalType("6"),
5247
+ version: literalType("7"),
5179
5248
  dialect: literalType("postgresql"),
5180
5249
  tables: recordType(stringType(), table2),
5181
5250
  enums: recordType(stringType(), enumSchema),
@@ -5210,18 +5279,30 @@ var pgSchemaSquashedV4 = objectType({
5210
5279
  enums: recordType(stringType(), enumSchemaV1),
5211
5280
  schemas: recordType(stringType(), stringType())
5212
5281
  }).strict();
5213
- var pgSchemaSquashed = objectType({
5282
+ var pgSchemaSquashedV6 = objectType({
5214
5283
  version: literalType("6"),
5215
5284
  dialect: literalType("postgresql"),
5216
5285
  tables: recordType(stringType(), tableSquashed2),
5217
5286
  enums: recordType(stringType(), enumSchema),
5218
5287
  schemas: recordType(stringType(), stringType())
5219
5288
  }).strict();
5289
+ var pgSchemaSquashed = objectType({
5290
+ version: literalType("7"),
5291
+ dialect: literalType("postgresql"),
5292
+ tables: recordType(stringType(), tableSquashed2),
5293
+ enums: recordType(stringType(), enumSchema),
5294
+ schemas: recordType(stringType(), stringType())
5295
+ }).strict();
5220
5296
  var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
5221
5297
  var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
5222
5298
  var pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash2);
5299
+ var pgSchemaV6 = pgSchemaInternalV6.merge(schemaHash2);
5223
5300
  var pgSchema = pgSchemaInternal.merge(schemaHash2);
5224
- var backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema]);
5301
+ var backwardCompatiblePgSchema = unionType([
5302
+ pgSchemaV5,
5303
+ pgSchemaV6,
5304
+ pgSchema
5305
+ ]);
5225
5306
  var dryPg = pgSchema.parse({
5226
5307
  version: snapshotVersion,
5227
5308
  dialect: "postgresql",
@@ -5399,7 +5480,7 @@ var prepareOutFolder = (out, dialect3) => {
5399
5480
  var validatorForDialect = (dialect3) => {
5400
5481
  switch (dialect3) {
5401
5482
  case "postgresql":
5402
- return { validator: backwardCompatiblePgSchema, version: 6 };
5483
+ return { validator: backwardCompatiblePgSchema, version: 7 };
5403
5484
  case "sqlite":
5404
5485
  return { validator: backwardCompatibleSqliteSchema, version: 6 };
5405
5486
  case "mysql":
@@ -5422,6 +5503,7 @@ var validateWithReport = (snapshots, dialect3) => {
5422
5503
  }
5423
5504
  const result2 = validator.safeParse(raw);
5424
5505
  if (!result2.success) {
5506
+ console.error(result2.error);
5425
5507
  accum.malformed.push(it);
5426
5508
  return accum;
5427
5509
  }