drizzle-kit 0.20.17-940f46c → 0.20.17-94708c5
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/@types/utils.d.ts +1 -0
- package/bin.cjs +24320 -14453
- 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 +25 -25
- package/cli/validations/common.d.ts +13 -13
- package/cli/validations/outputs.d.ts +1 -2
- package/cli/views.d.ts +1 -0
- package/index.d.mts +2 -48
- package/index.d.ts +2 -48
- package/package.json +2 -1
- package/payload.js +80 -59
- package/payload.mjs +80 -59
- package/schemaValidator.d.ts +7 -7
- package/serializer/pgSchema.d.ts +14 -14
- package/serializer/studio.d.ts +4 -2
- package/snapshotsDiffer.d.ts +1 -2
- package/utils-studio.js +15 -10
- package/utils-studio.mjs +15 -10
- package/utils.js +5 -5
- package/utils.mjs +5 -5
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("
|
|
4698
|
+
dialect: literalType("postgresql"),
|
|
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:
|
|
4727
|
+
dialect: literalType("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:
|
|
4734
|
+
dialect: literalType("postgresql"),
|
|
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: "
|
|
4845
|
+
dialect: "postgresql",
|
|
4846
4846
|
id: originUUID,
|
|
4847
4847
|
prevId: "",
|
|
4848
4848
|
tables: {},
|
|
@@ -5305,7 +5305,8 @@ 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}
|
|
5308
|
+
suggestion: (str) => `${source_default.white.bgGray(" Suggestion ")} ${str}`,
|
|
5309
|
+
info: (str) => `${source_default.grey(str)}`
|
|
5309
5310
|
};
|
|
5310
5311
|
}
|
|
5311
5312
|
});
|
|
@@ -5327,7 +5328,6 @@ var init_mysql = __esm({
|
|
|
5327
5328
|
}),
|
|
5328
5329
|
objectType({
|
|
5329
5330
|
url: stringType()
|
|
5330
|
-
// TODO: change docs
|
|
5331
5331
|
})
|
|
5332
5332
|
]);
|
|
5333
5333
|
}
|
|
@@ -5391,7 +5391,7 @@ var init_schemaValidator = __esm({
|
|
|
5391
5391
|
init_mysqlSchema();
|
|
5392
5392
|
init_pgSchema();
|
|
5393
5393
|
init_sqliteSchema();
|
|
5394
|
-
dialect3 = enumType(["
|
|
5394
|
+
dialect3 = enumType(["postgresql", "mysql", "sqlite"]);
|
|
5395
5395
|
commonSquashedSchema = unionType([
|
|
5396
5396
|
pgSchemaSquashed,
|
|
5397
5397
|
mysqlSchemaSquashed,
|
|
@@ -5511,8 +5511,8 @@ var init_cli = __esm({
|
|
|
5511
5511
|
dialect: dialect3,
|
|
5512
5512
|
schema: unionType([stringType(), stringType().array()]).optional(),
|
|
5513
5513
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
|
5514
|
-
|
|
5515
|
-
driver: stringType(),
|
|
5514
|
+
schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
|
5515
|
+
driver: stringType().optional(),
|
|
5516
5516
|
// pg
|
|
5517
5517
|
connectionString: stringType().optional(),
|
|
5518
5518
|
// mysql
|
|
@@ -5548,9 +5548,9 @@ var init_cli = __esm({
|
|
|
5548
5548
|
ssl: stringType().optional(),
|
|
5549
5549
|
url: stringType().optional(),
|
|
5550
5550
|
authToken: stringType().optional(),
|
|
5551
|
-
|
|
5551
|
+
introspectCasing: casing,
|
|
5552
5552
|
breakpoints: booleanType().optional().default(true)
|
|
5553
|
-
});
|
|
5553
|
+
}).passthrough();
|
|
5554
5554
|
configCheck = objectType({
|
|
5555
5555
|
dialect: dialect3.optional(),
|
|
5556
5556
|
out: stringType().optional()
|
|
@@ -11502,7 +11502,7 @@ ${withStyle.errorWarning(
|
|
|
11502
11502
|
);
|
|
11503
11503
|
return {
|
|
11504
11504
|
version: "6",
|
|
11505
|
-
dialect: "
|
|
11505
|
+
dialect: "postgresql",
|
|
11506
11506
|
tables: result,
|
|
11507
11507
|
enums: enumsToReturn,
|
|
11508
11508
|
schemas: schemasObject,
|
|
@@ -11709,7 +11709,7 @@ ${withStyle.errorWarning(
|
|
|
11709
11709
|
const columnName = columnResponse.attname;
|
|
11710
11710
|
const columnAdditionalDT = columnResponse.additional_dt;
|
|
11711
11711
|
const columnDimensions = columnResponse.array_dimensions;
|
|
11712
|
-
const
|
|
11712
|
+
const enumType3 = columnResponse.enum_name;
|
|
11713
11713
|
let columnType = columnResponse.data_type;
|
|
11714
11714
|
const primaryKey = tableConstraints.filter(
|
|
11715
11715
|
(mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "PRIMARY KEY"
|
|
@@ -11773,8 +11773,8 @@ ${withStyle.errorWarning(
|
|
|
11773
11773
|
columnTypeMapped = trimChar(columnTypeMapped, '"');
|
|
11774
11774
|
columnToReturn[columnName] = {
|
|
11775
11775
|
name: columnName,
|
|
11776
|
-
type: columnAdditionalDT === "USER-DEFINED" ?
|
|
11777
|
-
typeSchema: enumsToReturn[`${tableSchema}.${
|
|
11776
|
+
type: columnAdditionalDT === "USER-DEFINED" ? enumType3 : columnTypeMapped,
|
|
11777
|
+
typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
|
|
11778
11778
|
primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
|
|
11779
11779
|
// default: isSerial ? undefined : defaultValue,
|
|
11780
11780
|
notNull: columnResponse.is_nullable === "NO"
|
|
@@ -11857,7 +11857,7 @@ ${withStyle.errorWarning(
|
|
|
11857
11857
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
|
11858
11858
|
return {
|
|
11859
11859
|
version: "6",
|
|
11860
|
-
dialect: "
|
|
11860
|
+
dialect: "postgresql",
|
|
11861
11861
|
tables: result,
|
|
11862
11862
|
enums: enumsToReturn,
|
|
11863
11863
|
schemas: schemasObject,
|
|
@@ -15088,7 +15088,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
15088
15088
|
const jsonTableAlternations = alteredTables.map((it) => {
|
|
15089
15089
|
return preparePgAlterColumns(it.name, it.schema, it.altered, json2);
|
|
15090
15090
|
}).flat();
|
|
15091
|
-
const
|
|
15091
|
+
const jsonCreateIndexesFoAlteredTables = alteredTables.map((it) => {
|
|
15092
15092
|
return prepareCreateIndexesJson(
|
|
15093
15093
|
it.name,
|
|
15094
15094
|
it.schema,
|
|
@@ -15117,14 +15117,21 @@ var init_snapshotsDiffer = __esm({
|
|
|
15117
15117
|
},
|
|
15118
15118
|
{}
|
|
15119
15119
|
);
|
|
15120
|
-
|
|
15120
|
+
jsonCreateIndexesFoAlteredTables.push(
|
|
15121
15121
|
...prepareCreateIndexesJson(it.name, it.schema, createdIndexes || {})
|
|
15122
15122
|
);
|
|
15123
15123
|
jsonDropIndexesForAllAlteredTables.push(
|
|
15124
15124
|
...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
|
|
15125
15125
|
);
|
|
15126
15126
|
});
|
|
15127
|
-
const
|
|
15127
|
+
const jsonCreateReferencesForCreatedTables = createdTables.map((it) => {
|
|
15128
|
+
return prepareCreateReferencesJson(
|
|
15129
|
+
it.name,
|
|
15130
|
+
it.schema,
|
|
15131
|
+
it.foreignKeys
|
|
15132
|
+
);
|
|
15133
|
+
}).flat();
|
|
15134
|
+
const jsonReferencesForAlteredTables = alteredTables.map((it) => {
|
|
15128
15135
|
const forAdded = prepareCreateReferencesJson(
|
|
15129
15136
|
it.name,
|
|
15130
15137
|
it.schema,
|
|
@@ -15142,10 +15149,10 @@ var init_snapshotsDiffer = __esm({
|
|
|
15142
15149
|
);
|
|
15143
15150
|
return [...forAdded, ...forAltered, ...alteredFKs];
|
|
15144
15151
|
}).flat();
|
|
15145
|
-
const jsonCreatedReferencesForAlteredTables =
|
|
15152
|
+
const jsonCreatedReferencesForAlteredTables = jsonReferencesForAlteredTables.filter(
|
|
15146
15153
|
(t) => t.type === "create_reference"
|
|
15147
15154
|
);
|
|
15148
|
-
const jsonDroppedReferencesForAlteredTables =
|
|
15155
|
+
const jsonDroppedReferencesForAlteredTables = jsonReferencesForAlteredTables.filter(
|
|
15149
15156
|
(t) => t.type === "delete_reference"
|
|
15150
15157
|
);
|
|
15151
15158
|
const createEnums = createdEnums.map((it) => {
|
|
@@ -15172,7 +15179,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
15172
15179
|
const dropSchemas = prepareDeleteSchemasJson(
|
|
15173
15180
|
deletedSchemas.map((it) => it.name)
|
|
15174
15181
|
);
|
|
15175
|
-
const
|
|
15182
|
+
const createTables = createdTables.map((it) => {
|
|
15176
15183
|
return preparePgCreateTableJson(it, curFull);
|
|
15177
15184
|
});
|
|
15178
15185
|
jsonStatements.push(...createSchemas);
|
|
@@ -15181,7 +15188,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
15181
15188
|
jsonStatements.push(...moveEnums);
|
|
15182
15189
|
jsonStatements.push(...renameEnums);
|
|
15183
15190
|
jsonStatements.push(...jsonAlterEnumsWithAddedValues);
|
|
15184
|
-
jsonStatements.push(...
|
|
15191
|
+
jsonStatements.push(...createTables);
|
|
15185
15192
|
jsonStatements.push(...jsonDropTables);
|
|
15186
15193
|
jsonStatements.push(...jsonSetTableSchemas);
|
|
15187
15194
|
jsonStatements.push(...jsonRenameTables);
|
|
@@ -15192,15 +15199,16 @@ var init_snapshotsDiffer = __esm({
|
|
|
15192
15199
|
jsonStatements.push(...jsonTableAlternations);
|
|
15193
15200
|
jsonStatements.push(...jsonAddedCompositePKs);
|
|
15194
15201
|
jsonStatements.push(...jsonAddColumnsStatemets);
|
|
15202
|
+
jsonStatements.push(...jsonCreateReferencesForCreatedTables);
|
|
15195
15203
|
jsonStatements.push(...jsonCreateIndexesForCreatedTables);
|
|
15196
|
-
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
|
15197
15204
|
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
|
|
15205
|
+
jsonStatements.push(...jsonCreateIndexesFoAlteredTables);
|
|
15198
15206
|
jsonStatements.push(...jsonDropColumnsStatemets);
|
|
15199
15207
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
|
15200
15208
|
jsonStatements.push(...jsonAlteredUniqueConstraints);
|
|
15201
15209
|
jsonStatements.push(...dropEnums);
|
|
15202
15210
|
jsonStatements.push(...dropSchemas);
|
|
15203
|
-
const sqlStatements = fromJson(jsonStatements, "
|
|
15211
|
+
const sqlStatements = fromJson(jsonStatements, "postgresql");
|
|
15204
15212
|
const uniqueSqlStatements = [];
|
|
15205
15213
|
sqlStatements.forEach((ss) => {
|
|
15206
15214
|
if (!uniqueSqlStatements.includes(ss)) {
|
|
@@ -15338,8 +15346,8 @@ var init_snapshotsDiffer = __esm({
|
|
|
15338
15346
|
const jsonDeletedUniqueConstraints = [];
|
|
15339
15347
|
const jsonAlteredUniqueConstraints = [];
|
|
15340
15348
|
const jsonRenameColumnsStatements = columnRenames.map((it) => prepareRenameColumns(it.table, "", it.renames)).flat();
|
|
15349
|
+
const jsonAddColumnsStatemets = columnCreates.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
|
|
15341
15350
|
const jsonDropColumnsStatemets = columnDeletes.map((it) => _prepareDropColumns(it.table, "", it.columns)).flat();
|
|
15342
|
-
const jsonAddColumnsStatemets = columnDeletes.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
|
|
15343
15351
|
alteredTables.forEach((it) => {
|
|
15344
15352
|
let addedColumns = [];
|
|
15345
15353
|
for (const addedPkName of Object.keys(it.addedCompositePKs)) {
|
|
@@ -15453,6 +15461,13 @@ var init_snapshotsDiffer = __esm({
|
|
|
15453
15461
|
...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
|
|
15454
15462
|
);
|
|
15455
15463
|
});
|
|
15464
|
+
const jsonCreateReferencesForCreatedTables = createdTables.map((it) => {
|
|
15465
|
+
return prepareCreateReferencesJson(
|
|
15466
|
+
it.name,
|
|
15467
|
+
it.schema,
|
|
15468
|
+
it.foreignKeys
|
|
15469
|
+
);
|
|
15470
|
+
}).flat();
|
|
15456
15471
|
const jsonReferencesForAllAlteredTables = alteredTables.map((it) => {
|
|
15457
15472
|
const forAdded = prepareCreateReferencesJson(
|
|
15458
15473
|
it.name,
|
|
@@ -15493,9 +15508,10 @@ var init_snapshotsDiffer = __esm({
|
|
|
15493
15508
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
|
15494
15509
|
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
|
15495
15510
|
jsonStatements.push(...jsonAddColumnsStatemets);
|
|
15511
|
+
jsonStatements.push(...jsonCreateReferencesForCreatedTables);
|
|
15496
15512
|
jsonStatements.push(...jsonCreateIndexesForCreatedTables);
|
|
15497
|
-
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
|
15498
15513
|
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
|
|
15514
|
+
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
|
15499
15515
|
jsonStatements.push(...jsonDropColumnsStatemets);
|
|
15500
15516
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
|
15501
15517
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
|
@@ -16080,7 +16096,7 @@ var init_sqlgenerator = __esm({
|
|
|
16080
16096
|
};
|
|
16081
16097
|
PgCreateTableConvertor = class extends Convertor {
|
|
16082
16098
|
can(statement, dialect7) {
|
|
16083
|
-
return statement.type === "create_table" && dialect7 === "
|
|
16099
|
+
return statement.type === "create_table" && dialect7 === "postgresql";
|
|
16084
16100
|
}
|
|
16085
16101
|
convert(st) {
|
|
16086
16102
|
const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints } = st;
|
|
@@ -16222,7 +16238,7 @@ var init_sqlgenerator = __esm({
|
|
|
16222
16238
|
};
|
|
16223
16239
|
PgAlterTableAddUniqueConstraintConvertor = class extends Convertor {
|
|
16224
16240
|
can(statement, dialect7) {
|
|
16225
|
-
return statement.type === "create_unique_constraint" && dialect7 === "
|
|
16241
|
+
return statement.type === "create_unique_constraint" && dialect7 === "postgresql";
|
|
16226
16242
|
}
|
|
16227
16243
|
convert(statement) {
|
|
16228
16244
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
|
@@ -16232,7 +16248,7 @@ var init_sqlgenerator = __esm({
|
|
|
16232
16248
|
};
|
|
16233
16249
|
PgAlterTableDropUniqueConstraintConvertor = class extends Convertor {
|
|
16234
16250
|
can(statement, dialect7) {
|
|
16235
|
-
return statement.type === "delete_unique_constraint" && dialect7 === "
|
|
16251
|
+
return statement.type === "delete_unique_constraint" && dialect7 === "postgresql";
|
|
16236
16252
|
}
|
|
16237
16253
|
convert(statement) {
|
|
16238
16254
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
|
@@ -16321,7 +16337,7 @@ var init_sqlgenerator = __esm({
|
|
|
16321
16337
|
};
|
|
16322
16338
|
PgDropTableConvertor = class extends Convertor {
|
|
16323
16339
|
can(statement, dialect7) {
|
|
16324
|
-
return statement.type === "drop_table" && dialect7 === "
|
|
16340
|
+
return statement.type === "drop_table" && dialect7 === "postgresql";
|
|
16325
16341
|
}
|
|
16326
16342
|
convert(statement) {
|
|
16327
16343
|
const { tableName, schema: schema4 } = statement;
|
|
@@ -16349,7 +16365,7 @@ var init_sqlgenerator = __esm({
|
|
|
16349
16365
|
};
|
|
16350
16366
|
PgRenameTableConvertor = class extends Convertor {
|
|
16351
16367
|
can(statement, dialect7) {
|
|
16352
|
-
return statement.type === "rename_table" && dialect7 === "
|
|
16368
|
+
return statement.type === "rename_table" && dialect7 === "postgresql";
|
|
16353
16369
|
}
|
|
16354
16370
|
convert(statement) {
|
|
16355
16371
|
const { tableNameFrom, tableNameTo, toSchema, fromSchema } = statement;
|
|
@@ -16380,7 +16396,7 @@ var init_sqlgenerator = __esm({
|
|
|
16380
16396
|
};
|
|
16381
16397
|
PgAlterTableRenameColumnConvertor = class extends Convertor {
|
|
16382
16398
|
can(statement, dialect7) {
|
|
16383
|
-
return statement.type === "alter_table_rename_column" && dialect7 === "
|
|
16399
|
+
return statement.type === "alter_table_rename_column" && dialect7 === "postgresql";
|
|
16384
16400
|
}
|
|
16385
16401
|
convert(statement) {
|
|
16386
16402
|
const { tableName, oldColumnName, newColumnName, schema: schema4 } = statement;
|
|
@@ -16408,7 +16424,7 @@ var init_sqlgenerator = __esm({
|
|
|
16408
16424
|
};
|
|
16409
16425
|
PgAlterTableDropColumnConvertor = class extends Convertor {
|
|
16410
16426
|
can(statement, dialect7) {
|
|
16411
|
-
return statement.type === "alter_table_drop_column" && dialect7 === "
|
|
16427
|
+
return statement.type === "alter_table_drop_column" && dialect7 === "postgresql";
|
|
16412
16428
|
}
|
|
16413
16429
|
convert(statement) {
|
|
16414
16430
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16436,7 +16452,7 @@ var init_sqlgenerator = __esm({
|
|
|
16436
16452
|
};
|
|
16437
16453
|
PgAlterTableAddColumnConvertor = class extends Convertor {
|
|
16438
16454
|
can(statement, dialect7) {
|
|
16439
|
-
return statement.type === "alter_table_add_column" && dialect7 === "
|
|
16455
|
+
return statement.type === "alter_table_add_column" && dialect7 === "postgresql";
|
|
16440
16456
|
}
|
|
16441
16457
|
convert(statement) {
|
|
16442
16458
|
const { tableName, column: column4, schema: schema4 } = statement;
|
|
@@ -16481,7 +16497,7 @@ var init_sqlgenerator = __esm({
|
|
|
16481
16497
|
};
|
|
16482
16498
|
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
|
|
16483
16499
|
can(statement, dialect7) {
|
|
16484
|
-
return statement.type === "alter_table_alter_column_set_type" && dialect7 === "
|
|
16500
|
+
return statement.type === "alter_table_alter_column_set_type" && dialect7 === "postgresql";
|
|
16485
16501
|
}
|
|
16486
16502
|
convert(statement) {
|
|
16487
16503
|
const { tableName, columnName, newDataType, schema: schema4 } = statement;
|
|
@@ -16506,7 +16522,7 @@ var init_sqlgenerator = __esm({
|
|
|
16506
16522
|
};
|
|
16507
16523
|
PgAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
|
|
16508
16524
|
can(statement, dialect7) {
|
|
16509
|
-
return statement.type === "alter_table_alter_column_set_default" && dialect7 === "
|
|
16525
|
+
return statement.type === "alter_table_alter_column_set_default" && dialect7 === "postgresql";
|
|
16510
16526
|
}
|
|
16511
16527
|
convert(statement) {
|
|
16512
16528
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16531,7 +16547,7 @@ var init_sqlgenerator = __esm({
|
|
|
16531
16547
|
};
|
|
16532
16548
|
PgAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
|
|
16533
16549
|
can(statement, dialect7) {
|
|
16534
|
-
return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "
|
|
16550
|
+
return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "postgresql";
|
|
16535
16551
|
}
|
|
16536
16552
|
convert(statement) {
|
|
16537
16553
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16643,7 +16659,7 @@ var init_sqlgenerator = __esm({
|
|
|
16643
16659
|
};
|
|
16644
16660
|
PgAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
|
|
16645
16661
|
can(statement, dialect7) {
|
|
16646
|
-
return statement.type === "create_composite_pk" && dialect7 === "
|
|
16662
|
+
return statement.type === "create_composite_pk" && dialect7 === "postgresql";
|
|
16647
16663
|
}
|
|
16648
16664
|
convert(statement) {
|
|
16649
16665
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
|
@@ -16653,7 +16669,7 @@ var init_sqlgenerator = __esm({
|
|
|
16653
16669
|
};
|
|
16654
16670
|
PgAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
|
|
16655
16671
|
can(statement, dialect7) {
|
|
16656
|
-
return statement.type === "delete_composite_pk" && dialect7 === "
|
|
16672
|
+
return statement.type === "delete_composite_pk" && dialect7 === "postgresql";
|
|
16657
16673
|
}
|
|
16658
16674
|
convert(statement) {
|
|
16659
16675
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
|
@@ -16663,7 +16679,7 @@ var init_sqlgenerator = __esm({
|
|
|
16663
16679
|
};
|
|
16664
16680
|
PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
|
|
16665
16681
|
can(statement, dialect7) {
|
|
16666
|
-
return statement.type === "alter_composite_pk" && dialect7 === "
|
|
16682
|
+
return statement.type === "alter_composite_pk" && dialect7 === "postgresql";
|
|
16667
16683
|
}
|
|
16668
16684
|
convert(statement) {
|
|
16669
16685
|
const { name, columns } = PgSquasher.unsquashPK(statement.old);
|
|
@@ -16786,7 +16802,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16786
16802
|
};
|
|
16787
16803
|
PgAlterTableAlterColumnSetPrimaryKeyConvertor = class extends Convertor {
|
|
16788
16804
|
can(statement, dialect7) {
|
|
16789
|
-
return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "
|
|
16805
|
+
return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "postgresql";
|
|
16790
16806
|
}
|
|
16791
16807
|
convert(statement) {
|
|
16792
16808
|
const { tableName, columnName } = statement;
|
|
@@ -16796,7 +16812,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16796
16812
|
};
|
|
16797
16813
|
PgAlterTableAlterColumnDropPrimaryKeyConvertor = class extends Convertor {
|
|
16798
16814
|
can(statement, dialect7) {
|
|
16799
|
-
return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "
|
|
16815
|
+
return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "postgresql";
|
|
16800
16816
|
}
|
|
16801
16817
|
convert(statement) {
|
|
16802
16818
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16820,7 +16836,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16820
16836
|
};
|
|
16821
16837
|
PgAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
|
|
16822
16838
|
can(statement, dialect7) {
|
|
16823
|
-
return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "
|
|
16839
|
+
return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "postgresql";
|
|
16824
16840
|
}
|
|
16825
16841
|
convert(statement) {
|
|
16826
16842
|
const { tableName, columnName } = statement;
|
|
@@ -16875,7 +16891,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16875
16891
|
};
|
|
16876
16892
|
PgAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
|
|
16877
16893
|
can(statement, dialect7) {
|
|
16878
|
-
return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "
|
|
16894
|
+
return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "postgresql";
|
|
16879
16895
|
}
|
|
16880
16896
|
convert(statement) {
|
|
16881
16897
|
const { tableName, columnName } = statement;
|
|
@@ -16900,7 +16916,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16900
16916
|
};
|
|
16901
16917
|
PgCreateForeignKeyConvertor = class extends Convertor {
|
|
16902
16918
|
can(statement, dialect7) {
|
|
16903
|
-
return statement.type === "create_reference" && dialect7 === "
|
|
16919
|
+
return statement.type === "create_reference" && dialect7 === "postgresql";
|
|
16904
16920
|
}
|
|
16905
16921
|
convert(statement) {
|
|
16906
16922
|
const {
|
|
@@ -16965,7 +16981,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16965
16981
|
};
|
|
16966
16982
|
PgAlterForeignKeyConvertor = class extends Convertor {
|
|
16967
16983
|
can(statement, dialect7) {
|
|
16968
|
-
return statement.type === "alter_reference" && dialect7 === "
|
|
16984
|
+
return statement.type === "alter_reference" && dialect7 === "postgresql";
|
|
16969
16985
|
}
|
|
16970
16986
|
convert(statement) {
|
|
16971
16987
|
const newFk = PgSquasher.unsquashFK(statement.data);
|
|
@@ -17004,7 +17020,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17004
17020
|
};
|
|
17005
17021
|
PgDeleteForeignKeyConvertor = class extends Convertor {
|
|
17006
17022
|
can(statement, dialect7) {
|
|
17007
|
-
return statement.type === "delete_reference" && dialect7 === "
|
|
17023
|
+
return statement.type === "delete_reference" && dialect7 === "postgresql";
|
|
17008
17024
|
}
|
|
17009
17025
|
convert(statement) {
|
|
17010
17026
|
const tableFrom = statement.tableName;
|
|
@@ -17041,7 +17057,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17041
17057
|
};
|
|
17042
17058
|
CreatePgIndexConvertor = class extends Convertor {
|
|
17043
17059
|
can(statement, dialect7) {
|
|
17044
|
-
return statement.type === "create_index" && dialect7 === "
|
|
17060
|
+
return statement.type === "create_index" && dialect7 === "postgresql";
|
|
17045
17061
|
}
|
|
17046
17062
|
convert(statement) {
|
|
17047
17063
|
const { name, columns, isUnique } = PgSquasher.unsquashIdx(statement.data);
|
|
@@ -17080,7 +17096,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17080
17096
|
};
|
|
17081
17097
|
PgDropIndexConvertor = class extends Convertor {
|
|
17082
17098
|
can(statement, dialect7) {
|
|
17083
|
-
return statement.type === "drop_index" && dialect7 === "
|
|
17099
|
+
return statement.type === "drop_index" && dialect7 === "postgresql";
|
|
17084
17100
|
}
|
|
17085
17101
|
convert(statement) {
|
|
17086
17102
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
|
@@ -17089,7 +17105,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17089
17105
|
};
|
|
17090
17106
|
PgCreateSchemaConvertor = class extends Convertor {
|
|
17091
17107
|
can(statement, dialect7) {
|
|
17092
|
-
return statement.type === "create_schema" && dialect7 === "
|
|
17108
|
+
return statement.type === "create_schema" && dialect7 === "postgresql";
|
|
17093
17109
|
}
|
|
17094
17110
|
convert(statement) {
|
|
17095
17111
|
const { name } = statement;
|
|
@@ -17099,7 +17115,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17099
17115
|
};
|
|
17100
17116
|
PgRenameSchemaConvertor = class extends Convertor {
|
|
17101
17117
|
can(statement, dialect7) {
|
|
17102
|
-
return statement.type === "rename_schema" && dialect7 === "
|
|
17118
|
+
return statement.type === "rename_schema" && dialect7 === "postgresql";
|
|
17103
17119
|
}
|
|
17104
17120
|
convert(statement) {
|
|
17105
17121
|
const { from, to } = statement;
|
|
@@ -17109,7 +17125,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17109
17125
|
};
|
|
17110
17126
|
PgDropSchemaConvertor = class extends Convertor {
|
|
17111
17127
|
can(statement, dialect7) {
|
|
17112
|
-
return statement.type === "drop_schema" && dialect7 === "
|
|
17128
|
+
return statement.type === "drop_schema" && dialect7 === "postgresql";
|
|
17113
17129
|
}
|
|
17114
17130
|
convert(statement) {
|
|
17115
17131
|
const { name } = statement;
|
|
@@ -17119,7 +17135,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17119
17135
|
};
|
|
17120
17136
|
PgAlterTableSetSchemaConvertor = class extends Convertor {
|
|
17121
17137
|
can(statement, dialect7) {
|
|
17122
|
-
return statement.type === "alter_table_set_schema" && dialect7 === "
|
|
17138
|
+
return statement.type === "alter_table_set_schema" && dialect7 === "postgresql";
|
|
17123
17139
|
}
|
|
17124
17140
|
convert(statement) {
|
|
17125
17141
|
const { tableName, schemaFrom, schemaTo } = statement;
|
|
@@ -17129,7 +17145,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17129
17145
|
};
|
|
17130
17146
|
PgAlterTableSetNewSchemaConvertor = class extends Convertor {
|
|
17131
17147
|
can(statement, dialect7) {
|
|
17132
|
-
return statement.type === "alter_table_set_new_schema" && dialect7 === "
|
|
17148
|
+
return statement.type === "alter_table_set_new_schema" && dialect7 === "postgresql";
|
|
17133
17149
|
}
|
|
17134
17150
|
convert(statement) {
|
|
17135
17151
|
const { tableName, to, from } = statement;
|
|
@@ -17140,7 +17156,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17140
17156
|
};
|
|
17141
17157
|
PgAlterTableRemoveFromSchemaConvertor = class extends Convertor {
|
|
17142
17158
|
can(statement, dialect7) {
|
|
17143
|
-
return statement.type === "alter_table_remove_from_schema" && dialect7 === "
|
|
17159
|
+
return statement.type === "alter_table_remove_from_schema" && dialect7 === "postgresql";
|
|
17144
17160
|
}
|
|
17145
17161
|
convert(statement) {
|
|
17146
17162
|
const { tableName, schema: schema4 } = statement;
|
|
@@ -17352,7 +17368,9 @@ function mapSqlToSqliteType(sqlType) {
|
|
|
17352
17368
|
return "text";
|
|
17353
17369
|
} else if (lowered.startsWith("blob")) {
|
|
17354
17370
|
return "blob";
|
|
17355
|
-
} else if (["real", "double", "double precision", "float"].some(
|
|
17371
|
+
} else if (["real", "double", "double precision", "float"].some(
|
|
17372
|
+
(it) => lowered.startsWith(it)
|
|
17373
|
+
)) {
|
|
17356
17374
|
return "real";
|
|
17357
17375
|
} else {
|
|
17358
17376
|
return "numeric";
|
|
@@ -17539,7 +17557,7 @@ The unique constraint ${source_default.underline.blue(
|
|
|
17539
17557
|
`SELECT
|
|
17540
17558
|
m.name as "tableName", p.name as "columnName", p.type as "columnType", p."notnull" as "notNull", p.dflt_value as "defaultValue", p.pk as pk
|
|
17541
17559
|
FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
|
|
17542
|
-
WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock' and m.tbl_name != 'libsql_wasm_func_table';
|
|
17560
|
+
WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock' and m.tbl_name != 'libsql_wasm_func_table' and m.tbl_name != '__drizzle_migrations';
|
|
17543
17561
|
`
|
|
17544
17562
|
);
|
|
17545
17563
|
const tablesWithSeq = [];
|
|
@@ -18920,7 +18938,7 @@ var pgSuggestions = async (db, statements) => {
|
|
|
18920
18938
|
}
|
|
18921
18939
|
}
|
|
18922
18940
|
}
|
|
18923
|
-
const stmnt = fromJson([statement], "
|
|
18941
|
+
const stmnt = fromJson([statement], "postgresql")[0];
|
|
18924
18942
|
if (typeof stmnt !== "undefined") {
|
|
18925
18943
|
if (statement.type === "drop_table") {
|
|
18926
18944
|
statementsToExecute.push(
|
|
@@ -19048,6 +19066,9 @@ String.prototype.squashSpaces = function() {
|
|
|
19048
19066
|
String.prototype.camelCase = function() {
|
|
19049
19067
|
return camelCase(String(this));
|
|
19050
19068
|
};
|
|
19069
|
+
String.prototype.capitalise = function() {
|
|
19070
|
+
return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
|
|
19071
|
+
};
|
|
19051
19072
|
String.prototype.concatIf = function(it, condition) {
|
|
19052
19073
|
return condition ? `${this}${it}` : String(this);
|
|
19053
19074
|
};
|