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.js CHANGED
@@ -4695,7 +4695,7 @@ var init_pgSchema = __esm({
4695
4695
  }).strict();
4696
4696
  pgSchemaInternal = objectType({
4697
4697
  version: literalType("6"),
4698
- dialect: literalType("postgresql"),
4698
+ dialect: literalType("pg"),
4699
4699
  tables: recordType(stringType(), table2),
4700
4700
  enums: recordType(stringType(), enumSchema),
4701
4701
  schemas: recordType(stringType(), stringType()),
@@ -4724,14 +4724,14 @@ var init_pgSchema = __esm({
4724
4724
  }).strict();
4725
4725
  pgSchemaSquashedV4 = objectType({
4726
4726
  version: literalType("4"),
4727
- dialect: literalType("pg"),
4727
+ dialect: enumType(["pg"]),
4728
4728
  tables: recordType(stringType(), tableSquashedV42),
4729
4729
  enums: recordType(stringType(), enumSchemaV1),
4730
4730
  schemas: recordType(stringType(), stringType())
4731
4731
  }).strict();
4732
4732
  pgSchemaSquashed = objectType({
4733
4733
  version: literalType("6"),
4734
- dialect: literalType("postgresql"),
4734
+ dialect: enumType(["pg"]),
4735
4735
  tables: recordType(stringType(), tableSquashed2),
4736
4736
  enums: recordType(stringType(), enumSchema),
4737
4737
  schemas: recordType(stringType(), stringType())
@@ -4842,7 +4842,7 @@ var init_pgSchema = __esm({
4842
4842
  };
4843
4843
  dryPg = pgSchema.parse({
4844
4844
  version: snapshotVersion,
4845
- dialect: "postgresql",
4845
+ dialect: "pg",
4846
4846
  id: originUUID,
4847
4847
  prevId: "",
4848
4848
  tables: {},
@@ -5305,8 +5305,7 @@ var init_outputs = __esm({
5305
5305
  warning: (str) => `${source_default.white.bgGray(" Warning ")} ${str}`,
5306
5306
  errorWarning: (str) => `${source_default.red(`${source_default.white.bgRed(" Warning ")} ${str}`)}`,
5307
5307
  fullWarning: (str) => `${source_default.black.bgYellow("[Warning]")} ${source_default.bold(str)}`,
5308
- suggestion: (str) => `${source_default.white.bgGray(" Suggestion ")} ${str}`,
5309
- info: (str) => `${source_default.grey(str)}`
5308
+ suggestion: (str) => `${source_default.white.bgGray(" Suggestion ")} ${str}`
5310
5309
  };
5311
5310
  }
5312
5311
  });
@@ -5391,7 +5390,7 @@ var init_schemaValidator = __esm({
5391
5390
  init_mysqlSchema();
5392
5391
  init_pgSchema();
5393
5392
  init_sqliteSchema();
5394
- dialect3 = enumType(["postgresql", "mysql", "sqlite"]);
5393
+ dialect3 = enumType(["pg", "mysql", "sqlite"]);
5395
5394
  commonSquashedSchema = unionType([
5396
5395
  pgSchemaSquashed,
5397
5396
  mysqlSchemaSquashed,
@@ -5512,7 +5511,7 @@ var init_cli = __esm({
5512
5511
  schema: unionType([stringType(), stringType().array()]).optional(),
5513
5512
  tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5514
5513
  schemaFilters: unionType([stringType(), stringType().array()]).optional().default(["public"]),
5515
- driver: stringType().optional(),
5514
+ driver: stringType(),
5516
5515
  // pg
5517
5516
  connectionString: stringType().optional(),
5518
5517
  // mysql
@@ -11502,7 +11501,7 @@ ${withStyle.errorWarning(
11502
11501
  );
11503
11502
  return {
11504
11503
  version: "6",
11505
- dialect: "postgresql",
11504
+ dialect: "pg",
11506
11505
  tables: result,
11507
11506
  enums: enumsToReturn,
11508
11507
  schemas: schemasObject,
@@ -11709,7 +11708,7 @@ ${withStyle.errorWarning(
11709
11708
  const columnName = columnResponse.attname;
11710
11709
  const columnAdditionalDT = columnResponse.additional_dt;
11711
11710
  const columnDimensions = columnResponse.array_dimensions;
11712
- const enumType3 = columnResponse.enum_name;
11711
+ const enumType2 = columnResponse.enum_name;
11713
11712
  let columnType = columnResponse.data_type;
11714
11713
  const primaryKey = tableConstraints.filter(
11715
11714
  (mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "PRIMARY KEY"
@@ -11773,8 +11772,8 @@ ${withStyle.errorWarning(
11773
11772
  columnTypeMapped = trimChar(columnTypeMapped, '"');
11774
11773
  columnToReturn[columnName] = {
11775
11774
  name: columnName,
11776
- type: columnAdditionalDT === "USER-DEFINED" ? enumType3 : columnTypeMapped,
11777
- typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
11775
+ type: columnAdditionalDT === "USER-DEFINED" ? enumType2 : columnTypeMapped,
11776
+ typeSchema: enumsToReturn[`${tableSchema}.${enumType2}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType2}`].schema : void 0,
11778
11777
  primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
11779
11778
  // default: isSerial ? undefined : defaultValue,
11780
11779
  notNull: columnResponse.is_nullable === "NO"
@@ -11857,7 +11856,7 @@ ${withStyle.errorWarning(
11857
11856
  const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
11858
11857
  return {
11859
11858
  version: "6",
11860
- dialect: "postgresql",
11859
+ dialect: "pg",
11861
11860
  tables: result,
11862
11861
  enums: enumsToReturn,
11863
11862
  schemas: schemasObject,
@@ -15200,7 +15199,7 @@ var init_snapshotsDiffer = __esm({
15200
15199
  jsonStatements.push(...jsonAlteredUniqueConstraints);
15201
15200
  jsonStatements.push(...dropEnums);
15202
15201
  jsonStatements.push(...dropSchemas);
15203
- const sqlStatements = fromJson(jsonStatements, "postgresql");
15202
+ const sqlStatements = fromJson(jsonStatements, "pg");
15204
15203
  const uniqueSqlStatements = [];
15205
15204
  sqlStatements.forEach((ss) => {
15206
15205
  if (!uniqueSqlStatements.includes(ss)) {
@@ -15338,8 +15337,8 @@ var init_snapshotsDiffer = __esm({
15338
15337
  const jsonDeletedUniqueConstraints = [];
15339
15338
  const jsonAlteredUniqueConstraints = [];
15340
15339
  const jsonRenameColumnsStatements = columnRenames.map((it) => prepareRenameColumns(it.table, "", it.renames)).flat();
15341
- const jsonAddColumnsStatemets = columnCreates.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
15342
15340
  const jsonDropColumnsStatemets = columnDeletes.map((it) => _prepareDropColumns(it.table, "", it.columns)).flat();
15341
+ const jsonAddColumnsStatemets = columnDeletes.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
15343
15342
  alteredTables.forEach((it) => {
15344
15343
  let addedColumns = [];
15345
15344
  for (const addedPkName of Object.keys(it.addedCompositePKs)) {
@@ -16080,7 +16079,7 @@ var init_sqlgenerator = __esm({
16080
16079
  };
16081
16080
  PgCreateTableConvertor = class extends Convertor {
16082
16081
  can(statement, dialect7) {
16083
- return statement.type === "create_table" && dialect7 === "postgresql";
16082
+ return statement.type === "create_table" && dialect7 === "pg";
16084
16083
  }
16085
16084
  convert(st) {
16086
16085
  const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints } = st;
@@ -16222,7 +16221,7 @@ var init_sqlgenerator = __esm({
16222
16221
  };
16223
16222
  PgAlterTableAddUniqueConstraintConvertor = class extends Convertor {
16224
16223
  can(statement, dialect7) {
16225
- return statement.type === "create_unique_constraint" && dialect7 === "postgresql";
16224
+ return statement.type === "create_unique_constraint" && dialect7 === "pg";
16226
16225
  }
16227
16226
  convert(statement) {
16228
16227
  const unsquashed = PgSquasher.unsquashUnique(statement.data);
@@ -16232,7 +16231,7 @@ var init_sqlgenerator = __esm({
16232
16231
  };
16233
16232
  PgAlterTableDropUniqueConstraintConvertor = class extends Convertor {
16234
16233
  can(statement, dialect7) {
16235
- return statement.type === "delete_unique_constraint" && dialect7 === "postgresql";
16234
+ return statement.type === "delete_unique_constraint" && dialect7 === "pg";
16236
16235
  }
16237
16236
  convert(statement) {
16238
16237
  const unsquashed = PgSquasher.unsquashUnique(statement.data);
@@ -16321,7 +16320,7 @@ var init_sqlgenerator = __esm({
16321
16320
  };
16322
16321
  PgDropTableConvertor = class extends Convertor {
16323
16322
  can(statement, dialect7) {
16324
- return statement.type === "drop_table" && dialect7 === "postgresql";
16323
+ return statement.type === "drop_table" && dialect7 === "pg";
16325
16324
  }
16326
16325
  convert(statement) {
16327
16326
  const { tableName, schema: schema4 } = statement;
@@ -16349,7 +16348,7 @@ var init_sqlgenerator = __esm({
16349
16348
  };
16350
16349
  PgRenameTableConvertor = class extends Convertor {
16351
16350
  can(statement, dialect7) {
16352
- return statement.type === "rename_table" && dialect7 === "postgresql";
16351
+ return statement.type === "rename_table" && dialect7 === "pg";
16353
16352
  }
16354
16353
  convert(statement) {
16355
16354
  const { tableNameFrom, tableNameTo, toSchema, fromSchema } = statement;
@@ -16380,7 +16379,7 @@ var init_sqlgenerator = __esm({
16380
16379
  };
16381
16380
  PgAlterTableRenameColumnConvertor = class extends Convertor {
16382
16381
  can(statement, dialect7) {
16383
- return statement.type === "alter_table_rename_column" && dialect7 === "postgresql";
16382
+ return statement.type === "alter_table_rename_column" && dialect7 === "pg";
16384
16383
  }
16385
16384
  convert(statement) {
16386
16385
  const { tableName, oldColumnName, newColumnName, schema: schema4 } = statement;
@@ -16408,7 +16407,7 @@ var init_sqlgenerator = __esm({
16408
16407
  };
16409
16408
  PgAlterTableDropColumnConvertor = class extends Convertor {
16410
16409
  can(statement, dialect7) {
16411
- return statement.type === "alter_table_drop_column" && dialect7 === "postgresql";
16410
+ return statement.type === "alter_table_drop_column" && dialect7 === "pg";
16412
16411
  }
16413
16412
  convert(statement) {
16414
16413
  const { tableName, columnName, schema: schema4 } = statement;
@@ -16436,7 +16435,7 @@ var init_sqlgenerator = __esm({
16436
16435
  };
16437
16436
  PgAlterTableAddColumnConvertor = class extends Convertor {
16438
16437
  can(statement, dialect7) {
16439
- return statement.type === "alter_table_add_column" && dialect7 === "postgresql";
16438
+ return statement.type === "alter_table_add_column" && dialect7 === "pg";
16440
16439
  }
16441
16440
  convert(statement) {
16442
16441
  const { tableName, column: column4, schema: schema4 } = statement;
@@ -16481,7 +16480,7 @@ var init_sqlgenerator = __esm({
16481
16480
  };
16482
16481
  PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
16483
16482
  can(statement, dialect7) {
16484
- return statement.type === "alter_table_alter_column_set_type" && dialect7 === "postgresql";
16483
+ return statement.type === "alter_table_alter_column_set_type" && dialect7 === "pg";
16485
16484
  }
16486
16485
  convert(statement) {
16487
16486
  const { tableName, columnName, newDataType, schema: schema4 } = statement;
@@ -16506,7 +16505,7 @@ var init_sqlgenerator = __esm({
16506
16505
  };
16507
16506
  PgAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
16508
16507
  can(statement, dialect7) {
16509
- return statement.type === "alter_table_alter_column_set_default" && dialect7 === "postgresql";
16508
+ return statement.type === "alter_table_alter_column_set_default" && dialect7 === "pg";
16510
16509
  }
16511
16510
  convert(statement) {
16512
16511
  const { tableName, columnName, schema: schema4 } = statement;
@@ -16531,7 +16530,7 @@ var init_sqlgenerator = __esm({
16531
16530
  };
16532
16531
  PgAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
16533
16532
  can(statement, dialect7) {
16534
- return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "postgresql";
16533
+ return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "pg";
16535
16534
  }
16536
16535
  convert(statement) {
16537
16536
  const { tableName, columnName, schema: schema4 } = statement;
@@ -16643,7 +16642,7 @@ var init_sqlgenerator = __esm({
16643
16642
  };
16644
16643
  PgAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
16645
16644
  can(statement, dialect7) {
16646
- return statement.type === "create_composite_pk" && dialect7 === "postgresql";
16645
+ return statement.type === "create_composite_pk" && dialect7 === "pg";
16647
16646
  }
16648
16647
  convert(statement) {
16649
16648
  const { name, columns } = PgSquasher.unsquashPK(statement.data);
@@ -16653,7 +16652,7 @@ var init_sqlgenerator = __esm({
16653
16652
  };
16654
16653
  PgAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
16655
16654
  can(statement, dialect7) {
16656
- return statement.type === "delete_composite_pk" && dialect7 === "postgresql";
16655
+ return statement.type === "delete_composite_pk" && dialect7 === "pg";
16657
16656
  }
16658
16657
  convert(statement) {
16659
16658
  const { name, columns } = PgSquasher.unsquashPK(statement.data);
@@ -16663,7 +16662,7 @@ var init_sqlgenerator = __esm({
16663
16662
  };
16664
16663
  PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
16665
16664
  can(statement, dialect7) {
16666
- return statement.type === "alter_composite_pk" && dialect7 === "postgresql";
16665
+ return statement.type === "alter_composite_pk" && dialect7 === "pg";
16667
16666
  }
16668
16667
  convert(statement) {
16669
16668
  const { name, columns } = PgSquasher.unsquashPK(statement.old);
@@ -16786,7 +16785,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
16786
16785
  };
16787
16786
  PgAlterTableAlterColumnSetPrimaryKeyConvertor = class extends Convertor {
16788
16787
  can(statement, dialect7) {
16789
- return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "postgresql";
16788
+ return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "pg";
16790
16789
  }
16791
16790
  convert(statement) {
16792
16791
  const { tableName, columnName } = statement;
@@ -16796,7 +16795,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
16796
16795
  };
16797
16796
  PgAlterTableAlterColumnDropPrimaryKeyConvertor = class extends Convertor {
16798
16797
  can(statement, dialect7) {
16799
- return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "postgresql";
16798
+ return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "pg";
16800
16799
  }
16801
16800
  convert(statement) {
16802
16801
  const { tableName, columnName, schema: schema4 } = statement;
@@ -16820,7 +16819,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
16820
16819
  };
16821
16820
  PgAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
16822
16821
  can(statement, dialect7) {
16823
- return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "postgresql";
16822
+ return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "pg";
16824
16823
  }
16825
16824
  convert(statement) {
16826
16825
  const { tableName, columnName } = statement;
@@ -16875,7 +16874,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
16875
16874
  };
16876
16875
  PgAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
16877
16876
  can(statement, dialect7) {
16878
- return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "postgresql";
16877
+ return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "pg";
16879
16878
  }
16880
16879
  convert(statement) {
16881
16880
  const { tableName, columnName } = statement;
@@ -16900,7 +16899,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
16900
16899
  };
16901
16900
  PgCreateForeignKeyConvertor = class extends Convertor {
16902
16901
  can(statement, dialect7) {
16903
- return statement.type === "create_reference" && dialect7 === "postgresql";
16902
+ return statement.type === "create_reference" && dialect7 === "pg";
16904
16903
  }
16905
16904
  convert(statement) {
16906
16905
  const {
@@ -16965,7 +16964,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
16965
16964
  };
16966
16965
  PgAlterForeignKeyConvertor = class extends Convertor {
16967
16966
  can(statement, dialect7) {
16968
- return statement.type === "alter_reference" && dialect7 === "postgresql";
16967
+ return statement.type === "alter_reference" && dialect7 === "pg";
16969
16968
  }
16970
16969
  convert(statement) {
16971
16970
  const newFk = PgSquasher.unsquashFK(statement.data);
@@ -17004,7 +17003,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17004
17003
  };
17005
17004
  PgDeleteForeignKeyConvertor = class extends Convertor {
17006
17005
  can(statement, dialect7) {
17007
- return statement.type === "delete_reference" && dialect7 === "postgresql";
17006
+ return statement.type === "delete_reference" && dialect7 === "pg";
17008
17007
  }
17009
17008
  convert(statement) {
17010
17009
  const tableFrom = statement.tableName;
@@ -17041,7 +17040,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17041
17040
  };
17042
17041
  CreatePgIndexConvertor = class extends Convertor {
17043
17042
  can(statement, dialect7) {
17044
- return statement.type === "create_index" && dialect7 === "postgresql";
17043
+ return statement.type === "create_index" && dialect7 === "pg";
17045
17044
  }
17046
17045
  convert(statement) {
17047
17046
  const { name, columns, isUnique } = PgSquasher.unsquashIdx(statement.data);
@@ -17080,7 +17079,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17080
17079
  };
17081
17080
  PgDropIndexConvertor = class extends Convertor {
17082
17081
  can(statement, dialect7) {
17083
- return statement.type === "drop_index" && dialect7 === "postgresql";
17082
+ return statement.type === "drop_index" && dialect7 === "pg";
17084
17083
  }
17085
17084
  convert(statement) {
17086
17085
  const { name } = PgSquasher.unsquashIdx(statement.data);
@@ -17089,7 +17088,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17089
17088
  };
17090
17089
  PgCreateSchemaConvertor = class extends Convertor {
17091
17090
  can(statement, dialect7) {
17092
- return statement.type === "create_schema" && dialect7 === "postgresql";
17091
+ return statement.type === "create_schema" && dialect7 === "pg";
17093
17092
  }
17094
17093
  convert(statement) {
17095
17094
  const { name } = statement;
@@ -17099,7 +17098,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17099
17098
  };
17100
17099
  PgRenameSchemaConvertor = class extends Convertor {
17101
17100
  can(statement, dialect7) {
17102
- return statement.type === "rename_schema" && dialect7 === "postgresql";
17101
+ return statement.type === "rename_schema" && dialect7 === "pg";
17103
17102
  }
17104
17103
  convert(statement) {
17105
17104
  const { from, to } = statement;
@@ -17109,7 +17108,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17109
17108
  };
17110
17109
  PgDropSchemaConvertor = class extends Convertor {
17111
17110
  can(statement, dialect7) {
17112
- return statement.type === "drop_schema" && dialect7 === "postgresql";
17111
+ return statement.type === "drop_schema" && dialect7 === "pg";
17113
17112
  }
17114
17113
  convert(statement) {
17115
17114
  const { name } = statement;
@@ -17119,7 +17118,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17119
17118
  };
17120
17119
  PgAlterTableSetSchemaConvertor = class extends Convertor {
17121
17120
  can(statement, dialect7) {
17122
- return statement.type === "alter_table_set_schema" && dialect7 === "postgresql";
17121
+ return statement.type === "alter_table_set_schema" && dialect7 === "pg";
17123
17122
  }
17124
17123
  convert(statement) {
17125
17124
  const { tableName, schemaFrom, schemaTo } = statement;
@@ -17129,7 +17128,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17129
17128
  };
17130
17129
  PgAlterTableSetNewSchemaConvertor = class extends Convertor {
17131
17130
  can(statement, dialect7) {
17132
- return statement.type === "alter_table_set_new_schema" && dialect7 === "postgresql";
17131
+ return statement.type === "alter_table_set_new_schema" && dialect7 === "pg";
17133
17132
  }
17134
17133
  convert(statement) {
17135
17134
  const { tableName, to, from } = statement;
@@ -17140,7 +17139,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17140
17139
  };
17141
17140
  PgAlterTableRemoveFromSchemaConvertor = class extends Convertor {
17142
17141
  can(statement, dialect7) {
17143
- return statement.type === "alter_table_remove_from_schema" && dialect7 === "postgresql";
17142
+ return statement.type === "alter_table_remove_from_schema" && dialect7 === "pg";
17144
17143
  }
17145
17144
  convert(statement) {
17146
17145
  const { tableName, schema: schema4 } = statement;
@@ -18920,7 +18919,7 @@ var pgSuggestions = async (db, statements) => {
18920
18919
  }
18921
18920
  }
18922
18921
  }
18923
- const stmnt = fromJson([statement], "postgresql")[0];
18922
+ const stmnt = fromJson([statement], "pg")[0];
18924
18923
  if (typeof stmnt !== "undefined") {
18925
18924
  if (statement.type === "drop_table") {
18926
18925
  statementsToExecute.push(