drizzle-kit 0.20.17-ff96495 → 0.20.18-08d50a4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. package/bin.cjs +34362 -27214
  2. package/index.d.mts +30 -60
  3. package/index.d.ts +30 -60
  4. package/package.json +21 -27
  5. package/payload.d.mts +1052 -18
  6. package/payload.d.ts +1052 -18
  7. package/payload.js +20595 -16389
  8. package/payload.mjs +20305 -16071
  9. package/utils-studio.js +41 -20
  10. package/utils-studio.mjs +41 -20
  11. package/utils.js +30 -14
  12. package/utils.mjs +30 -14
  13. package/@types/utils.d.ts +0 -12
  14. package/cli/commands/migrate.d.ts +0 -287
  15. package/cli/commands/mysqlIntrospect.d.ts +0 -50
  16. package/cli/commands/mysqlPushUtils.d.ts +0 -14
  17. package/cli/commands/pgIntrospect.d.ts +0 -59
  18. package/cli/commands/pgPushUtils.d.ts +0 -11
  19. package/cli/commands/sqliteIntrospect.d.ts +0 -103
  20. package/cli/commands/sqlitePushUtils.d.ts +0 -15
  21. package/cli/commands/utils.d.ts +0 -58
  22. package/cli/connections.d.ts +0 -13
  23. package/cli/selector-ui.d.ts +0 -13
  24. package/cli/utils.d.ts +0 -13
  25. package/cli/validations/cli.d.ts +0 -169
  26. package/cli/validations/common.d.ts +0 -214
  27. package/cli/validations/mysql.d.ts +0 -29
  28. package/cli/validations/outputs.d.ts +0 -42
  29. package/cli/validations/pg.d.ts +0 -46
  30. package/cli/validations/sqlite.d.ts +0 -22
  31. package/cli/views.d.ts +0 -63
  32. package/global.d.ts +0 -6
  33. package/introspect-sqlite.d.ts +0 -10
  34. package/jsonDiffer.d.ts +0 -61
  35. package/jsonStatements.d.ts +0 -376
  36. package/migrationPreparator.d.ts +0 -35
  37. package/schemaValidator.d.ts +0 -1316
  38. package/serializer/index.d.ts +0 -9
  39. package/serializer/mysqlImports.d.ts +0 -7
  40. package/serializer/mysqlSchema.d.ts +0 -4650
  41. package/serializer/mysqlSerializer.d.ts +0 -7
  42. package/serializer/pgImports.d.ts +0 -11
  43. package/serializer/pgSchema.d.ts +0 -4792
  44. package/serializer/pgSerializer.d.ts +0 -7
  45. package/serializer/schemaToDrizzle.d.ts +0 -7
  46. package/serializer/sqliteImports.d.ts +0 -7
  47. package/serializer/sqliteSchema.d.ts +0 -2801
  48. package/serializer/sqliteSerializer.d.ts +0 -6
  49. package/serializer/studio.d.ts +0 -51
  50. package/snapshotsDiffer.d.ts +0 -3937
  51. package/sqlgenerator.d.ts +0 -33
  52. package/utils/words.d.ts +0 -7
  53. package/utils-studio.d.mts +0 -4
  54. package/utils-studio.d.ts +0 -4
  55. package/utils.d.ts +0 -78
package/utils-studio.js CHANGED
@@ -573,7 +573,7 @@ var init_global = __esm({
573
573
  }
574
574
  });
575
575
 
576
- // node_modules/.pnpm/zod@3.23.4/node_modules/zod/lib/index.mjs
576
+ // node_modules/.pnpm/zod@3.23.6/node_modules/zod/lib/index.mjs
577
577
  function getErrorMap() {
578
578
  return overrideErrorMap;
579
579
  }
@@ -744,7 +744,7 @@ function createZodEnum(values, params) {
744
744
  }
745
745
  var util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, _ZodEnum_cache, _ZodNativeEnum_cache, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv6Regex, base64Regex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType;
