drizzle-kit 0.20.17-c8aaf94 → 0.20.17-f1d07ae

Sign up to get free protection for your applications and to get access to all the features.
@@ -2063,7 +2063,7 @@ export declare const pgSchemaExternal: import("zod").ZodObject<{
2063
2063
  }>;
2064
2064
  export declare const pgSchemaInternal: import("zod").ZodObject<{
2065
2065
  version: import("zod").ZodLiteral<"6">;
2066
- dialect: import("zod").ZodLiteral<"postgresql">;
2066
+ dialect: import("zod").ZodLiteral<"pg">;
2067
2067
  tables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
2068
2068
  name: import("zod").ZodString;
2069
2069
  schema: import("zod").ZodString;
@@ -2361,7 +2361,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
2361
2361
  }>;
2362
2362
  }>;
2363
2363
  version: "6";
2364
- dialect: "postgresql";
2364
+ dialect: "pg";
2365
2365
  schemas: Record<string, string>;
2366
2366
  _meta: {
2367
2367
  columns: Record<string, string>;
@@ -2423,7 +2423,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
2423
2423
  }>;
2424
2424
  }>;
2425
2425
  version: "6";
2426
- dialect: "postgresql";
2426
+ dialect: "pg";
2427
2427
  schemas: Record<string, string>;
2428
2428
  _meta: {
2429
2429
  columns: Record<string, string>;
@@ -2438,7 +2438,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
2438
2438
  }>;
