drizzle-kit 0.20.17-c057923 → 0.20.17-e041df8

Sign up to get free protection for your applications and to get access to all the features.
package/payload.mjs CHANGED
@@ -4701,7 +4701,7 @@ var init_pgSchema = __esm({
4701
4701
  }).strict();
4702
4702
  pgSchemaInternal = objectType({
4703
4703
  version: literalType("6"),
4704
- dialect: literalType("postgresql"),
4704
+ dialect: literalType("pg"),
4705
4705
  tables: recordType(stringType(), table2),
4706
4706
  enums: recordType(stringType(), enumSchema),
4707
4707
  schemas: recordType(stringType(), stringType()),
@@ -4730,14 +4730,14 @@ var init_pgSchema = __esm({
4730
4730
  }).strict();
4731
4731
  pgSchemaSquashedV4 = objectType({
4732
4732
  version: literalType("4"),
4733
- dialect: literalType("pg"),
4733
+ dialect: enumType(["pg"]),
4734
4734
  tables: recordType(stringType(), tableSquashedV42),
4735
4735
  enums: recordType(stringType(), enumSchemaV1),
4736
4736
  schemas: recordType(stringType(), stringType())
4737
4737
  }).strict();
4738
4738
  pgSchemaSquashed = objectType({
4739
4739
  version: literalType("6"),
4740
- dialect: literalType("postgresql"),
4740
+ dialect: enumType(["pg"]),
4741
4741
  tables: recordType(stringType(), tableSquashed2),
4742
4742
  enums: recordType(stringType(), enumSchema),
4743
4743
  schemas: recordType(stringType(), stringType())
@@ -4848,7 +4848,7 @@ var init_pgSchema = __esm({
4848
4848
  };
4849
4849
  dryPg = pgSchema.parse({
4850
4850
  version: snapshotVersion,
4851
- dialect: "postgresql",
4851
+ dialect: "pg",
4852
4852
  id: originUUID,
4853
4853
  prevId: "",
4854
4854
  tables: {},
@@ -5311,8 +5311,7 @@ var init_outputs = __esm({
5311
5311
  warning: (str) => `${source_default.white.bgGray(" Warning ")} ${str}`,
5312
5312
  errorWarning: (str) => `${source_default.red(`${source_default.white.bgRed(" Warning ")} ${str}`)}`,
5313
5313
  fullWarning: (str) => `${source_default.black.bgYellow("[Warning]")} ${source_default.bold(str)}`,
5314
- suggestion: (str) => `${source_default.white.bgGray(" Suggestion ")} ${str}`,
5315
- info: (str) => `${source_default.grey(str)}`
5314
+ suggestion: (str) => `${source_default.white.bgGray(" Suggestion ")} ${str}`
5316
5315
  };
5317
5316
  }
5318
5317
  });
@@ -5397,7 +5396,7 @@ var init_schemaValidator = __esm({
5397
5396
  init_mysqlSchema();
5398
5397
  init_pgSchema();
5399
5398
  init_sqliteSchema();
5400
- dialect3 = enumType(["postgresql", "mysql", "sqlite"]);
5399
+ dialect3 = enumType(["pg", "mysql", "sqlite"]);
5401
5400
  commonSquashedSchema = unionType([
5402
5401
  pgSchemaSquashed,
5403
5402
  mysqlSchemaSquashed,
@@ -5518,7 +5517,7 @@ var init_cli = __esm({
5518
5517
  schema: unionType([stringType(), stringType().array()]).optional(),
5519
5518
  tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5520
5519
  schemaFilters: unionType([stringType(), stringType().array()]).optional().default(["public"]),
5521
- driver: stringType().optional(),
5520
+ driver: stringType(),
5522
5521
  // pg
5523
5522
  connectionString: stringType().optional(),
5524
5523
  // mysql
@@ -11516,7 +11515,7 @@ ${withStyle.errorWarning(
11516
11515
  );
11517
11516
  return {
11518
11517
  version: "6",
11519
- dialect: "postgresql",
11518
+ dialect: "pg",
11520
11519
  tables: result,
11521
11520
  enums: enumsToReturn,
11522
11521
  schemas: schemasObject,
@@ -11723,7 +11722,7 @@ ${withStyle.errorWarning(
11723
11722
  const columnName = columnResponse.attname;
11724
11723
  const columnAdditionalDT = columnResponse.additional_dt;
11725
11724
  const columnDimensions = columnResponse.array_dimensions;
11726
- const enumType3 = columnResponse.enum_name;
11725
+ const enumType2 = columnResponse.enum_name;
11727
11726
  let columnType = columnResponse.data_type;
11728
11727
  const primaryKey = tableConstraints.filter(
11729
11728
  (mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "PRIMARY KEY"
@@ -11787,8 +11786,8 @@ ${withStyle.errorWarning(
11787
11786
  columnTypeMapped = trimChar(columnTypeMapped, '"');
11788
11787
  columnToReturn[columnName] = {
11789
11788
  name: columnName,
11790
- type: columnAdditionalDT === "USER-DEFINED" ? enumType3 : columnTypeMapped,
11791
- typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
11789
+ type: columnAdditionalDT === "USER-DEFINED" ? enumType2 : columnTypeMapped,
11790
+ typeSchema: enumsToReturn[`${tableSchema}.${enumType2}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType2}`].schema : void 0,
11792
11791
  primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
11793
11792
  // default: isSerial ? undefined : defaultValue,
11794
11793
  notNull: columnResponse.is_nullable === "NO"
@@ -11871,7 +11870,7 @@ ${withStyle.errorWarning(
11871
11870
  const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
11872
11871
  return {
11873
11872
  version: "6",
11874
- dialect: "postgresql",
11873
+ dialect: "pg",
11875
11874
  tables: result,
11876
11875
  enums: enumsToReturn,
11877
11876
  schemas: schemasObject,
@@ -15214,7 +15213,7 @@ var init_snapshotsDiffer = __esm({
15214
15213
  jsonStatements.push(...jsonAlteredUniqueConstraints);
15215
15214
  jsonStatements.push(...dropEnums);
15216
15215
  jsonStatements.push(...dropSchemas);
15217
- const sqlStatements = fromJson(jsonStatements, "postgresql");
15216
+ const sqlStatements = fromJson(jsonStatements, "pg");
15218
15217
  const uniqueSqlStatements = [];
15219
15218
  sqlStatements.forEach((ss) => {
15220
15219
  if (!uniqueSqlStatements.includes(ss)) {
@@ -15352,8 +15351,8 @@ var init_snapshotsDiffer = __esm({
15352
15351
  const jsonDeletedUniqueConstraints = [];
15353
15352
  const jsonAlteredUniqueConstraints = [];
15354
15353
  const jsonRenameColumnsStatements = columnRenames.map((it) => prepareRenameColumns(it.table, "", it.renames)).flat();
15355
- const jsonAddColumnsStatemets = columnCreates.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
15356
15354
  const jsonDropColumnsStatemets = columnDeletes.map((it) => _prepareDropColumns(it.table, "", it.columns)).flat();
15355
+ const jsonAddColumnsStatemets = columnDeletes.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
15357
15356
  alteredTables.forEach((it) => {
15358
15357
  let addedColumns = [];
15359
15358
  for (const addedPkName of Object.keys(it.addedCompositePKs)) {
@@ -16094,7 +16093,7 @@ var init_sqlgenerator = __esm({
16094
16093
  };
16095
16094
  PgCreateTableConvertor = class extends Convertor {
16096
16095
  can(statement, dialect7) {
16097
- return statement.type === "create_table" && dialect7 === "postgresql";
16096
+ return statement.type === "create_table" && dialect7 === "pg";
16098
16097
  }
16099
16098
  convert(st) {
16100
16099
  const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints } = st;
@@ -16236,7 +16235,7 @@ var init_sqlgenerator = __esm({
16236
16235
  };
16237
16236
  PgAlterTableAddUniqueConstraintConvertor = class extends Convertor {
16238
16237
  can(statement, dialect7) {
16239
- return statement.type === "create_unique_constraint" && dialect7 === "postgresql";
16238
+ return statement.type === "create_unique_constraint" && dialect7 === "pg";
16240
16239
  }
16241
16240
  convert(statement) {
16242
16241
  const unsquashed = PgSquasher.unsquashUnique(statement.data);
@@ -16246,7 +16245,7 @@ var init_sqlgenerator = __esm({
16246
16245
  };
16247
16246
  PgAlterTableDropUniqueConstraintConvertor = class extends Convertor {
16248
16247
  can(statement, dialect7) {
16249
- return statement.type === "delete_unique_constraint" && dialect7 === "postgresql";
16248
+ return statement.type === "delete_unique_constraint" && dialect7 === "pg";
16250
16249
  }
16251
16250
  convert(statement) {
16252
16251
  const unsquashed = PgSquasher.unsquashUnique(statement.data);
@@ -16335,7 +16334,7 @@ var init_sqlgenerator = __esm({
16335
16334
  };
16336
16335
  PgDropTableConvertor = class extends Convertor {
16337
16336
  can(statement, dialect7) {
16338
- return statement.type === "drop_table" && dialect7 === "postgresql";
16337
+ return statement.type === "drop_table" && dialect7 === "pg";
16339
16338
  }
16340
16339
  convert(statement) {
16341
16340
  const { tableName, schema: schema4 } = statement;
@@ -16363,7 +16362,7 @@ var init_sqlgenerator = __esm({
16363
16362
  };
16364
16363
  PgRenameTableConvertor = class extends Convertor {
16365
16364
  can(statement, dialect7) {
16366
- return statement.type === "rename_table" && dialect7 === "postgresql";
16365
+ return statement.type === "rename_table" && dialect7 === "pg";
16367
16366
  }
16368
16367
  convert(statement) {
16369
16368
  const { tableNameFrom, tableNameTo, toSchema, fromSchema } = statement;
@@ -16394,7 +16393,7 @@ var init_sqlgenerator = __esm({
16394
16393
  };
16395
16394
  PgAlterTableRenameColumnConvertor = class extends Convertor {
16396
16395
  can(statement, dialect7) {
16397
- return statement.type === "alter_table_rename_column" && dialect7 === "postgresql";
16396
+ return statement.type === "alter_table_rename_column" && dialect7 === "pg";
16398
16397
  }
16399
16398
  convert(statement) {
16400
16399
  const { tableName, oldColumnName, newColumnName, schema: schema4 } = statement;
@@ -16422,7 +16421,7 @@ var init_sqlgenerator = __esm({
16422
16421
  };
16423
16422
  PgAlterTableDropColumnConvertor = class extends Convertor {
16424
16423
  can(statement, dialect7) {
16425
- return statement.type === "alter_table_drop_column" && dialect7 === "postgresql";
16424
+ return statement.type === "alter_table_drop_column" && dialect7 === "pg";
16426
16425
  }
16427
16426
  convert(statement) {
16428
16427
  const { tableName, columnName, schema: schema4 } = statement;
@@ -16450,7 +16449,7 @@ var init_sqlgenerator = __esm({
16450
16449
  };
16451
16450
  PgAlterTableAddColumnConvertor = class extends Convertor {
16452
16451
  can(statement, dialect7) {
16453
- return statement.type === "alter_table_add_column" && dialect7 === "postgresql";
16452
+ return statement.type === "alter_table_add_column" && dialect7 === "pg";
16454
16453
  }
16455
16454
  convert(statement) {
16456
16455
  const { tableName, column: column4, schema: schema4 } = statement;
@@ -16495,7 +16494,7 @@ var init_sqlgenerator = __esm({
16495
16494
  };
16496
16495
  PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
16497
16496
  can(statement, dialect7) {
16498
- return statement.type === "alter_table_alter_column_set_type" && dialect7 === "postgresql";
16497
+ return statement.type === "alter_table_alter_column_set_type" && dialect7 === "pg";
16499
16498
  }
16500
16499
  convert(statement) {
16501
16500
  const { tableName, columnName, newDataType, schema: schema4 } = statement;
@@ -16520,7 +16519,7 @@ var init_sqlgenerator = __esm({
16520
16519
  };
16521
16520
  PgAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
16522
16521
  can(statement, dialect7) {
16523
- return statement.type === "alter_table_alter_column_set_default" && dialect7 === "postgresql";
16522
+ return statement.type === "alter_table_alter_column_set_default" && dialect7 === "pg";
16524
16523
  }
16525
16524
  convert(statement) {
16526
16525
  const { tableName, columnName, schema: schema4 } = statement;
@@ -16545,7 +16544,7 @@ var init_sqlgenerator = __esm({
16545
16544
  };
16546
16545
  PgAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
16547
16546
  can(statement, dialect7) {
16548
- return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "postgresql";
16547
+ return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "pg";
16549
16548
  }
16550
16549
  convert(statement) {
16551
16550
  const { tableName, columnName, schema: schema4 } = statement;
@@ -16657,7 +16656,7 @@ var init_sqlgenerator = __esm({
16657
16656
  };
16658
16657
  PgAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
16659
16658
  can(statement, dialect7) {
16660
- return statement.type === "create_composite_pk" && dialect7 === "postgresql";
16659
+ return statement.type === "create_composite_pk" && dialect7 === "pg";
16661
16660
  }
16662
16661
  convert(statement) {
16663
16662
  const { name, columns } = PgSquasher.unsquashPK(statement.data);
@@ -16667,7 +16666,7 @@ var init_sqlgenerator = __esm({
16667
16666
  };
16668
16667
  PgAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
16669
16668
  can(statement, dialect7) {
16670
- return statement.type === "delete_composite_pk" && dialect7 === "postgresql";
16669
+ return statement.type === "delete_composite_pk" && dialect7 === "pg";
16671
16670
  }
16672
16671
  convert(statement) {
16673
16672
  const { name, columns } = PgSquasher.unsquashPK(statement.data);
@@ -16677,7 +16676,7 @@ var init_sqlgenerator = __esm({
16677
16676
  };
16678
16677
  PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
16679
16678
  can(statement, dialect7) {
16680
- return statement.type === "alter_composite_pk" && dialect7 === "postgresql";
16679
+ return statement.type === "alter_composite_pk" && dialect7 === "pg";
16681
16680
  }
16682
16681
  convert(statement) {
16683
16682
  const { name, columns } = PgSquasher.unsquashPK(statement.old);
@@ -16800,7 +16799,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
16800
16799
  };
16801
16800
  PgAlterTableAlterColumnSetPrimaryKeyConvertor = class extends Convertor {
16802
16801
  can(statement, dialect7) {
16803
- return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "postgresql";
16802
+ return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "pg";
16804
16803
  }
16805
16804
  convert(statement) {
16806
16805
  const { tableName, columnName } = statement;
@@ -16810,7 +16809,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
16810
16809
  };
16811
16810
  PgAlterTableAlterColumnDropPrimaryKeyConvertor = class extends Convertor {
16812
16811
  can(statement, dialect7) {
16813
- return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "postgresql";
16812
+ return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "pg";
16814
16813
  }
16815
16814
  convert(statement) {
16816
16815
  const { tableName, columnName, schema: schema4 } = statement;
@@ -16834,7 +16833,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
16834
16833
  };
16835
16834
  PgAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
16836
16835
  can(statement, dialect7) {
16837
- return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "postgresql";
16836
+ return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "pg";
16838
16837
  }
16839
16838
  convert(statement) {
16840
16839
  const { tableName, columnName } = statement;
@@ -16889,7 +16888,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
16889
16888
  };
16890
16889
  PgAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
16891
16890
  can(statement, dialect7) {
16892
- return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "postgresql";
16891
+ return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "pg";
16893
16892
  }
16894
16893
  convert(statement) {
16895
16894
  const { tableName, columnName } = statement;
@@ -16914,7 +16913,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
16914
16913
  };
16915
16914
  PgCreateForeignKeyConvertor = class extends Convertor {
16916
16915
  can(statement, dialect7) {
16917
- return statement.type === "create_reference" && dialect7 === "postgresql";
16916
+ return statement.type === "create_reference" && dialect7 === "pg";
16918
16917
  }
16919
16918
  convert(statement) {
16920
16919
  const {
@@ -16979,7 +16978,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
16979
16978
  };
16980
16979
  PgAlterForeignKeyConvertor = class extends Convertor {
16981
16980
  can(statement, dialect7) {
16982
- return statement.type === "alter_reference" && dialect7 === "postgresql";
16981
+ return statement.type === "alter_reference" && dialect7 === "pg";
16983
16982
  }
16984
16983
  convert(statement) {
16985
16984
  const newFk = PgSquasher.unsquashFK(statement.data);
@@ -17018,7 +17017,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17018
17017
  };
17019
17018
  PgDeleteForeignKeyConvertor = class extends Convertor {
17020
17019
  can(statement, dialect7) {
17021
- return statement.type === "delete_reference" && dialect7 === "postgresql";
17020
+ return statement.type === "delete_reference" && dialect7 === "pg";
17022
17021
  }
17023
17022
  convert(statement) {
17024
17023
  const tableFrom = statement.tableName;
@@ -17055,7 +17054,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17055
17054
  };
17056
17055
  CreatePgIndexConvertor = class extends Convertor {
17057
17056
  can(statement, dialect7) {
17058
- return statement.type === "create_index" && dialect7 === "postgresql";
17057
+ return statement.type === "create_index" && dialect7 === "pg";
17059
17058
  }
17060
17059
  convert(statement) {
17061
17060
  const { name, columns, isUnique } = PgSquasher.unsquashIdx(statement.data);
@@ -17094,7 +17093,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17094
17093
  };
17095
17094
  PgDropIndexConvertor = class extends Convertor {
17096
17095
  can(statement, dialect7) {
17097
- return statement.type === "drop_index" && dialect7 === "postgresql";
17096
+ return statement.type === "drop_index" && dialect7 === "pg";
17098
17097
  }
17099
17098
  convert(statement) {
17100
17099
  const { name } = PgSquasher.unsquashIdx(statement.data);
@@ -17103,7 +17102,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17103
17102
  };
17104
17103
  PgCreateSchemaConvertor = class extends Convertor {
17105
17104
  can(statement, dialect7) {
17106
- return statement.type === "create_schema" && dialect7 === "postgresql";
17105
+ return statement.type === "create_schema" && dialect7 === "pg";
17107
17106
  }
17108
17107
  convert(statement) {
17109
17108
  const { name } = statement;
@@ -17113,7 +17112,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17113
17112
  };
17114
17113
  PgRenameSchemaConvertor = class extends Convertor {
17115
17114
  can(statement, dialect7) {
17116
- return statement.type === "rename_schema" && dialect7 === "postgresql";
17115
+ return statement.type === "rename_schema" && dialect7 === "pg";
17117
17116
  }
17118
17117
  convert(statement) {
17119
17118
  const { from, to } = statement;
@@ -17123,7 +17122,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17123
17122
  };
17124
17123
  PgDropSchemaConvertor = class extends Convertor {
17125
17124
  can(statement, dialect7) {
17126
- return statement.type === "drop_schema" && dialect7 === "postgresql";
17125
+ return statement.type === "drop_schema" && dialect7 === "pg";
17127
17126
  }
17128
17127
  convert(statement) {
17129
17128
  const { name } = statement;
@@ -17133,7 +17132,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17133
17132
  };
17134
17133
  PgAlterTableSetSchemaConvertor = class extends Convertor {
17135
17134
  can(statement, dialect7) {
17136
- return statement.type === "alter_table_set_schema" && dialect7 === "postgresql";
17135
+ return statement.type === "alter_table_set_schema" && dialect7 === "pg";
17137
17136
  }
17138
17137
  convert(statement) {
17139
17138
  const { tableName, schemaFrom, schemaTo } = statement;
@@ -17143,7 +17142,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17143
17142
  };
17144
17143
  PgAlterTableSetNewSchemaConvertor = class extends Convertor {
17145
17144
  can(statement, dialect7) {
17146
- return statement.type === "alter_table_set_new_schema" && dialect7 === "postgresql";
17145
+ return statement.type === "alter_table_set_new_schema" && dialect7 === "pg";
17147
17146
  }
17148
17147
  convert(statement) {
17149
17148
  const { tableName, to, from } = statement;
@@ -17154,7 +17153,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17154
17153
  };
17155
17154
  PgAlterTableRemoveFromSchemaConvertor = class extends Convertor {
17156
17155
  can(statement, dialect7) {
17157
- return statement.type === "alter_table_remove_from_schema" && dialect7 === "postgresql";
17156
+ return statement.type === "alter_table_remove_from_schema" && dialect7 === "pg";
17158
17157
  }
17159
17158
  convert(statement) {
17160
17159
  const { tableName, schema: schema4 } = statement;
@@ -18929,7 +18928,7 @@ var pgSuggestions = async (db, statements) => {
18929
18928
  }
18930
18929
  }
18931
18930
  }
18932
- const stmnt = fromJson([statement], "postgresql")[0];
18931
+ const stmnt = fromJson([statement], "pg")[0];
18933
18932
  if (typeof stmnt !== "undefined") {
18934
18933
  if (statement.type === "drop_table") {
18935
18934
  statementsToExecute.push(
@@ -1,9 +1,9 @@
1
1
  import { TypeOf } from "zod";
2
- export declare const dialect: import("zod").ZodEnum<["postgresql", "mysql", "sqlite"]>;
2
+ export declare const dialect: import("zod").ZodEnum<["pg", "mysql", "sqlite"]>;
3
3
  export type Dialect = TypeOf<typeof dialect>;
4
4
  declare const commonSquashedSchema: import("zod").ZodUnion<[import("zod").ZodObject<{
5
5
  version: import("zod").ZodLiteral<"6">;
6
- dialect: import("zod").ZodLiteral<"postgresql">;
6
+ dialect: import("zod").ZodEnum<["pg"]>;
7
7
  tables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
8
8
  name: import("zod").ZodString;
9
9
  schema: import("zod").ZodString;
@@ -114,7 +114,7 @@ declare const commonSquashedSchema: import("zod").ZodUnion<[import("zod").ZodObj
114
114
  uniqueConstraints: Record<string, string>;
115
115
  }>;
116
116
  version: "6";
117
- dialect: "postgresql";
117
+ dialect: "pg";
118
118
  schemas: Record<string, string>;
119
119
  enums: Record<string, {
120
120
  name: string;
@@ -142,7 +142,7 @@ declare const commonSquashedSchema: import("zod").ZodUnion<[import("zod").ZodObj
142
142
  uniqueConstraints: Record<string, string>;
143
143
  }>;
144
144
  version: "6";
145
- dialect: "postgresql";
145
+ dialect: "pg";
146
146
  schemas: Record<string, string>;
147
147
  enums: Record<string, {
148
148
  name: string;
@@ -354,7 +354,7 @@ declare const commonSquashedSchema: import("zod").ZodUnion<[import("zod").ZodObj
354
354
  }>]>;
355
355
  declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").extendShape<{
356
356
  version: import("zod").ZodLiteral<"6">;
357
- dialect: import("zod").ZodLiteral<"postgresql">;
357
+ dialect: import("zod").ZodLiteral<"pg">;
358
358
  tables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
359
359
  name: import("zod").ZodString;
360
360
  schema: import("zod").ZodString;
@@ -657,7 +657,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
657
657
  id: string;
658
658
  prevId: string;
659
659
  version: "6";
660
- dialect: "postgresql";
660
+ dialect: "pg";
661
661
  schemas: Record<string, string>;
662
662
  _meta: {
663
663
  columns: Record<string, string>;
@@ -721,7 +721,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
721
721
  id: string;
722
722
  prevId: string;
723
723
  version: "6";
724
- dialect: "postgresql";
724
+ dialect: "pg";
725
725
  schemas: Record<string, string>;
726
726
  _meta: {
727
727
  columns: Record<string, string>;
@@ -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,