746
746
  var init_lib = __esm({
747
- "node_modules/.pnpm/zod@3.23.4/node_modules/zod/lib/index.mjs"() {
747
+ "node_modules/.pnpm/zod@3.23.6/node_modules/zod/lib/index.mjs"() {
748
748
  (function(util2) {
749
749
  util2.assertEqual = (val) => val;
750
750
  function assertIs(_arg) {
@@ -4240,10 +4240,13 @@ var init_lib = __esm({
4240
4240
  ZodReadonly = class extends ZodType {
4241
4241
  _parse(input) {
4242
4242
  const result = this._def.innerType._parse(input);
4243
- if (isValid(result)) {
4244
- result.value = Object.freeze(result.value);
4245
- }
4246
- return result;
4243
+ const freeze = (data) => {
4244
+ if (isValid(data)) {
4245
+ data.value = Object.freeze(data.value);
4246
+ }
4247
+ return data;
4248
+ };
4249
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
4247
4250
  }
4248
4251
  unwrap() {
4249
4252
  return this._def.innerType;
@@ -4679,7 +4682,7 @@ var init_pgSchema = __esm({
4679
4682
  }).strict();
4680
4683
  pgSchemaInternal = objectType({
4681
4684
  version: literalType("6"),
4682
- dialect: literalType("pg"),
4685
+ dialect: literalType("postgresql"),
4683
4686
  tables: recordType(stringType(), table2),
4684
4687
  enums: recordType(stringType(), enumSchema),
4685
4688
  schemas: recordType(stringType(), stringType()),
@@ -4708,14 +4711,14 @@ var init_pgSchema = __esm({
4708
4711
  }).strict();
4709
4712
  pgSchemaSquashedV4 = objectType({
4710
4713
  version: literalType("4"),
4711
- dialect: enumType(["pg"]),
4714
+ dialect: literalType("pg"),
4712
4715
  tables: recordType(stringType(), tableSquashedV42),
4713
4716
  enums: recordType(stringType(), enumSchemaV1),
4714
4717
  schemas: recordType(stringType(), stringType())
4715
4718
  }).strict();
4716
4719
  pgSchemaSquashed = objectType({
4717
4720
  version: literalType("6"),
4718
- dialect: enumType(["pg"]),
4721
+ dialect: literalType("postgresql"),
4719
4722
  tables: recordType(stringType(), tableSquashed2),
4720
4723
  enums: recordType(stringType(), enumSchema),
4721
4724
  schemas: recordType(stringType(), stringType())
@@ -4727,7 +4730,7 @@ var init_pgSchema = __esm({
4727
4730
  backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema2]);
4728
4731
  dryPg = pgSchema2.parse({
4729
4732
  version: snapshotVersion,
4730
- dialect: "pg",
4733
+ dialect: "postgresql",
4731
4734
  id: originUUID,
4732
4735
  prevId: "",
4733
4736
  tables: {},
@@ -4743,7 +4746,7 @@ var init_pgSchema = __esm({
4743
4746
  });
4744
4747
 
4745
4748
  // src/serializer/sqliteSchema.ts
4746
- var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, latestVersion, schemaInternal2, schemaV32, schemaV42, schema2, tableSquashed3, schemaSquashed2, drySQLite;
4749
+ var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, schemaInternalV52, latestVersion, schemaInternal2, schemaV32, schemaV42, schemaV52, schema2, tableSquashed3, schemaSquashed2, drySQLite, sqliteSchemaV5, backwardCompatibleSqliteSchema;
4747
4750
  var init_sqliteSchema = __esm({
4748
4751
  "src/serializer/sqliteSchema.ts"() {
4749
4752
  "use strict";
@@ -4811,7 +4814,17 @@ var init_sqliteSchema = __esm({
4811
4814
  tables: recordType(stringType(), table3),
4812
4815
  enums: objectType({})
4813
4816
  }).strict();
4814
- latestVersion = literalType("5");
4817
+ schemaInternalV52 = objectType({
4818
+ version: literalType("5"),
4819
+ dialect: dialect2,
4820
+ tables: recordType(stringType(), table3),
4821
+ enums: objectType({}),
4822
+ _meta: objectType({
4823
+ tables: recordType(stringType(), stringType()),
4824
+ columns: recordType(stringType(), stringType())
4825
+ })
4826
+ }).strict();
4827
+ latestVersion = literalType("6");
4815
4828
  schemaInternal2 = objectType({
4816
4829
  version: latestVersion,
4817
4830
  dialect: dialect2,
@@ -4824,6 +4837,7 @@ var init_sqliteSchema = __esm({
4824
4837
  }).strict();
4825
4838
  schemaV32 = schemaInternalV32.merge(schemaHash3).strict();
4826
4839
  schemaV42 = schemaInternalV42.merge(schemaHash3).strict();
4840
+ schemaV52 = schemaInternalV52.merge(schemaHash3).strict();
4827
4841
  schema2 = schemaInternal2.merge(schemaHash3).strict();
4828
4842
  tableSquashed3 = objectType({
4829
4843
  name: stringType(),
@@ -4840,7 +4854,7 @@ var init_sqliteSchema = __esm({
4840
4854
  enums: anyType()
4841
4855
  }).strict();
4842
4856
  drySQLite = schema2.parse({
4843
- version: "5",
4857
+ version: "6",
4844
4858
  dialect: "sqlite",
4845
4859
  id: originUUID,
4846
4860
  prevId: "",
@@ -4851,6 +4865,8 @@ var init_sqliteSchema = __esm({
4851
4865
  columns: {}
4852
4866
  }
4853
4867
  });
4868
+ sqliteSchemaV5 = schemaV52;
4869
+ backwardCompatibleSqliteSchema = unionType([sqliteSchemaV5, schema2]);
4854
4870
  }
4855
4871
  });
4856
4872
 
@@ -4927,7 +4943,9 @@ function mapSqlToSqliteType(sqlType) {
4927
4943
  return "text";
4928
4944
  } else if (lowered.startsWith("blob")) {
4929
4945
  return "blob";
4930
- } else if (["real", "double", "double precision", "float"].some((it) => lowered.startsWith(it))) {
4946
+ } else if (["real", "double", "double precision", "float"].some(
4947
+ (it) => lowered.startsWith(it)
4948
+ )) {
4931
4949
  return "real";
4932
4950
  } else {
4933
4951
  return "numeric";
@@ -4948,7 +4966,7 @@ var init_sqliteSerializer = __esm({
4948
4966
  `SELECT
4949
4967
  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
4950
4968
  FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
4951
- 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';
4969
+ 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';
4952
4970
  `
4953
4971
  );
4954
4972
  const tablesWithSeq = [];
@@ -5126,7 +5144,7 @@ WHERE
5126
5144
  progressCallback("enums", 0, "done");
5127
5145
  }
5128
5146
  return {
5129
- version: "5",
5147
+ version: "6",
5130
5148
  dialect: "sqlite",
5131
5149
  tables: result,
5132
5150
  enums: {},
@@ -5557,7 +5575,7 @@ var init_pgSerializer = __esm({
5557
5575
  const columnName = columnResponse.attname;
5558
5576
  const columnAdditionalDT = columnResponse.additional_dt;
5559
5577
  const columnDimensions = columnResponse.array_dimensions;
5560
- const enumType2 = columnResponse.enum_name;
5578
+ const enumType3 = columnResponse.enum_name;
5561
5579
  let columnType = columnResponse.data_type;
5562
5580
  const primaryKey = tableConstraints.filter(
5563
5581
  (mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "PRIMARY KEY"
@@ -5621,8 +5639,8 @@ var init_pgSerializer = __esm({
5621
5639
  columnTypeMapped = trimChar(columnTypeMapped, '"');
5622
5640
  columnToReturn[columnName] = {
5623
5641
  name: columnName,
5624
- type: columnAdditionalDT === "USER-DEFINED" ? enumType2 : columnTypeMapped,
5625
- typeSchema: enumsToReturn[`${tableSchema}.${enumType2}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType2}`].schema : void 0,
5642
+ type: columnAdditionalDT === "USER-DEFINED" ? enumType3 : columnTypeMapped,
5643
+ typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
5626
5644
  primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
5627
5645
  // default: isSerial ? undefined : defaultValue,
5628
5646
  notNull: columnResponse.is_nullable === "NO"
@@ -5705,7 +5723,7 @@ var init_pgSerializer = __esm({
5705
5723
  const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
5706
5724
  return {
5707
5725
  version: "6",
5708
- dialect: "pg",
5726
+ dialect: "postgresql",
5709
5727
  tables: result,
5710
5728
  enums: enumsToReturn,
5711
5729
  schemas: schemasObject,
@@ -6039,6 +6057,9 @@ String.prototype.squashSpaces = function() {
6039
6057
  String.prototype.camelCase = function() {
6040
6058
  return camelCase(String(this));
6041
6059
  };
6060
+ String.prototype.capitalise = function() {
6061
+ return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
6062
+ };
6042
6063
  String.prototype.concatIf = function(it, condition) {
6043
6064
  return condition ? `${this}${it}` : String(this);
6044
6065
  };
package/utils-studio.mjs CHANGED
@@ -574,7 +574,7 @@ var init_global = __esm({
574
574
  }
575
575
  });
576
576
 
577
- // node_modules/.pnpm/zod@3.23.4/node_modules/zod/lib/index.mjs
577
+ // node_modules/.pnpm/zod@3.23.6/node_modules/zod/lib/index.mjs
578
578
  function getErrorMap() {
579
579
  return overrideErrorMap;
580
580
  }
@@ -745,7 +745,7 @@ function createZodEnum(values, params) {
745
745
  }
746
746
  var util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, _ZodEnum_cache, _ZodNativeEnum_cache, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv6Regex, base64Regex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType;
747
747
  var init_lib = __esm({
748
- "node_modules/.pnpm/zod@3.23.4/node_modules/zod/lib/index.mjs"() {
748
+ "node_modules/.pnpm/zod@3.23.6/node_modules/zod/lib/index.mjs"() {
749
749
  (function(util2) {
750
750
  util2.assertEqual = (val) => val;
751
751
  function assertIs(_arg) {
@@ -4241,10 +4241,13 @@ var init_lib = __esm({
4241
4241
  ZodReadonly = class extends ZodType {
4242
4242
  _parse(input) {
4243
4243
  const result = this._def.innerType._parse(input);
4244
- if (isValid(result)) {
4245
- result.value = Object.freeze(result.value);
4246
- }
4247
- return result;
4244
+ const freeze = (data) => {
4245
+ if (isValid(data)) {
4246
+ data.value = Object.freeze(data.value);
4247
+ }
4248
+ return data;
4249
+ };
4250
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
4248
4251
  }
4249
4252
  unwrap() {
4250
4253
  return this._def.innerType;
@@ -4680,7 +4683,7 @@ var init_pgSchema = __esm({
4680
4683
  }).strict();
4681
4684
  pgSchemaInternal = objectType({
4682
4685
  version: literalType("6"),
4683
- dialect: literalType("pg"),
4686
+ dialect: literalType("postgresql"),
4684
4687
  tables: recordType(stringType(), table2),
4685
4688
  enums: recordType(stringType(), enumSchema),
4686
4689
  schemas: recordType(stringType(), stringType()),
@@ -4709,14 +4712,14 @@ var init_pgSchema = __esm({
4709
4712
  }).strict();
4710
4713
  pgSchemaSquashedV4 = objectType({
4711
4714
  version: literalType("4"),
4712
- dialect: enumType(["pg"]),
4715
+ dialect: literalType("pg"),
4713
4716
  tables: recordType(stringType(), tableSquashedV42),
4714
4717
  enums: recordType(stringType(), enumSchemaV1),
4715
4718
  schemas: recordType(stringType(), stringType())
4716
4719
  }).strict();
4717
4720
  pgSchemaSquashed = objectType({
4718
4721
  version: literalType("6"),
4719
- dialect: enumType(["pg"]),
4722
+ dialect: literalType("postgresql"),
4720
4723
  tables: recordType(stringType(), tableSquashed2),
4721
4724
  enums: recordType(stringType(), enumSchema),
4722
4725
  schemas: recordType(stringType(), stringType())
@@ -4728,7 +4731,7 @@ var init_pgSchema = __esm({
4728
4731
  backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema2]);
4729
4732
  dryPg = pgSchema2.parse({
4730
4733
  version: snapshotVersion,
4731
- dialect: "pg",
4734
+ dialect: "postgresql",
4732
4735
  id: originUUID,
4733
4736
  prevId: "",
4734
4737
  tables: {},
@@ -4744,7 +4747,7 @@ var init_pgSchema = __esm({
4744
4747
  });
4745
4748
 
4746
4749
  // src/serializer/sqliteSchema.ts
4747
- var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, latestVersion, schemaInternal2, schemaV32, schemaV42, schema2, tableSquashed3, schemaSquashed2, drySQLite;
4750
+ var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, schemaInternalV52, latestVersion, schemaInternal2, schemaV32, schemaV42, schemaV52, schema2, tableSquashed3, schemaSquashed2, drySQLite, sqliteSchemaV5, backwardCompatibleSqliteSchema;
4748
4751
  var init_sqliteSchema = __esm({
4749
4752
  "src/serializer/sqliteSchema.ts"() {
4750
4753
  "use strict";
@@ -4812,7 +4815,17 @@ var init_sqliteSchema = __esm({
4812
4815
  tables: recordType(stringType(), table3),
4813
4816
  enums: objectType({})
4814
4817
  }).strict();
4815
- latestVersion = literalType("5");
4818
+ schemaInternalV52 = objectType({
4819
+ version: literalType("5"),
4820
+ dialect: dialect2,
4821
+ tables: recordType(stringType(), table3),
4822
+ enums: objectType({}),
4823
+ _meta: objectType({
4824
+ tables: recordType(stringType(), stringType()),
4825
+ columns: recordType(stringType(), stringType())
4826
+ })
4827
+ }).strict();
4828
+ latestVersion = literalType("6");
4816
4829
  schemaInternal2 = objectType({
4817
4830
  version: latestVersion,
4818
4831
  dialect: dialect2,
@@ -4825,6 +4838,7 @@ var init_sqliteSchema = __esm({
4825
4838
  }).strict();
4826
4839
  schemaV32 = schemaInternalV32.merge(schemaHash3).strict();
4827
4840
  schemaV42 = schemaInternalV42.merge(schemaHash3).strict();
4841
+ schemaV52 = schemaInternalV52.merge(schemaHash3).strict();
4828
4842
  schema2 = schemaInternal2.merge(schemaHash3).strict();
4829
4843
  tableSquashed3 = objectType({
4830
4844
  name: stringType(),
@@ -4841,7 +4855,7 @@ var init_sqliteSchema = __esm({
4841
4855
  enums: anyType()
4842
4856
  }).strict();
4843
4857
  drySQLite = schema2.parse({
4844
- version: "5",
4858
+ version: "6",
4845
4859
  dialect: "sqlite",
4846
4860
  id: originUUID,
4847
4861
  prevId: "",
@@ -4852,6 +4866,8 @@ var init_sqliteSchema = __esm({
4852
4866
  columns: {}
4853
4867
  }
4854
4868
  });
4869
+ sqliteSchemaV5 = schemaV52;
4870
+ backwardCompatibleSqliteSchema = unionType([sqliteSchemaV5, schema2]);
4855
4871
  }
4856
4872
  });
4857
4873
 
@@ -4934,7 +4950,9 @@ function mapSqlToSqliteType(sqlType) {
4934
4950
  return "text";
4935
4951
  } else if (lowered.startsWith("blob")) {
4936
4952
  return "blob";
4937
- } else if (["real", "double", "double precision", "float"].some((it) => lowered.startsWith(it))) {
4953
+ } else if (["real", "double", "double precision", "float"].some(
4954
+ (it) => lowered.startsWith(it)
4955
+ )) {
4938
4956
  return "real";
4939
4957
  } else {
4940
4958
  return "numeric";
@@ -4953,7 +4971,7 @@ var init_sqliteSerializer = __esm({
4953
4971
  `SELECT
4954
4972
  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
4955
4973
  FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
4956
- 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';
4974
+ 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';
4957
4975
  `
4958
4976
  );
4959
4977
  const tablesWithSeq = [];
@@ -5131,7 +5149,7 @@ WHERE
5131
5149
  progressCallback("enums", 0, "done");
5132
5150
  }
5133
5151
  return {
5134
- version: "5",
5152
+ version: "6",
5135
5153
  dialect: "sqlite",
5136
5154
  tables: result,
5137
5155
  enums: {},
@@ -5566,7 +5584,7 @@ var init_pgSerializer = __esm({
5566
5584
  const columnName = columnResponse.attname;
5567
5585
  const columnAdditionalDT = columnResponse.additional_dt;
5568
5586
  const columnDimensions = columnResponse.array_dimensions;
5569
- const enumType2 = columnResponse.enum_name;
5587
+ const enumType3 = columnResponse.enum_name;
5570
5588
  let columnType = columnResponse.data_type;
5571
5589
  const primaryKey = tableConstraints.filter(
5572
5590
  (mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "PRIMARY KEY"
@@ -5630,8 +5648,8 @@ var init_pgSerializer = __esm({
5630
5648
  columnTypeMapped = trimChar(columnTypeMapped, '"');
5631
5649
  columnToReturn[columnName] = {
5632
5650
  name: columnName,
5633
- type: columnAdditionalDT === "USER-DEFINED" ? enumType2 : columnTypeMapped,
5634
- typeSchema: enumsToReturn[`${tableSchema}.${enumType2}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType2}`].schema : void 0,
5651
+ type: columnAdditionalDT === "USER-DEFINED" ? enumType3 : columnTypeMapped,
5652
+ typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
5635
5653
  primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
5636
5654
  // default: isSerial ? undefined : defaultValue,
5637
5655
  notNull: columnResponse.is_nullable === "NO"
@@ -5714,7 +5732,7 @@ var init_pgSerializer = __esm({
5714
5732
  const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
5715
5733
  return {
5716
5734
  version: "6",
5717
- dialect: "pg",
5735
+ dialect: "postgresql",
5718
5736
  tables: result,
5719
5737
  enums: enumsToReturn,
5720
5738
  schemas: schemasObject,
@@ -6075,6 +6093,9 @@ String.prototype.squashSpaces = function() {
6075
6093
  String.prototype.camelCase = function() {
6076
6094
  return camelCase(String(this));
6077
6095
  };
6096
+ String.prototype.capitalise = function() {
6097
+ return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
6098
+ };
6078
6099
  String.prototype.concatIf = function(it, condition) {
6079
6100
  return condition ? `${this}${it}` : String(this);
6080
6101
  };
package/utils.js CHANGED
@@ -1079,7 +1079,7 @@ var info = (msg, greyMsg = "") => {
1079
1079
  var originUUID = "00000000-0000-0000-0000-000000000000";
1080
1080
  var snapshotVersion = "6";
1081
1081
 
1082
- // node_modules/.pnpm/zod@3.23.4/node_modules/zod/lib/index.mjs
1082
+ // node_modules/.pnpm/zod@3.23.6/node_modules/zod/lib/index.mjs
1083
1083
  var util;
1084
1084
  (function(util2) {
1085
1085
  util2.assertEqual = (val) => val;
@@ -4749,10 +4749,13 @@ var ZodPipeline = class _ZodPipeline extends ZodType {
4749
4749
  var ZodReadonly = class extends ZodType {
4750
4750
  _parse(input) {
4751
4751
  const result = this._def.innerType._parse(input);
4752
- if (isValid(result)) {
4753
- result.value = Object.freeze(result.value);
4754
- }
4755
- return result;
4752
+ const freeze = (data) => {
4753
+ if (isValid(data)) {
4754
+ data.value = Object.freeze(data.value);
4755
+ }
4756
+ return data;
4757
+ };
4758
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
4756
4759
  }
4757
4760
  unwrap() {
4758
4761
  return this._def.innerType;
@@ -5173,7 +5176,7 @@ var pgSchemaExternal = objectType({
5173
5176
  }).strict();
5174
5177
  var pgSchemaInternal = objectType({
5175
5178
  version: literalType("6"),
5176
- dialect: literalType("pg"),
5179
+ dialect: literalType("postgresql"),
5177
5180
  tables: recordType(stringType(), table2),
5178
5181
  enums: recordType(stringType(), enumSchema),
5179
5182
  schemas: recordType(stringType(), stringType()),
@@ -5202,14 +5205,14 @@ var tableSquashedV42 = objectType({
5202
5205
  }).strict();
5203
5206
  var pgSchemaSquashedV4 = objectType({
5204
5207
  version: literalType("4"),
5205
- dialect: enumType(["pg"]),
5208
+ dialect: literalType("pg"),
5206
5209
  tables: recordType(stringType(), tableSquashedV42),
5207
5210
  enums: recordType(stringType(), enumSchemaV1),
5208
5211
  schemas: recordType(stringType(), stringType())
5209
5212
  }).strict();
5210
5213
  var pgSchemaSquashed = objectType({
5211
5214
  version: literalType("6"),
5212
- dialect: enumType(["pg"]),
5215
+ dialect: literalType("postgresql"),
5213
5216
  tables: recordType(stringType(), tableSquashed2),
5214
5217
  enums: recordType(stringType(), enumSchema),
5215
5218
  schemas: recordType(stringType(), stringType())
@@ -5221,7 +5224,7 @@ var pgSchema = pgSchemaInternal.merge(schemaHash2);
5221
5224
  var backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema]);
5222
5225
  var dryPg = pgSchema.parse({
5223
5226
  version: snapshotVersion,
5224
- dialect: "pg",
5227
+ dialect: "postgresql",
5225
5228
  id: originUUID,
5226
5229
  prevId: "",
5227
5230
  tables: {},
@@ -5297,7 +5300,17 @@ var schemaInternalV42 = objectType({
5297
5300
  tables: recordType(stringType(), table3),
5298
5301
  enums: objectType({})
5299
5302
  }).strict();
5300
- var latestVersion = literalType("5");
5303
+ var schemaInternalV52 = objectType({
5304
+ version: literalType("5"),
5305
+ dialect: dialect2,
5306
+ tables: recordType(stringType(), table3),
5307
+ enums: objectType({}),
5308
+ _meta: objectType({
5309
+ tables: recordType(stringType(), stringType()),
5310
+ columns: recordType(stringType(), stringType())
5311
+ })
5312
+ }).strict();
5313
+ var latestVersion = literalType("6");
5301
5314
  var schemaInternal2 = objectType({
5302
5315
  version: latestVersion,
5303
5316
  dialect: dialect2,
@@ -5310,6 +5323,7 @@ var schemaInternal2 = objectType({
5310
5323
  }).strict();
5311
5324
  var schemaV32 = schemaInternalV32.merge(schemaHash3).strict();
5312
5325
  var schemaV42 = schemaInternalV42.merge(schemaHash3).strict();
5326
+ var schemaV52 = schemaInternalV52.merge(schemaHash3).strict();
5313
5327
  var schema2 = schemaInternal2.merge(schemaHash3).strict();
5314
5328
  var tableSquashed3 = objectType({
5315
5329
  name: stringType(),
@@ -5326,7 +5340,7 @@ var schemaSquashed2 = objectType({
5326
5340
  enums: anyType()
5327
5341
  }).strict();
5328
5342
  var drySQLite = schema2.parse({
5329
- version: "5",
5343
+ version: "6",
5330
5344
  dialect: "sqlite",
5331
5345
  id: originUUID,
5332
5346
  prevId: "",
@@ -5337,7 +5351,8 @@ var drySQLite = schema2.parse({
5337
5351
  columns: {}
5338
5352
  }
5339
5353
  });
5340
- var backwardCompatibleSqliteSchema = schema2;
5354
+ var sqliteSchemaV5 = schemaV52;
5355
+ var backwardCompatibleSqliteSchema = unionType([sqliteSchemaV5, schema2]);
5341
5356
 
5342
5357
  // src/utils.ts
5343
5358
  var import_path = require("path");
@@ -5383,10 +5398,10 @@ var prepareOutFolder = (out, dialect3) => {
5383
5398
  };
5384
5399
  var validatorForDialect = (dialect3) => {
5385
5400
  switch (dialect3) {
5386
- case "pg":
5401
+ case "postgresql":
5387
5402
  return { validator: backwardCompatiblePgSchema, version: 6 };
5388
5403
  case "sqlite":
5389
- return { validator: backwardCompatibleSqliteSchema, version: 5 };
5404
+ return { validator: backwardCompatibleSqliteSchema, version: 6 };
5390
5405
  case "mysql":
5391
5406
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
5392
5407
  }
@@ -5407,6 +5422,7 @@ var validateWithReport = (snapshots, dialect3) => {
5407
5422
  }
5408
5423
  const result2 = validator.safeParse(raw);
5409
5424
  if (!result2.success) {
5425
+ console.error(result2.error);
5410
5426
  accum.malformed.push(it);
5411
5427
  return accum;
5412
5428
  }
package/utils.mjs CHANGED
@@ -1070,7 +1070,7 @@ var info = (msg, greyMsg = "") => {
1070
1070
  var originUUID = "00000000-0000-0000-0000-000000000000";
1071
1071
  var snapshotVersion = "6";
1072
1072
 
1073
- // node_modules/.pnpm/zod@3.23.4/node_modules/zod/lib/index.mjs
1073
+ // node_modules/.pnpm/zod@3.23.6/node_modules/zod/lib/index.mjs
1074
1074
  var util;
1075
1075
  (function(util2) {
1076
1076
  util2.assertEqual = (val) => val;
@@ -4740,10 +4740,13 @@ var ZodPipeline = class _ZodPipeline extends ZodType {
4740
4740
  var ZodReadonly = class extends ZodType {
4741
4741
  _parse(input) {
4742
4742
  const result = this._def.innerType._parse(input);
4743
- if (isValid(result)) {
4744
- result.value = Object.freeze(result.value);
4745
- }
4746
- return result;
4743
+ const freeze = (data) => {
4744
+ if (isValid(data)) {
4745
+ data.value = Object.freeze(data.value);
4746
+ }
4747
+ return data;
4748
+ };
4749
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
4747
4750
  }
4748
4751
  unwrap() {
4749
4752
  return this._def.innerType;
@@ -5164,7 +5167,7 @@ var pgSchemaExternal = objectType({
5164
5167
  }).strict();
5165
5168
  var pgSchemaInternal = objectType({
5166
5169
  version: literalType("6"),
5167
- dialect: literalType("pg"),
5170
+ dialect: literalType("postgresql"),
5168
5171
  tables: recordType(stringType(), table2),
5169
5172
  enums: recordType(stringType(), enumSchema),
5170
5173
  schemas: recordType(stringType(), stringType()),
@@ -5193,14 +5196,14 @@ var tableSquashedV42 = objectType({
5193
5196
  }).strict();
5194
5197
  var pgSchemaSquashedV4 = objectType({
5195
5198
  version: literalType("4"),
5196
- dialect: enumType(["pg"]),
5199
+ dialect: literalType("pg"),
5197
5200
  tables: recordType(stringType(), tableSquashedV42),
5198
5201
  enums: recordType(stringType(), enumSchemaV1),
5199
5202
  schemas: recordType(stringType(), stringType())
5200
5203
  }).strict();
5201
5204
  var pgSchemaSquashed = objectType({
5202
5205
  version: literalType("6"),
5203
- dialect: enumType(["pg"]),
5206
+ dialect: literalType("postgresql"),
5204
5207
  tables: recordType(stringType(), tableSquashed2),
5205
5208
  enums: recordType(stringType(), enumSchema),
5206
5209
  schemas: recordType(stringType(), stringType())
@@ -5212,7 +5215,7 @@ var pgSchema = pgSchemaInternal.merge(schemaHash2);
5212
5215
  var backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema]);
5213
5216
  var dryPg = pgSchema.parse({
5214
5217
  version: snapshotVersion,
5215
- dialect: "pg",
5218
+ dialect: "postgresql",
5216
5219
  id: originUUID,
5217
5220
  prevId: "",
5218
5221
  tables: {},
@@ -5288,7 +5291,17 @@ var schemaInternalV42 = objectType({
5288
5291
  tables: recordType(stringType(), table3),
5289
5292
  enums: objectType({})
5290
5293
  }).strict();
5291
- var latestVersion = literalType("5");
5294
+ var schemaInternalV52 = objectType({
5295
+ version: literalType("5"),
5296
+ dialect: dialect2,
5297
+ tables: recordType(stringType(), table3),
5298
+ enums: objectType({}),
5299
+ _meta: objectType({
5300
+ tables: recordType(stringType(), stringType()),
5301
+ columns: recordType(stringType(), stringType())
5302
+ })
5303
+ }).strict();
5304
+ var latestVersion = literalType("6");
5292
5305
  var schemaInternal2 = objectType({
5293
5306
  version: latestVersion,
5294
5307
  dialect: dialect2,
@@ -5301,6 +5314,7 @@ var schemaInternal2 = objectType({
5301
5314
  }).strict();
5302
5315
  var schemaV32 = schemaInternalV32.merge(schemaHash3).strict();
5303
5316
  var schemaV42 = schemaInternalV42.merge(schemaHash3).strict();
5317
+ var schemaV52 = schemaInternalV52.merge(schemaHash3).strict();
5304
5318
  var schema2 = schemaInternal2.merge(schemaHash3).strict();
5305
5319
  var tableSquashed3 = objectType({
5306
5320
  name: stringType(),
@@ -5317,7 +5331,7 @@ var schemaSquashed2 = objectType({
5317
5331
  enums: anyType()
5318
5332
  }).strict();
5319
5333
  var drySQLite = schema2.parse({
5320
- version: "5",
5334
+ version: "6",
5321
5335
  dialect: "sqlite",
5322
5336
  id: originUUID,
5323
5337
  prevId: "",
@@ -5328,7 +5342,8 @@ var drySQLite = schema2.parse({
5328
5342
  columns: {}
5329
5343
  }
5330
5344
  });
5331
- var backwardCompatibleSqliteSchema = schema2;
5345
+ var sqliteSchemaV5 = schemaV52;
5346
+ var backwardCompatibleSqliteSchema = unionType([sqliteSchemaV5, schema2]);
5332
5347
 
5333
5348
  // src/utils.ts
5334
5349
  import { join } from "path";
@@ -5374,10 +5389,10 @@ var prepareOutFolder = (out, dialect3) => {
5374
5389
  };
5375
5390
  var validatorForDialect = (dialect3) => {
5376
5391
  switch (dialect3) {
5377
- case "pg":
5392
+ case "postgresql":
5378
5393
  return { validator: backwardCompatiblePgSchema, version: 6 };
5379
5394
  case "sqlite":
5380
- return { validator: backwardCompatibleSqliteSchema, version: 5 };
5395
+ return { validator: backwardCompatibleSqliteSchema, version: 6 };
5381
5396
  case "mysql":
5382
5397
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
5383
5398
  }
@@ -5398,6 +5413,7 @@ var validateWithReport = (snapshots, dialect3) => {
5398
5413
  }
5399
5414
  const result2 = validator.safeParse(raw);
5400
5415
  if (!result2.success) {
5416
+ console.error(result2.error);
5401
5417
  accum.malformed.push(it);
5402
5418
  return accum;
5403
5419
  }
package/@types/utils.d.ts DELETED
@@ -1,12 +0,0 @@
1
- declare global {
2
- interface String {
3
- trimChar(char: string): string;
4
- squashSpaces(): string;
5
- camelCase(): string;
6
- concatIf(it: string, condition: boolean): string;
7
- }
8
- interface Array<T> {
9
- random(): T;
10
- }
11
- }
12
- export {};