2439
2439
  export declare const pgSchemaSquashedV4: import("zod").ZodObject<{
2440
2440
  version: import("zod").ZodLiteral<"4">;
2441
- dialect: import("zod").ZodLiteral<"pg">;
2441
+ dialect: import("zod").ZodEnum<["pg"]>;
2442
2442
  tables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
2443
2443
  name: import("zod").ZodString;
2444
2444
  schema: import("zod").ZodString;
@@ -2572,7 +2572,7 @@ export declare const pgSchemaSquashedV4: import("zod").ZodObject<{
2572
2572
  }>;
2573
2573
  export declare const pgSchemaSquashed: import("zod").ZodObject<{
2574
2574
  version: import("zod").ZodLiteral<"6">;
2575
- dialect: import("zod").ZodLiteral<"postgresql">;
2575
+ dialect: import("zod").ZodEnum<["pg"]>;
2576
2576
  tables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
2577
2577
  name: import("zod").ZodString;
2578
2578
  schema: import("zod").ZodString;
@@ -2683,7 +2683,7 @@ export declare const pgSchemaSquashed: import("zod").ZodObject<{
2683
2683
  uniqueConstraints: Record<string, string>;
2684
2684
  }>;
2685
2685
  version: "6";
2686
- dialect: "postgresql";
2686
+ dialect: "pg";
2687
2687
  schemas: Record<string, string>;
2688
2688
  enums: Record<string, {
2689
2689
  name: string;
@@ -2711,7 +2711,7 @@ export declare const pgSchemaSquashed: import("zod").ZodObject<{
2711
2711
  uniqueConstraints: Record<string, string>;
2712
2712
  }>;
2713
2713
  version: "6";
2714
- dialect: "postgresql";
2714
+ dialect: "pg";
2715
2715
  schemas: Record<string, string>;
2716
2716
  enums: Record<string, {
2717
2717
  name: string;
@@ -3554,7 +3554,7 @@ export declare const pgSchemaV5: import("zod").ZodObject<import("zod").extendSha
3554
3554
  }>;
3555
3555
  export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape<{
3556
3556
  version: import("zod").ZodLiteral<"6">;
3557
- dialect: import("zod").ZodLiteral<"postgresql">;
3557
+ dialect: import("zod").ZodLiteral<"pg">;
3558
3558
  tables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
3559
3559
  name: import("zod").ZodString;
3560
3560
  schema: import("zod").ZodString;
@@ -3857,7 +3857,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
3857
3857
  id: string;
3858
3858
  prevId: string;
3859
3859
  version: "6";
3860
- dialect: "postgresql";
3860
+ dialect: "pg";
3861
3861
  schemas: Record<string, string>;
3862
3862
  _meta: {
3863
3863
  columns: Record<string, string>;
@@ -3921,7 +3921,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
3921
3921
  id: string;
3922
3922
  prevId: string;
3923
3923
  version: "6";
3924
- dialect: "postgresql";
3924
+ dialect: "pg";
3925
3925
  schemas: Record<string, string>;
3926
3926
  _meta: {
3927
3927
  columns: Record<string, string>;
@@ -4332,7 +4332,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
4332
4332
  }>;
4333
4333
  }>, import("zod").ZodObject<import("zod").extendShape<{
4334
4334
  version: import("zod").ZodLiteral<"6">;
4335
- dialect: import("zod").ZodLiteral<"postgresql">;
4335
+ dialect: import("zod").ZodLiteral<"pg">;
4336
4336
  tables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
4337
4337
  name: import("zod").ZodString;
4338
4338
  schema: import("zod").ZodString;
@@ -4635,7 +4635,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
4635
4635
  id: string;
4636
4636
  prevId: string;
4637
4637
  version: "6";
4638
- dialect: "postgresql";
4638
+ dialect: "pg";
4639
4639
  schemas: Record<string, string>;
4640
4640
  _meta: {
4641
4641
  columns: Record<string, string>;
@@ -4699,7 +4699,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
4699
4699
  id: string;
4700
4700
  prevId: string;
4701
4701
  version: "6";
4702
- dialect: "postgresql";
4702
+ dialect: "pg";
4703
4703
  schemas: Record<string, string>;
4704
4704
  _meta: {
4705
4705
  columns: Record<string, string>;
@@ -4776,7 +4776,7 @@ export declare const dryPg: {
4776
4776
  id: string;
4777
4777
  prevId: string;
4778
4778
  version: "6";
4779
- dialect: "postgresql";
4779
+ dialect: "pg";
4780
4780
  schemas: Record<string, string>;
4781
4781
  _meta: {
4782
4782
  columns: Record<string, string>;
@@ -13,7 +13,7 @@ type CustomDefault = {
13
13
  func: () => unknown;
14
14
  };
15
15
  export type Setup = {
16
- dialect: "postgresql" | "mysql" | "sqlite";
16
+ dialect: "pg" | "mysql" | "sqlite";
17
17
  proxy: (params: ProxyParams) => Promise<any[] | any>;
18
18
  customDefaults: CustomDefault[];
19
19
  };
@@ -1,6 +1,6 @@
1
1
  import { TypeOf, ZodTypeAny } from "zod";
2
2
  import { JsonStatement } from "./jsonStatements";
3
- import { SQLiteSchemaSquashed } from "./serializer/sqliteSchema";
3
+ import { SQLiteSchema, SQLiteSchemaSquashed } from "./serializer/sqliteSchema";
4
4
  import { MySqlSchema, MySqlSchemaSquashed } from "./serializer/mysqlSchema";
5
5
  import { PgSchema, PgSchemaSquashed } from "./serializer/pgSchema";
6
6
  import { Named } from "./cli/commands/migrate";
@@ -3906,6 +3906,7 @@ export interface ColumnsResolverOutput<T extends {
3906
3906
  }[];
3907
3907
  deleted: T[];
3908
3908
  }
3909
+ export type SchemaFrom<D> = D extends "pg" ? PgSchema : D extends "mysql" ? MySqlSchema : D extends "sqlite" ? SQLiteSchema : undefined;
3909
3910
  export declare const applyPgSnapshotsDiff: (json1: PgSchemaSquashed, json2: PgSchemaSquashed, schemasResolver: (input: ResolverInput<Named>) => Promise<ResolverOutput<Named>>, enumsResolver: (input: ResolverInput<Enum>) => Promise<ResolverOutputWithMoved<Enum>>, tablesResolver: (input: ResolverInput<Table>) => Promise<ResolverOutputWithMoved<Table>>, columnsResolver: (input: ColumnsResolverInput<Column>) => Promise<ColumnsResolverOutput<Column>>, prevFull: PgSchema, curFull: PgSchema) => Promise<{
3910
3911
  statements: JsonStatement[];
3911
3912
  sqlStatements: string[];
package/utils-studio.js CHANGED
@@ -4567,7 +4567,7 @@ var init_pgSchema = __esm({
4567
4567
  }).strict();
4568
4568
  pgSchemaInternal = objectType({
4569
4569
  version: literalType("6"),
4570
- dialect: literalType("postgresql"),
4570
+ dialect: literalType("pg"),
4571
4571
  tables: recordType(stringType(), table2),
4572
4572
  enums: recordType(stringType(), enumSchema),
4573
4573
  schemas: recordType(stringType(), stringType()),
@@ -4596,14 +4596,14 @@ var init_pgSchema = __esm({
4596
4596
  }).strict();
4597
4597
  pgSchemaSquashedV4 = objectType({
4598
4598
  version: literalType("4"),
4599
- dialect: literalType("pg"),
4599
+ dialect: enumType(["pg"]),
4600
4600
  tables: recordType(stringType(), tableSquashedV42),
4601
4601
  enums: recordType(stringType(), enumSchemaV1),
4602
4602
  schemas: recordType(stringType(), stringType())
4603
4603
  }).strict();
4604
4604
  pgSchemaSquashed = objectType({
4605
4605
  version: literalType("6"),
4606
- dialect: literalType("postgresql"),
4606
+ dialect: enumType(["pg"]),
4607
4607
  tables: recordType(stringType(), tableSquashed2),
4608
4608
  enums: recordType(stringType(), enumSchema),
4609
4609
  schemas: recordType(stringType(), stringType())
@@ -4615,7 +4615,7 @@ var init_pgSchema = __esm({
4615
4615
  backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema2]);
4616
4616
  dryPg = pgSchema2.parse({
4617
4617
  version: snapshotVersion,
4618
- dialect: "postgresql",
4618
+ dialect: "pg",
4619
4619
  id: originUUID,
4620
4620
  prevId: "",
4621
4621
  tables: {},
@@ -5451,7 +5451,7 @@ var init_pgSerializer = __esm({
5451
5451
  const columnName = columnResponse.attname;
5452
5452
  const columnAdditionalDT = columnResponse.additional_dt;
5453
5453
  const columnDimensions = columnResponse.array_dimensions;
5454
- const enumType3 = columnResponse.enum_name;
5454
+ const enumType2 = columnResponse.enum_name;
5455
5455
  let columnType = columnResponse.data_type;
5456
5456
  const primaryKey = tableConstraints.filter(
5457
5457
  (mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "PRIMARY KEY"
@@ -5515,8 +5515,8 @@ var init_pgSerializer = __esm({
5515
5515
  columnTypeMapped = trimChar(columnTypeMapped, '"');
5516
5516
  columnToReturn[columnName] = {
5517
5517
  name: columnName,
5518
- type: columnAdditionalDT === "USER-DEFINED" ? enumType3 : columnTypeMapped,
5519
- typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
5518
+ type: columnAdditionalDT === "USER-DEFINED" ? enumType2 : columnTypeMapped,
5519
+ typeSchema: enumsToReturn[`${tableSchema}.${enumType2}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType2}`].schema : void 0,
5520
5520
  primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
5521
5521
  // default: isSerial ? undefined : defaultValue,
5522
5522
  notNull: columnResponse.is_nullable === "NO"
@@ -5599,7 +5599,7 @@ var init_pgSerializer = __esm({
5599
5599
  const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
5600
5600
  return {
5601
5601
  version: "6",
5602
- dialect: "postgresql",
5602
+ dialect: "pg",
5603
5603
  tables: result,
5604
5604
  enums: enumsToReturn,
5605
5605
  schemas: schemasObject,
@@ -5933,9 +5933,6 @@ String.prototype.squashSpaces = function() {
5933
5933
  String.prototype.camelCase = function() {
5934
5934
  return camelCase(String(this));
5935
5935
  };
5936
- String.prototype.capitalise = function() {
5937
- return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
5938
- };
5939
5936
  String.prototype.concatIf = function(it, condition) {
5940
5937
  return condition ? `${this}${it}` : String(this);
5941
5938
  };
package/utils-studio.mjs CHANGED
@@ -4568,7 +4568,7 @@ var init_pgSchema = __esm({
4568
4568
  }).strict();
4569
4569
  pgSchemaInternal = objectType({
4570
4570
  version: literalType("6"),
4571
- dialect: literalType("postgresql"),
4571
+ dialect: literalType("pg"),
4572
4572
  tables: recordType(stringType(), table2),
4573
4573
  enums: recordType(stringType(), enumSchema),
4574
4574
  schemas: recordType(stringType(), stringType()),
@@ -4597,14 +4597,14 @@ var init_pgSchema = __esm({
4597
4597
  }).strict();
4598
4598
  pgSchemaSquashedV4 = objectType({
4599
4599
  version: literalType("4"),
4600
- dialect: literalType("pg"),
4600
+ dialect: enumType(["pg"]),
4601
4601
  tables: recordType(stringType(), tableSquashedV42),
4602
4602
  enums: recordType(stringType(), enumSchemaV1),
4603
4603
  schemas: recordType(stringType(), stringType())
4604
4604
  }).strict();
4605
4605
  pgSchemaSquashed = objectType({
4606
4606
  version: literalType("6"),
4607
- dialect: literalType("postgresql"),
4607
+ dialect: enumType(["pg"]),
4608
4608
  tables: recordType(stringType(), tableSquashed2),
4609
4609
  enums: recordType(stringType(), enumSchema),
4610
4610
  schemas: recordType(stringType(), stringType())
@@ -4616,7 +4616,7 @@ var init_pgSchema = __esm({
4616
4616
  backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema2]);
4617
4617
  dryPg = pgSchema2.parse({
4618
4618
  version: snapshotVersion,
4619
- dialect: "postgresql",
4619
+ dialect: "pg",
4620
4620
  id: originUUID,
4621
4621
  prevId: "",
4622
4622
  tables: {},
@@ -5460,7 +5460,7 @@ var init_pgSerializer = __esm({
5460
5460
  const columnName = columnResponse.attname;
5461
5461
  const columnAdditionalDT = columnResponse.additional_dt;
5462
5462
  const columnDimensions = columnResponse.array_dimensions;
5463
- const enumType3 = columnResponse.enum_name;
5463
+ const enumType2 = columnResponse.enum_name;
5464
5464
  let columnType = columnResponse.data_type;
5465
5465
  const primaryKey = tableConstraints.filter(
5466
5466
  (mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "PRIMARY KEY"
@@ -5524,8 +5524,8 @@ var init_pgSerializer = __esm({
5524
5524
  columnTypeMapped = trimChar(columnTypeMapped, '"');
5525
5525
  columnToReturn[columnName] = {
5526
5526
  name: columnName,
5527
- type: columnAdditionalDT === "USER-DEFINED" ? enumType3 : columnTypeMapped,
5528
- typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
5527
+ type: columnAdditionalDT === "USER-DEFINED" ? enumType2 : columnTypeMapped,
5528
+ typeSchema: enumsToReturn[`${tableSchema}.${enumType2}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType2}`].schema : void 0,
5529
5529
  primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
5530
5530
  // default: isSerial ? undefined : defaultValue,
5531
5531
  notNull: columnResponse.is_nullable === "NO"
@@ -5608,7 +5608,7 @@ var init_pgSerializer = __esm({
5608
5608
  const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
5609
5609
  return {
5610
5610
  version: "6",
5611
- dialect: "postgresql",
5611
+ dialect: "pg",
5612
5612
  tables: result,
5613
5613
  enums: enumsToReturn,
5614
5614
  schemas: schemasObject,
@@ -5969,9 +5969,6 @@ String.prototype.squashSpaces = function() {
5969
5969
  String.prototype.camelCase = function() {
5970
5970
  return camelCase(String(this));
5971
5971
  };
5972
- String.prototype.capitalise = function() {
5973
- return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
5974
- };
5975
5972
  String.prototype.concatIf = function(it, condition) {
5976
5973
  return condition ? `${this}${it}` : String(this);
5977
5974
  };
package/utils.js CHANGED
@@ -4548,7 +4548,7 @@ var pgSchemaExternal = objectType({
4548
4548
  }).strict();
4549
4549
  var pgSchemaInternal = objectType({
4550
4550
  version: literalType("6"),
4551
- dialect: literalType("postgresql"),
4551
+ dialect: literalType("pg"),
4552
4552
  tables: recordType(stringType(), table2),
4553
4553
  enums: recordType(stringType(), enumSchema),
4554
4554
  schemas: recordType(stringType(), stringType()),
@@ -4577,14 +4577,14 @@ var tableSquashedV42 = objectType({
4577
4577
  }).strict();
4578
4578
  var pgSchemaSquashedV4 = objectType({
4579
4579
  version: literalType("4"),
4580
- dialect: literalType("pg"),
4580
+ dialect: enumType(["pg"]),
4581
4581
  tables: recordType(stringType(), tableSquashedV42),
4582
4582
  enums: recordType(stringType(), enumSchemaV1),
4583
4583
  schemas: recordType(stringType(), stringType())
4584
4584
  }).strict();
4585
4585
  var pgSchemaSquashed = objectType({
4586
4586
  version: literalType("6"),
4587
- dialect: literalType("postgresql"),
4587
+ dialect: enumType(["pg"]),
4588
4588
  tables: recordType(stringType(), tableSquashed2),
4589
4589
  enums: recordType(stringType(), enumSchema),
4590
4590
  schemas: recordType(stringType(), stringType())
@@ -4596,7 +4596,7 @@ var pgSchema = pgSchemaInternal.merge(schemaHash2);
4596
4596
  var backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema]);
4597
4597
  var dryPg = pgSchema.parse({
4598
4598
  version: snapshotVersion,
4599
- dialect: "postgresql",
4599
+ dialect: "pg",
4600
4600
  id: originUUID,
4601
4601
  prevId: "",
4602
4602
  tables: {},
@@ -4758,7 +4758,7 @@ var prepareOutFolder = (out, dialect3) => {
4758
4758
  };
4759
4759
  var validatorForDialect = (dialect3) => {
4760
4760
  switch (dialect3) {
4761
- case "postgresql":
4761
+ case "pg":
4762
4762
  return { validator: backwardCompatiblePgSchema, version: 6 };
4763
4763
  case "sqlite":
4764
4764
  return { validator: backwardCompatibleSqliteSchema, version: 5 };
package/utils.mjs CHANGED
@@ -4539,7 +4539,7 @@ var pgSchemaExternal = objectType({
4539
4539
  }).strict();
4540
4540
  var pgSchemaInternal = objectType({
4541
4541
  version: literalType("6"),
4542
- dialect: literalType("postgresql"),
4542
+ dialect: literalType("pg"),
4543
4543
  tables: recordType(stringType(), table2),
4544
4544
  enums: recordType(stringType(), enumSchema),
4545
4545
  schemas: recordType(stringType(), stringType()),
@@ -4568,14 +4568,14 @@ var tableSquashedV42 = objectType({
4568
4568
  }).strict();
4569
4569
  var pgSchemaSquashedV4 = objectType({
4570
4570
  version: literalType("4"),
4571
- dialect: literalType("pg"),
4571
+ dialect: enumType(["pg"]),
4572
4572
  tables: recordType(stringType(), tableSquashedV42),
4573
4573
  enums: recordType(stringType(), enumSchemaV1),
4574
4574
  schemas: recordType(stringType(), stringType())
4575
4575
  }).strict();
4576
4576
  var pgSchemaSquashed = objectType({
4577
4577
  version: literalType("6"),
4578
- dialect: literalType("postgresql"),
4578
+ dialect: enumType(["pg"]),
4579
4579
  tables: recordType(stringType(), tableSquashed2),
4580
4580
  enums: recordType(stringType(), enumSchema),
4581
4581
  schemas: recordType(stringType(), stringType())
@@ -4587,7 +4587,7 @@ var pgSchema = pgSchemaInternal.merge(schemaHash2);
4587
4587
  var backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema]);
4588
4588
  var dryPg = pgSchema.parse({
4589
4589
  version: snapshotVersion,
4590
- dialect: "postgresql",
4590
+ dialect: "pg",
4591
4591
  id: originUUID,
4592
4592
  prevId: "",
4593
4593
  tables: {},
@@ -4749,7 +4749,7 @@ var prepareOutFolder = (out, dialect3) => {
4749
4749
  };
4750
4750
  var validatorForDialect = (dialect3) => {
4751
4751
  switch (dialect3) {
4752
- case "postgresql":
4752
+ case "pg":
4753
4753
  return { validator: backwardCompatiblePgSchema, version: 6 };
4754
4754
  case "sqlite":
4755
4755
  return { validator: backwardCompatibleSqliteSchema, version: 5 };