drizzle-kit 0.20.17-2132ef8 → 0.20.17-388fa1b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin.cjs +14340 -24257
- package/cli/commands/migrate.d.ts +2 -2
- package/cli/commands/pgIntrospect.d.ts +1 -1
- package/cli/commands/utils.d.ts +2 -2
- package/cli/validations/cli.d.ts +24 -24
- package/cli/validations/common.d.ts +13 -13
- package/cli/validations/outputs.d.ts +2 -1
- package/index.d.mts +48 -2
- package/index.d.ts +48 -2
- package/package.json +1 -2
- package/payload.js +55 -63
- package/payload.mjs +55 -63
- package/schemaValidator.d.ts +7 -7
- package/serializer/pgSchema.d.ts +14 -14
- package/serializer/studio.d.ts +1 -1
- package/snapshotsDiffer.d.ts +2 -1
- package/utils-studio.js +8 -8
- package/utils-studio.mjs +8 -8
- package/utils.js +5 -5
- package/utils.mjs +5 -5
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("
|
|
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:
|
|
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:
|
|
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: "
|
|
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
|
});
|
|
@@ -5334,6 +5333,7 @@ var init_mysql = __esm({
|
|
|
5334
5333
|
}),
|
|
5335
5334
|
objectType({
|
|
5336
5335
|
url: stringType()
|
|
5336
|
+
// TODO: change docs
|
|
5337
5337
|
})
|
|
5338
5338
|
]);
|
|
5339
5339
|
}
|
|
@@ -5397,7 +5397,7 @@ var init_schemaValidator = __esm({
|
|
|
5397
5397
|
init_mysqlSchema();
|
|
5398
5398
|
init_pgSchema();
|
|
5399
5399
|
init_sqliteSchema();
|
|
5400
|
-
dialect3 = enumType(["
|
|
5400
|
+
dialect3 = enumType(["pg", "mysql", "sqlite"]);
|
|
5401
5401
|
commonSquashedSchema = unionType([
|
|
5402
5402
|
pgSchemaSquashed,
|
|
5403
5403
|
mysqlSchemaSquashed,
|
|
@@ -5517,8 +5517,8 @@ var init_cli = __esm({
|
|
|
5517
5517
|
dialect: dialect3,
|
|
5518
5518
|
schema: unionType([stringType(), stringType().array()]).optional(),
|
|
5519
5519
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
|
5520
|
-
|
|
5521
|
-
driver: stringType()
|
|
5520
|
+
schemaFilters: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
|
5521
|
+
driver: stringType(),
|
|
5522
5522
|
// pg
|
|
5523
5523
|
connectionString: stringType().optional(),
|
|
5524
5524
|
// mysql
|
|
@@ -5554,7 +5554,7 @@ var init_cli = __esm({
|
|
|
5554
5554
|
ssl: stringType().optional(),
|
|
5555
5555
|
url: stringType().optional(),
|
|
5556
5556
|
authToken: stringType().optional(),
|
|
5557
|
-
|
|
5557
|
+
"introspect-casing": casing,
|
|
5558
5558
|
breakpoints: booleanType().optional().default(true)
|
|
5559
5559
|
});
|
|
5560
5560
|
configCheck = objectType({
|
|
@@ -11516,7 +11516,7 @@ ${withStyle.errorWarning(
|
|
|
11516
11516
|
);
|
|
11517
11517
|
return {
|
|
11518
11518
|
version: "6",
|
|
11519
|
-
dialect: "
|
|
11519
|
+
dialect: "pg",
|
|
11520
11520
|
tables: result,
|
|
11521
11521
|
enums: enumsToReturn,
|
|
11522
11522
|
schemas: schemasObject,
|
|
@@ -11723,7 +11723,7 @@ ${withStyle.errorWarning(
|
|
|
11723
11723
|
const columnName = columnResponse.attname;
|
|
11724
11724
|
const columnAdditionalDT = columnResponse.additional_dt;
|
|
11725
11725
|
const columnDimensions = columnResponse.array_dimensions;
|
|
11726
|
-
const
|
|
11726
|
+
const enumType2 = columnResponse.enum_name;
|
|
11727
11727
|
let columnType = columnResponse.data_type;
|
|
11728
11728
|
const primaryKey = tableConstraints.filter(
|
|
11729
11729
|
(mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "PRIMARY KEY"
|
|
@@ -11787,8 +11787,8 @@ ${withStyle.errorWarning(
|
|
|
11787
11787
|
columnTypeMapped = trimChar(columnTypeMapped, '"');
|
|
11788
11788
|
columnToReturn[columnName] = {
|
|
11789
11789
|
name: columnName,
|
|
11790
|
-
type: columnAdditionalDT === "USER-DEFINED" ?
|
|
11791
|
-
typeSchema: enumsToReturn[`${tableSchema}.${
|
|
11790
|
+
type: columnAdditionalDT === "USER-DEFINED" ? enumType2 : columnTypeMapped,
|
|
11791
|
+
typeSchema: enumsToReturn[`${tableSchema}.${enumType2}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType2}`].schema : void 0,
|
|
11792
11792
|
primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
|
|
11793
11793
|
// default: isSerial ? undefined : defaultValue,
|
|
11794
11794
|
notNull: columnResponse.is_nullable === "NO"
|
|
@@ -11871,7 +11871,7 @@ ${withStyle.errorWarning(
|
|
|
11871
11871
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
|
11872
11872
|
return {
|
|
11873
11873
|
version: "6",
|
|
11874
|
-
dialect: "
|
|
11874
|
+
dialect: "pg",
|
|
11875
11875
|
tables: result,
|
|
11876
11876
|
enums: enumsToReturn,
|
|
11877
11877
|
schemas: schemasObject,
|
|
@@ -15102,7 +15102,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
15102
15102
|
const jsonTableAlternations = alteredTables.map((it) => {
|
|
15103
15103
|
return preparePgAlterColumns(it.name, it.schema, it.altered, json2);
|
|
15104
15104
|
}).flat();
|
|
15105
|
-
const
|
|
15105
|
+
const jsonCreateIndexesForAllAlteredTables = alteredTables.map((it) => {
|
|
15106
15106
|
return prepareCreateIndexesJson(
|
|
15107
15107
|
it.name,
|
|
15108
15108
|
it.schema,
|
|
@@ -15131,21 +15131,14 @@ var init_snapshotsDiffer = __esm({
|
|
|
15131
15131
|
},
|
|
15132
15132
|
{}
|
|
15133
15133
|
);
|
|
15134
|
-
|
|
15134
|
+
jsonCreateIndexesForAllAlteredTables.push(
|
|
15135
15135
|
...prepareCreateIndexesJson(it.name, it.schema, createdIndexes || {})
|
|
15136
15136
|
);
|
|
15137
15137
|
jsonDropIndexesForAllAlteredTables.push(
|
|
15138
15138
|
...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
|
|
15139
15139
|
);
|
|
15140
15140
|
});
|
|
15141
|
-
const
|
|
15142
|
-
return prepareCreateReferencesJson(
|
|
15143
|
-
it.name,
|
|
15144
|
-
it.schema,
|
|
15145
|
-
it.foreignKeys
|
|
15146
|
-
);
|
|
15147
|
-
}).flat();
|
|
15148
|
-
const jsonReferencesForAlteredTables = alteredTables.map((it) => {
|
|
15141
|
+
const jsonReferencesForAllAlteredTables = alteredTables.map((it) => {
|
|
15149
15142
|
const forAdded = prepareCreateReferencesJson(
|
|
15150
15143
|
it.name,
|
|
15151
15144
|
it.schema,
|
|
@@ -15163,10 +15156,10 @@ var init_snapshotsDiffer = __esm({
|
|
|
15163
15156
|
);
|
|
15164
15157
|
return [...forAdded, ...forAltered, ...alteredFKs];
|
|
15165
15158
|
}).flat();
|
|
15166
|
-
const jsonCreatedReferencesForAlteredTables =
|
|
15159
|
+
const jsonCreatedReferencesForAlteredTables = jsonReferencesForAllAlteredTables.filter(
|
|
15167
15160
|
(t) => t.type === "create_reference"
|
|
15168
15161
|
);
|
|
15169
|
-
const jsonDroppedReferencesForAlteredTables =
|
|
15162
|
+
const jsonDroppedReferencesForAlteredTables = jsonReferencesForAllAlteredTables.filter(
|
|
15170
15163
|
(t) => t.type === "delete_reference"
|
|
15171
15164
|
);
|
|
15172
15165
|
const createEnums = createdEnums.map((it) => {
|
|
@@ -15193,7 +15186,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
15193
15186
|
const dropSchemas = prepareDeleteSchemasJson(
|
|
15194
15187
|
deletedSchemas.map((it) => it.name)
|
|
15195
15188
|
);
|
|
15196
|
-
const
|
|
15189
|
+
const jsonPgCreateTables = createdTables.map((it) => {
|
|
15197
15190
|
return preparePgCreateTableJson(it, curFull);
|
|
15198
15191
|
});
|
|
15199
15192
|
jsonStatements.push(...createSchemas);
|
|
@@ -15202,7 +15195,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
15202
15195
|
jsonStatements.push(...moveEnums);
|
|
15203
15196
|
jsonStatements.push(...renameEnums);
|
|
15204
15197
|
jsonStatements.push(...jsonAlterEnumsWithAddedValues);
|
|
15205
|
-
jsonStatements.push(...
|
|
15198
|
+
jsonStatements.push(...jsonPgCreateTables);
|
|
15206
15199
|
jsonStatements.push(...jsonDropTables);
|
|
15207
15200
|
jsonStatements.push(...jsonSetTableSchemas);
|
|
15208
15201
|
jsonStatements.push(...jsonRenameTables);
|
|
@@ -15213,16 +15206,15 @@ var init_snapshotsDiffer = __esm({
|
|
|
15213
15206
|
jsonStatements.push(...jsonTableAlternations);
|
|
15214
15207
|
jsonStatements.push(...jsonAddedCompositePKs);
|
|
15215
15208
|
jsonStatements.push(...jsonAddColumnsStatemets);
|
|
15216
|
-
jsonStatements.push(...jsonCreateReferencesForCreatedTables);
|
|
15217
15209
|
jsonStatements.push(...jsonCreateIndexesForCreatedTables);
|
|
15210
|
+
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
|
15218
15211
|
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
|
|
15219
|
-
jsonStatements.push(...jsonCreateIndexesFoAlteredTables);
|
|
15220
15212
|
jsonStatements.push(...jsonDropColumnsStatemets);
|
|
15221
15213
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
|
15222
15214
|
jsonStatements.push(...jsonAlteredUniqueConstraints);
|
|
15223
15215
|
jsonStatements.push(...dropEnums);
|
|
15224
15216
|
jsonStatements.push(...dropSchemas);
|
|
15225
|
-
const sqlStatements = fromJson(jsonStatements, "
|
|
15217
|
+
const sqlStatements = fromJson(jsonStatements, "pg");
|
|
15226
15218
|
const uniqueSqlStatements = [];
|
|
15227
15219
|
sqlStatements.forEach((ss) => {
|
|
15228
15220
|
if (!uniqueSqlStatements.includes(ss)) {
|
|
@@ -15360,8 +15352,8 @@ var init_snapshotsDiffer = __esm({
|
|
|
15360
15352
|
const jsonDeletedUniqueConstraints = [];
|
|
15361
15353
|
const jsonAlteredUniqueConstraints = [];
|
|
15362
15354
|
const jsonRenameColumnsStatements = columnRenames.map((it) => prepareRenameColumns(it.table, "", it.renames)).flat();
|
|
15363
|
-
const jsonAddColumnsStatemets = columnCreates.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
|
|
15364
15355
|
const jsonDropColumnsStatemets = columnDeletes.map((it) => _prepareDropColumns(it.table, "", it.columns)).flat();
|
|
15356
|
+
const jsonAddColumnsStatemets = columnDeletes.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
|
|
15365
15357
|
alteredTables.forEach((it) => {
|
|
15366
15358
|
let addedColumns = [];
|
|
15367
15359
|
for (const addedPkName of Object.keys(it.addedCompositePKs)) {
|
|
@@ -16102,7 +16094,7 @@ var init_sqlgenerator = __esm({
|
|
|
16102
16094
|
};
|
|
16103
16095
|
PgCreateTableConvertor = class extends Convertor {
|
|
16104
16096
|
can(statement, dialect7) {
|
|
16105
|
-
return statement.type === "create_table" && dialect7 === "
|
|
16097
|
+
return statement.type === "create_table" && dialect7 === "pg";
|
|
16106
16098
|
}
|
|
16107
16099
|
convert(st) {
|
|
16108
16100
|
const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints } = st;
|
|
@@ -16244,7 +16236,7 @@ var init_sqlgenerator = __esm({
|
|
|
16244
16236
|
};
|
|
16245
16237
|
PgAlterTableAddUniqueConstraintConvertor = class extends Convertor {
|
|
16246
16238
|
can(statement, dialect7) {
|
|
16247
|
-
return statement.type === "create_unique_constraint" && dialect7 === "
|
|
16239
|
+
return statement.type === "create_unique_constraint" && dialect7 === "pg";
|
|
16248
16240
|
}
|
|
16249
16241
|
convert(statement) {
|
|
16250
16242
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
|
@@ -16254,7 +16246,7 @@ var init_sqlgenerator = __esm({
|
|
|
16254
16246
|
};
|
|
16255
16247
|
PgAlterTableDropUniqueConstraintConvertor = class extends Convertor {
|
|
16256
16248
|
can(statement, dialect7) {
|
|
16257
|
-
return statement.type === "delete_unique_constraint" && dialect7 === "
|
|
16249
|
+
return statement.type === "delete_unique_constraint" && dialect7 === "pg";
|
|
16258
16250
|
}
|
|
16259
16251
|
convert(statement) {
|
|
16260
16252
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
|
@@ -16343,7 +16335,7 @@ var init_sqlgenerator = __esm({
|
|
|
16343
16335
|
};
|
|
16344
16336
|
PgDropTableConvertor = class extends Convertor {
|
|
16345
16337
|
can(statement, dialect7) {
|
|
16346
|
-
return statement.type === "drop_table" && dialect7 === "
|
|
16338
|
+
return statement.type === "drop_table" && dialect7 === "pg";
|
|
16347
16339
|
}
|
|
16348
16340
|
convert(statement) {
|
|
16349
16341
|
const { tableName, schema: schema4 } = statement;
|
|
@@ -16371,7 +16363,7 @@ var init_sqlgenerator = __esm({
|
|
|
16371
16363
|
};
|
|
16372
16364
|
PgRenameTableConvertor = class extends Convertor {
|
|
16373
16365
|
can(statement, dialect7) {
|
|
16374
|
-
return statement.type === "rename_table" && dialect7 === "
|
|
16366
|
+
return statement.type === "rename_table" && dialect7 === "pg";
|
|
16375
16367
|
}
|
|
16376
16368
|
convert(statement) {
|
|
16377
16369
|
const { tableNameFrom, tableNameTo, toSchema, fromSchema } = statement;
|
|
@@ -16402,7 +16394,7 @@ var init_sqlgenerator = __esm({
|
|
|
16402
16394
|
};
|
|
16403
16395
|
PgAlterTableRenameColumnConvertor = class extends Convertor {
|
|
16404
16396
|
can(statement, dialect7) {
|
|
16405
|
-
return statement.type === "alter_table_rename_column" && dialect7 === "
|
|
16397
|
+
return statement.type === "alter_table_rename_column" && dialect7 === "pg";
|
|
16406
16398
|
}
|
|
16407
16399
|
convert(statement) {
|
|
16408
16400
|
const { tableName, oldColumnName, newColumnName, schema: schema4 } = statement;
|
|
@@ -16430,7 +16422,7 @@ var init_sqlgenerator = __esm({
|
|
|
16430
16422
|
};
|
|
16431
16423
|
PgAlterTableDropColumnConvertor = class extends Convertor {
|
|
16432
16424
|
can(statement, dialect7) {
|
|
16433
|
-
return statement.type === "alter_table_drop_column" && dialect7 === "
|
|
16425
|
+
return statement.type === "alter_table_drop_column" && dialect7 === "pg";
|
|
16434
16426
|
}
|
|
16435
16427
|
convert(statement) {
|
|
16436
16428
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16458,7 +16450,7 @@ var init_sqlgenerator = __esm({
|
|
|
16458
16450
|
};
|
|
16459
16451
|
PgAlterTableAddColumnConvertor = class extends Convertor {
|
|
16460
16452
|
can(statement, dialect7) {
|
|
16461
|
-
return statement.type === "alter_table_add_column" && dialect7 === "
|
|
16453
|
+
return statement.type === "alter_table_add_column" && dialect7 === "pg";
|
|
16462
16454
|
}
|
|
16463
16455
|
convert(statement) {
|
|
16464
16456
|
const { tableName, column: column4, schema: schema4 } = statement;
|
|
@@ -16503,7 +16495,7 @@ var init_sqlgenerator = __esm({
|
|
|
16503
16495
|
};
|
|
16504
16496
|
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
|
|
16505
16497
|
can(statement, dialect7) {
|
|
16506
|
-
return statement.type === "alter_table_alter_column_set_type" && dialect7 === "
|
|
16498
|
+
return statement.type === "alter_table_alter_column_set_type" && dialect7 === "pg";
|
|
16507
16499
|
}
|
|
16508
16500
|
convert(statement) {
|
|
16509
16501
|
const { tableName, columnName, newDataType, schema: schema4 } = statement;
|
|
@@ -16528,7 +16520,7 @@ var init_sqlgenerator = __esm({
|
|
|
16528
16520
|
};
|
|
16529
16521
|
PgAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
|
|
16530
16522
|
can(statement, dialect7) {
|
|
16531
|
-
return statement.type === "alter_table_alter_column_set_default" && dialect7 === "
|
|
16523
|
+
return statement.type === "alter_table_alter_column_set_default" && dialect7 === "pg";
|
|
16532
16524
|
}
|
|
16533
16525
|
convert(statement) {
|
|
16534
16526
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16553,7 +16545,7 @@ var init_sqlgenerator = __esm({
|
|
|
16553
16545
|
};
|
|
16554
16546
|
PgAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
|
|
16555
16547
|
can(statement, dialect7) {
|
|
16556
|
-
return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "
|
|
16548
|
+
return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "pg";
|
|
16557
16549
|
}
|
|
16558
16550
|
convert(statement) {
|
|
16559
16551
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16665,7 +16657,7 @@ var init_sqlgenerator = __esm({
|
|
|
16665
16657
|
};
|
|
16666
16658
|
PgAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
|
|
16667
16659
|
can(statement, dialect7) {
|
|
16668
|
-
return statement.type === "create_composite_pk" && dialect7 === "
|
|
16660
|
+
return statement.type === "create_composite_pk" && dialect7 === "pg";
|
|
16669
16661
|
}
|
|
16670
16662
|
convert(statement) {
|
|
16671
16663
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
|
@@ -16675,7 +16667,7 @@ var init_sqlgenerator = __esm({
|
|
|
16675
16667
|
};
|
|
16676
16668
|
PgAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
|
|
16677
16669
|
can(statement, dialect7) {
|
|
16678
|
-
return statement.type === "delete_composite_pk" && dialect7 === "
|
|
16670
|
+
return statement.type === "delete_composite_pk" && dialect7 === "pg";
|
|
16679
16671
|
}
|
|
16680
16672
|
convert(statement) {
|
|
16681
16673
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
|
@@ -16685,7 +16677,7 @@ var init_sqlgenerator = __esm({
|
|
|
16685
16677
|
};
|
|
16686
16678
|
PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
|
|
16687
16679
|
can(statement, dialect7) {
|
|
16688
|
-
return statement.type === "alter_composite_pk" && dialect7 === "
|
|
16680
|
+
return statement.type === "alter_composite_pk" && dialect7 === "pg";
|
|
16689
16681
|
}
|
|
16690
16682
|
convert(statement) {
|
|
16691
16683
|
const { name, columns } = PgSquasher.unsquashPK(statement.old);
|
|
@@ -16808,7 +16800,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16808
16800
|
};
|
|
16809
16801
|
PgAlterTableAlterColumnSetPrimaryKeyConvertor = class extends Convertor {
|
|
16810
16802
|
can(statement, dialect7) {
|
|
16811
|
-
return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "
|
|
16803
|
+
return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "pg";
|
|
16812
16804
|
}
|
|
16813
16805
|
convert(statement) {
|
|
16814
16806
|
const { tableName, columnName } = statement;
|
|
@@ -16818,7 +16810,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16818
16810
|
};
|
|
16819
16811
|
PgAlterTableAlterColumnDropPrimaryKeyConvertor = class extends Convertor {
|
|
16820
16812
|
can(statement, dialect7) {
|
|
16821
|
-
return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "
|
|
16813
|
+
return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "pg";
|
|
16822
16814
|
}
|
|
16823
16815
|
convert(statement) {
|
|
16824
16816
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16842,7 +16834,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16842
16834
|
};
|
|
16843
16835
|
PgAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
|
|
16844
16836
|
can(statement, dialect7) {
|
|
16845
|
-
return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "
|
|
16837
|
+
return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "pg";
|
|
16846
16838
|
}
|
|
16847
16839
|
convert(statement) {
|
|
16848
16840
|
const { tableName, columnName } = statement;
|
|
@@ -16897,7 +16889,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16897
16889
|
};
|
|
16898
16890
|
PgAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
|
|
16899
16891
|
can(statement, dialect7) {
|
|
16900
|
-
return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "
|
|
16892
|
+
return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "pg";
|
|
16901
16893
|
}
|
|
16902
16894
|
convert(statement) {
|
|
16903
16895
|
const { tableName, columnName } = statement;
|
|
@@ -16922,7 +16914,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16922
16914
|
};
|
|
16923
16915
|
PgCreateForeignKeyConvertor = class extends Convertor {
|
|
16924
16916
|
can(statement, dialect7) {
|
|
16925
|
-
return statement.type === "create_reference" && dialect7 === "
|
|
16917
|
+
return statement.type === "create_reference" && dialect7 === "pg";
|
|
16926
16918
|
}
|
|
16927
16919
|
convert(statement) {
|
|
16928
16920
|
const {
|
|
@@ -16987,7 +16979,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16987
16979
|
};
|
|
16988
16980
|
PgAlterForeignKeyConvertor = class extends Convertor {
|
|
16989
16981
|
can(statement, dialect7) {
|
|
16990
|
-
return statement.type === "alter_reference" && dialect7 === "
|
|
16982
|
+
return statement.type === "alter_reference" && dialect7 === "pg";
|
|
16991
16983
|
}
|
|
16992
16984
|
convert(statement) {
|
|
16993
16985
|
const newFk = PgSquasher.unsquashFK(statement.data);
|
|
@@ -17026,7 +17018,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17026
17018
|
};
|
|
17027
17019
|
PgDeleteForeignKeyConvertor = class extends Convertor {
|
|
17028
17020
|
can(statement, dialect7) {
|
|
17029
|
-
return statement.type === "delete_reference" && dialect7 === "
|
|
17021
|
+
return statement.type === "delete_reference" && dialect7 === "pg";
|
|
17030
17022
|
}
|
|
17031
17023
|
convert(statement) {
|
|
17032
17024
|
const tableFrom = statement.tableName;
|
|
@@ -17063,7 +17055,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17063
17055
|
};
|
|
17064
17056
|
CreatePgIndexConvertor = class extends Convertor {
|
|
17065
17057
|
can(statement, dialect7) {
|
|
17066
|
-
return statement.type === "create_index" && dialect7 === "
|
|
17058
|
+
return statement.type === "create_index" && dialect7 === "pg";
|
|
17067
17059
|
}
|
|
17068
17060
|
convert(statement) {
|
|
17069
17061
|
const { name, columns, isUnique } = PgSquasher.unsquashIdx(statement.data);
|
|
@@ -17102,7 +17094,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17102
17094
|
};
|
|
17103
17095
|
PgDropIndexConvertor = class extends Convertor {
|
|
17104
17096
|
can(statement, dialect7) {
|
|
17105
|
-
return statement.type === "drop_index" && dialect7 === "
|
|
17097
|
+
return statement.type === "drop_index" && dialect7 === "pg";
|
|
17106
17098
|
}
|
|
17107
17099
|
convert(statement) {
|
|
17108
17100
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
|
@@ -17111,7 +17103,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17111
17103
|
};
|
|
17112
17104
|
PgCreateSchemaConvertor = class extends Convertor {
|
|
17113
17105
|
can(statement, dialect7) {
|
|
17114
|
-
return statement.type === "create_schema" && dialect7 === "
|
|
17106
|
+
return statement.type === "create_schema" && dialect7 === "pg";
|
|
17115
17107
|
}
|
|
17116
17108
|
convert(statement) {
|
|
17117
17109
|
const { name } = statement;
|
|
@@ -17121,7 +17113,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17121
17113
|
};
|
|
17122
17114
|
PgRenameSchemaConvertor = class extends Convertor {
|
|
17123
17115
|
can(statement, dialect7) {
|
|
17124
|
-
return statement.type === "rename_schema" && dialect7 === "
|
|
17116
|
+
return statement.type === "rename_schema" && dialect7 === "pg";
|
|
17125
17117
|
}
|
|
17126
17118
|
convert(statement) {
|
|
17127
17119
|
const { from, to } = statement;
|
|
@@ -17131,7 +17123,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17131
17123
|
};
|
|
17132
17124
|
PgDropSchemaConvertor = class extends Convertor {
|
|
17133
17125
|
can(statement, dialect7) {
|
|
17134
|
-
return statement.type === "drop_schema" && dialect7 === "
|
|
17126
|
+
return statement.type === "drop_schema" && dialect7 === "pg";
|
|
17135
17127
|
}
|
|
17136
17128
|
convert(statement) {
|
|
17137
17129
|
const { name } = statement;
|
|
@@ -17141,7 +17133,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17141
17133
|
};
|
|
17142
17134
|
PgAlterTableSetSchemaConvertor = class extends Convertor {
|
|
17143
17135
|
can(statement, dialect7) {
|
|
17144
|
-
return statement.type === "alter_table_set_schema" && dialect7 === "
|
|
17136
|
+
return statement.type === "alter_table_set_schema" && dialect7 === "pg";
|
|
17145
17137
|
}
|
|
17146
17138
|
convert(statement) {
|
|
17147
17139
|
const { tableName, schemaFrom, schemaTo } = statement;
|
|
@@ -17151,7 +17143,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17151
17143
|
};
|
|
17152
17144
|
PgAlterTableSetNewSchemaConvertor = class extends Convertor {
|
|
17153
17145
|
can(statement, dialect7) {
|
|
17154
|
-
return statement.type === "alter_table_set_new_schema" && dialect7 === "
|
|
17146
|
+
return statement.type === "alter_table_set_new_schema" && dialect7 === "pg";
|
|
17155
17147
|
}
|
|
17156
17148
|
convert(statement) {
|
|
17157
17149
|
const { tableName, to, from } = statement;
|
|
@@ -17162,7 +17154,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17162
17154
|
};
|
|
17163
17155
|
PgAlterTableRemoveFromSchemaConvertor = class extends Convertor {
|
|
17164
17156
|
can(statement, dialect7) {
|
|
17165
|
-
return statement.type === "alter_table_remove_from_schema" && dialect7 === "
|
|
17157
|
+
return statement.type === "alter_table_remove_from_schema" && dialect7 === "pg";
|
|
17166
17158
|
}
|
|
17167
17159
|
convert(statement) {
|
|
17168
17160
|
const { tableName, schema: schema4 } = statement;
|
|
@@ -18937,7 +18929,7 @@ var pgSuggestions = async (db, statements) => {
|
|
|
18937
18929
|
}
|
|
18938
18930
|
}
|
|
18939
18931
|
}
|
|
18940
|
-
const stmnt = fromJson([statement], "
|
|
18932
|
+
const stmnt = fromJson([statement], "pg")[0];
|
|
18941
18933
|
if (typeof stmnt !== "undefined") {
|
|
18942
18934
|
if (statement.type === "drop_table") {
|
|
18943
18935
|
statementsToExecute.push(
|
package/schemaValidator.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TypeOf } from "zod";
|
|
2
|
-
export declare const dialect: import("zod").ZodEnum<["
|
|
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").
|
|
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: "
|
|
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: "
|
|
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<"
|
|
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: "
|
|
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: "
|
|
724
|
+
dialect: "pg";
|
|
725
725
|
schemas: Record<string, string>;
|
|
726
726
|
_meta: {
|
|
727
727
|
columns: Record<string, string>;
|
package/serializer/pgSchema.d.ts
CHANGED
|
@@ -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<"
|
|
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: "
|
|
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: "
|
|
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").
|
|
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").
|
|
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: "
|
|
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: "
|
|
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<"
|
|
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: "
|
|
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: "
|
|
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<"
|
|
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: "
|
|
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: "
|
|
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: "
|
|
4779
|
+
dialect: "pg";
|
|
4780
4780
|
schemas: Record<string, string>;
|
|
4781
4781
|
_meta: {
|
|
4782
4782
|
columns: Record<string, string>;
|
package/serializer/studio.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ type CustomDefault = {
|
|
|
13
13
|
func: () => unknown;
|
|
14
14
|
};
|
|
15
15
|
export type Setup = {
|
|
16
|
-
dialect: "
|
|
16
|
+
dialect: "pg" | "mysql" | "sqlite";
|
|
17
17
|
proxy: (params: ProxyParams) => Promise<any[] | any>;
|
|
18
18
|
customDefaults: CustomDefault[];
|
|
19
19
|
};
|