drizzle-kit 0.24.1-fe9c043 → 0.24.2-1a5913a
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/api.js +19 -11
- package/api.mjs +19 -11
- package/bin.cjs +121 -28
- package/index.d.mts +10 -4
- package/index.d.ts +10 -4
- package/package.json +1 -1
- package/utils.js +8 -0
- package/utils.mjs +7 -0
package/api.js
CHANGED
@@ -11545,11 +11545,11 @@ var init_sqlgenerator = __esm({
|
|
11545
11545
|
const schemaPrefix = column4.typeSchema && column4.typeSchema !== "public" ? `"${column4.typeSchema}".` : "";
|
11546
11546
|
const type = isPgNativeType(column4.type) ? column4.type : `${schemaPrefix}"${column4.type}"`;
|
11547
11547
|
const generated = column4.generated;
|
11548
|
-
const generatedStatement = ` GENERATED ALWAYS AS (${generated?.as}) STORED
|
11548
|
+
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated?.as}) STORED` : "";
|
11549
11549
|
const unsquashedIdentity = column4.identity ? PgSquasher.unsquashIdentity(column4.identity) : void 0;
|
11550
11550
|
const identityWithSchema = schema4 ? `"${schema4}"."${unsquashedIdentity?.name}"` : `"${unsquashedIdentity?.name}"`;
|
11551
11551
|
const identity = unsquashedIdentity ? ` GENERATED ${unsquashedIdentity.type === "always" ? "ALWAYS" : "BY DEFAULT"} AS IDENTITY (sequence name ${identityWithSchema}${unsquashedIdentity.increment ? ` INCREMENT BY ${unsquashedIdentity.increment}` : ""}${unsquashedIdentity.minValue ? ` MINVALUE ${unsquashedIdentity.minValue}` : ""}${unsquashedIdentity.maxValue ? ` MAXVALUE ${unsquashedIdentity.maxValue}` : ""}${unsquashedIdentity.startWith ? ` START WITH ${unsquashedIdentity.startWith}` : ""}${unsquashedIdentity.cache ? ` CACHE ${unsquashedIdentity.cache}` : ""}${unsquashedIdentity.cycle ? ` CYCLE` : ""})` : "";
|
11552
|
-
statement += ` "${column4.name}" ${type}${primaryKeyStatement}${defaultStatement}${
|
11552
|
+
statement += ` "${column4.name}" ${type}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${uniqueConstraint4}${identity}`;
|
11553
11553
|
statement += i === columns.length - 1 ? "" : ",\n";
|
11554
11554
|
}
|
11555
11555
|
if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
|
@@ -11595,7 +11595,7 @@ var init_sqlgenerator = __esm({
|
|
11595
11595
|
const onUpdateStatement = column4.onUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
|
11596
11596
|
const autoincrementStatement = column4.autoincrement ? " AUTO_INCREMENT" : "";
|
11597
11597
|
const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS (${column4.generated?.as}) ${column4.generated?.type.toUpperCase()}` : "";
|
11598
|
-
statement += ` \`${column4.name}\` ${column4.type}${autoincrementStatement}${primaryKeyStatement}${notNullStatement}${defaultStatement}${onUpdateStatement}
|
11598
|
+
statement += ` \`${column4.name}\` ${column4.type}${autoincrementStatement}${primaryKeyStatement}${generatedStatement}${notNullStatement}${defaultStatement}${onUpdateStatement}`;
|
11599
11599
|
statement += i === columns.length - 1 ? "" : ",\n";
|
11600
11600
|
}
|
11601
11601
|
if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
|
@@ -11643,7 +11643,7 @@ var init_sqlgenerator = __esm({
|
|
11643
11643
|
const autoincrementStatement = column4.autoincrement ? " AUTOINCREMENT" : "";
|
11644
11644
|
const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS ${column4.generated.as} ${column4.generated.type.toUpperCase()}` : "";
|
11645
11645
|
statement += " ";
|
11646
|
-
statement += `\`${column4.name}\` ${column4.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${
|
11646
|
+
statement += `\`${column4.name}\` ${column4.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${generatedStatement}${notNullStatement}`;
|
11647
11647
|
statement += i === columns.length - 1 ? "" : ",\n";
|
11648
11648
|
}
|
11649
11649
|
compositePKs.forEach((it) => {
|
@@ -12033,8 +12033,8 @@ var init_sqlgenerator = __esm({
|
|
12033
12033
|
const unsquashedIdentity = identity ? PgSquasher.unsquashIdentity(identity) : void 0;
|
12034
12034
|
const identityWithSchema = schema4 ? `"${schema4}"."${unsquashedIdentity?.name}"` : `"${unsquashedIdentity?.name}"`;
|
12035
12035
|
const identityStatement = unsquashedIdentity ? ` GENERATED ${unsquashedIdentity.type === "always" ? "ALWAYS" : "BY DEFAULT"} AS IDENTITY (sequence name ${identityWithSchema}${unsquashedIdentity.increment ? ` INCREMENT BY ${unsquashedIdentity.increment}` : ""}${unsquashedIdentity.minValue ? ` MINVALUE ${unsquashedIdentity.minValue}` : ""}${unsquashedIdentity.maxValue ? ` MAXVALUE ${unsquashedIdentity.maxValue}` : ""}${unsquashedIdentity.startWith ? ` START WITH ${unsquashedIdentity.startWith}` : ""}${unsquashedIdentity.cache ? ` CACHE ${unsquashedIdentity.cache}` : ""}${unsquashedIdentity.cycle ? ` CYCLE` : ""})` : "";
|
12036
|
-
const generatedStatement = ` GENERATED ALWAYS AS (${generated?.as}) STORED
|
12037
|
-
return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name2}" ${fixedType}${primaryKeyStatement}${defaultStatement}${
|
12036
|
+
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated?.as}) STORED` : "";
|
12037
|
+
return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name2}" ${fixedType}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${identityStatement};`;
|
12038
12038
|
}
|
12039
12039
|
};
|
12040
12040
|
MySqlAlterTableAddColumnConvertor = class extends Convertor {
|
@@ -12058,7 +12058,7 @@ var init_sqlgenerator = __esm({
|
|
12058
12058
|
const autoincrementStatement = `${autoincrement ? " AUTO_INCREMENT" : ""}`;
|
12059
12059
|
const onUpdateStatement = `${onUpdate ? " ON UPDATE CURRENT_TIMESTAMP" : ""}`;
|
12060
12060
|
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated?.as}) ${generated?.type.toUpperCase()}` : "";
|
12061
|
-
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${
|
12061
|
+
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${generatedStatement}${notNullStatement}${onUpdateStatement};`;
|
12062
12062
|
}
|
12063
12063
|
};
|
12064
12064
|
SQLiteAlterTableAddColumnConvertor = class extends Convertor {
|
@@ -12074,7 +12074,7 @@ var init_sqlgenerator = __esm({
|
|
12074
12074
|
const referenceAsObject = referenceData ? SQLiteSquasher.unsquashFK(referenceData) : void 0;
|
12075
12075
|
const referenceStatement = `${referenceAsObject ? ` REFERENCES ${referenceAsObject.tableTo}(${referenceAsObject.columnsTo})` : ""}`;
|
12076
12076
|
const generatedStatement = generated ? ` GENERATED ALWAYS AS ${generated.as} ${generated.type.toUpperCase()}` : "";
|
12077
|
-
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${defaultStatement}${
|
12077
|
+
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${referenceStatement};`;
|
12078
12078
|
}
|
12079
12079
|
};
|
12080
12080
|
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
|
@@ -12534,7 +12534,7 @@ var init_sqlgenerator = __esm({
|
|
12534
12534
|
columnGenerated = statement.columnGenerated ? ` GENERATED ALWAYS AS (${statement.columnGenerated?.as}) ${statement.columnGenerated?.type.toUpperCase()}` : "";
|
12535
12535
|
}
|
12536
12536
|
columnDefault = columnDefault instanceof Date ? columnDefault.toISOString() : columnDefault;
|
12537
|
-
return `ALTER TABLE \`${tableName}\` MODIFY COLUMN \`${columnName}\`${columnType}${columnAutoincrement}${columnNotNull}${columnDefault}${columnOnUpdate}
|
12537
|
+
return `ALTER TABLE \`${tableName}\` MODIFY COLUMN \`${columnName}\`${columnType}${columnAutoincrement}${columnGenerated}${columnNotNull}${columnDefault}${columnOnUpdate};`;
|
12538
12538
|
}
|
12539
12539
|
};
|
12540
12540
|
SqliteAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
|
@@ -15865,7 +15865,7 @@ var init_schemaValidator = __esm({
|
|
15865
15865
|
});
|
15866
15866
|
|
15867
15867
|
// src/cli/validations/common.ts
|
15868
|
-
var sqliteDriversLiterals, prefixes, prefix, sqliteDriver, postgresDriver, driver, configMigrations, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema;
|
15868
|
+
var sqliteDriversLiterals, postgresqlDriversLiterals, prefixes, prefix, sqliteDriver, postgresDriver, driver, configMigrations, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema;
|
15869
15869
|
var init_common = __esm({
|
15870
15870
|
"src/cli/validations/common.ts"() {
|
15871
15871
|
"use strict";
|
@@ -15877,6 +15877,10 @@ var init_common = __esm({
|
|
15877
15877
|
literalType("d1-http"),
|
15878
15878
|
literalType("expo")
|
15879
15879
|
];
|
15880
|
+
postgresqlDriversLiterals = [
|
15881
|
+
literalType("aws-data-api"),
|
15882
|
+
literalType("pglite")
|
15883
|
+
];
|
15880
15884
|
prefixes = [
|
15881
15885
|
"index",
|
15882
15886
|
"timestamp",
|
@@ -15889,7 +15893,7 @@ var init_common = __esm({
|
|
15889
15893
|
const _2 = "";
|
15890
15894
|
}
|
15891
15895
|
sqliteDriver = unionType(sqliteDriversLiterals);
|
15892
|
-
postgresDriver =
|
15896
|
+
postgresDriver = unionType(postgresqlDriversLiterals);
|
15893
15897
|
driver = unionType([sqliteDriver, postgresDriver]);
|
15894
15898
|
configMigrations = objectType({
|
15895
15899
|
table: stringType().optional(),
|
@@ -34028,6 +34032,10 @@ var init_postgres = __esm({
|
|
34028
34032
|
database: stringType().min(1),
|
34029
34033
|
secretArn: stringType().min(1),
|
34030
34034
|
resourceArn: stringType().min(1)
|
34035
|
+
}),
|
34036
|
+
objectType({
|
34037
|
+
driver: literalType("pglite"),
|
34038
|
+
url: stringType().min(1)
|
34031
34039
|
})
|
34032
34040
|
]);
|
34033
34041
|
}
|
package/api.mjs
CHANGED
@@ -11550,11 +11550,11 @@ var init_sqlgenerator = __esm({
|
|
11550
11550
|
const schemaPrefix = column4.typeSchema && column4.typeSchema !== "public" ? `"${column4.typeSchema}".` : "";
|
11551
11551
|
const type = isPgNativeType(column4.type) ? column4.type : `${schemaPrefix}"${column4.type}"`;
|
11552
11552
|
const generated = column4.generated;
|
11553
|
-
const generatedStatement = ` GENERATED ALWAYS AS (${generated?.as}) STORED
|
11553
|
+
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated?.as}) STORED` : "";
|
11554
11554
|
const unsquashedIdentity = column4.identity ? PgSquasher.unsquashIdentity(column4.identity) : void 0;
|
11555
11555
|
const identityWithSchema = schema4 ? `"${schema4}"."${unsquashedIdentity?.name}"` : `"${unsquashedIdentity?.name}"`;
|
11556
11556
|
const identity = unsquashedIdentity ? ` GENERATED ${unsquashedIdentity.type === "always" ? "ALWAYS" : "BY DEFAULT"} AS IDENTITY (sequence name ${identityWithSchema}${unsquashedIdentity.increment ? ` INCREMENT BY ${unsquashedIdentity.increment}` : ""}${unsquashedIdentity.minValue ? ` MINVALUE ${unsquashedIdentity.minValue}` : ""}${unsquashedIdentity.maxValue ? ` MAXVALUE ${unsquashedIdentity.maxValue}` : ""}${unsquashedIdentity.startWith ? ` START WITH ${unsquashedIdentity.startWith}` : ""}${unsquashedIdentity.cache ? ` CACHE ${unsquashedIdentity.cache}` : ""}${unsquashedIdentity.cycle ? ` CYCLE` : ""})` : "";
|
11557
|
-
statement += ` "${column4.name}" ${type}${primaryKeyStatement}${defaultStatement}${
|
11557
|
+
statement += ` "${column4.name}" ${type}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${uniqueConstraint4}${identity}`;
|
11558
11558
|
statement += i === columns.length - 1 ? "" : ",\n";
|
11559
11559
|
}
|
11560
11560
|
if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
|
@@ -11600,7 +11600,7 @@ var init_sqlgenerator = __esm({
|
|
11600
11600
|
const onUpdateStatement = column4.onUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
|
11601
11601
|
const autoincrementStatement = column4.autoincrement ? " AUTO_INCREMENT" : "";
|
11602
11602
|
const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS (${column4.generated?.as}) ${column4.generated?.type.toUpperCase()}` : "";
|
11603
|
-
statement += ` \`${column4.name}\` ${column4.type}${autoincrementStatement}${primaryKeyStatement}${notNullStatement}${defaultStatement}${onUpdateStatement}
|
11603
|
+
statement += ` \`${column4.name}\` ${column4.type}${autoincrementStatement}${primaryKeyStatement}${generatedStatement}${notNullStatement}${defaultStatement}${onUpdateStatement}`;
|
11604
11604
|
statement += i === columns.length - 1 ? "" : ",\n";
|
11605
11605
|
}
|
11606
11606
|
if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
|
@@ -11648,7 +11648,7 @@ var init_sqlgenerator = __esm({
|
|
11648
11648
|
const autoincrementStatement = column4.autoincrement ? " AUTOINCREMENT" : "";
|
11649
11649
|
const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS ${column4.generated.as} ${column4.generated.type.toUpperCase()}` : "";
|
11650
11650
|
statement += " ";
|
11651
|
-
statement += `\`${column4.name}\` ${column4.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${
|
11651
|
+
statement += `\`${column4.name}\` ${column4.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${generatedStatement}${notNullStatement}`;
|
11652
11652
|
statement += i === columns.length - 1 ? "" : ",\n";
|
11653
11653
|
}
|
11654
11654
|
compositePKs.forEach((it) => {
|
@@ -12038,8 +12038,8 @@ var init_sqlgenerator = __esm({
|
|
12038
12038
|
const unsquashedIdentity = identity ? PgSquasher.unsquashIdentity(identity) : void 0;
|
12039
12039
|
const identityWithSchema = schema4 ? `"${schema4}"."${unsquashedIdentity?.name}"` : `"${unsquashedIdentity?.name}"`;
|
12040
12040
|
const identityStatement = unsquashedIdentity ? ` GENERATED ${unsquashedIdentity.type === "always" ? "ALWAYS" : "BY DEFAULT"} AS IDENTITY (sequence name ${identityWithSchema}${unsquashedIdentity.increment ? ` INCREMENT BY ${unsquashedIdentity.increment}` : ""}${unsquashedIdentity.minValue ? ` MINVALUE ${unsquashedIdentity.minValue}` : ""}${unsquashedIdentity.maxValue ? ` MAXVALUE ${unsquashedIdentity.maxValue}` : ""}${unsquashedIdentity.startWith ? ` START WITH ${unsquashedIdentity.startWith}` : ""}${unsquashedIdentity.cache ? ` CACHE ${unsquashedIdentity.cache}` : ""}${unsquashedIdentity.cycle ? ` CYCLE` : ""})` : "";
|
12041
|
-
const generatedStatement = ` GENERATED ALWAYS AS (${generated?.as}) STORED
|
12042
|
-
return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name2}" ${fixedType}${primaryKeyStatement}${defaultStatement}${
|
12041
|
+
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated?.as}) STORED` : "";
|
12042
|
+
return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name2}" ${fixedType}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${identityStatement};`;
|
12043
12043
|
}
|
12044
12044
|
};
|
12045
12045
|
MySqlAlterTableAddColumnConvertor = class extends Convertor {
|
@@ -12063,7 +12063,7 @@ var init_sqlgenerator = __esm({
|
|
12063
12063
|
const autoincrementStatement = `${autoincrement ? " AUTO_INCREMENT" : ""}`;
|
12064
12064
|
const onUpdateStatement = `${onUpdate ? " ON UPDATE CURRENT_TIMESTAMP" : ""}`;
|
12065
12065
|
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated?.as}) ${generated?.type.toUpperCase()}` : "";
|
12066
|
-
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${
|
12066
|
+
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${generatedStatement}${notNullStatement}${onUpdateStatement};`;
|
12067
12067
|
}
|
12068
12068
|
};
|
12069
12069
|
SQLiteAlterTableAddColumnConvertor = class extends Convertor {
|
@@ -12079,7 +12079,7 @@ var init_sqlgenerator = __esm({
|
|
12079
12079
|
const referenceAsObject = referenceData ? SQLiteSquasher.unsquashFK(referenceData) : void 0;
|
12080
12080
|
const referenceStatement = `${referenceAsObject ? ` REFERENCES ${referenceAsObject.tableTo}(${referenceAsObject.columnsTo})` : ""}`;
|
12081
12081
|
const generatedStatement = generated ? ` GENERATED ALWAYS AS ${generated.as} ${generated.type.toUpperCase()}` : "";
|
12082
|
-
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${defaultStatement}${
|
12082
|
+
return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${referenceStatement};`;
|
12083
12083
|
}
|
12084
12084
|
};
|
12085
12085
|
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
|
@@ -12539,7 +12539,7 @@ var init_sqlgenerator = __esm({
|
|
12539
12539
|
columnGenerated = statement.columnGenerated ? ` GENERATED ALWAYS AS (${statement.columnGenerated?.as}) ${statement.columnGenerated?.type.toUpperCase()}` : "";
|
12540
12540
|
}
|
12541
12541
|
columnDefault = columnDefault instanceof Date ? columnDefault.toISOString() : columnDefault;
|
12542
|
-
return `ALTER TABLE \`${tableName}\` MODIFY COLUMN \`${columnName}\`${columnType}${columnAutoincrement}${columnNotNull}${columnDefault}${columnOnUpdate}
|
12542
|
+
return `ALTER TABLE \`${tableName}\` MODIFY COLUMN \`${columnName}\`${columnType}${columnAutoincrement}${columnGenerated}${columnNotNull}${columnDefault}${columnOnUpdate};`;
|
12543
12543
|
}
|
12544
12544
|
};
|
12545
12545
|
SqliteAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
|
@@ -15870,7 +15870,7 @@ var init_schemaValidator = __esm({
|
|
15870
15870
|
});
|
15871
15871
|
|
15872
15872
|
// src/cli/validations/common.ts
|
15873
|
-
var sqliteDriversLiterals, prefixes, prefix, sqliteDriver, postgresDriver, driver, configMigrations, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema;
|
15873
|
+
var sqliteDriversLiterals, postgresqlDriversLiterals, prefixes, prefix, sqliteDriver, postgresDriver, driver, configMigrations, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema;
|
15874
15874
|
var init_common = __esm({
|
15875
15875
|
"src/cli/validations/common.ts"() {
|
15876
15876
|
"use strict";
|
@@ -15882,6 +15882,10 @@ var init_common = __esm({
|
|
15882
15882
|
literalType("d1-http"),
|
15883
15883
|
literalType("expo")
|
15884
15884
|
];
|
15885
|
+
postgresqlDriversLiterals = [
|
15886
|
+
literalType("aws-data-api"),
|
15887
|
+
literalType("pglite")
|
15888
|
+
];
|
15885
15889
|
prefixes = [
|
15886
15890
|
"index",
|
15887
15891
|
"timestamp",
|
@@ -15894,7 +15898,7 @@ var init_common = __esm({
|
|
15894
15898
|
const _2 = "";
|
15895
15899
|
}
|
15896
15900
|
sqliteDriver = unionType(sqliteDriversLiterals);
|
15897
|
-
postgresDriver =
|
15901
|
+
postgresDriver = unionType(postgresqlDriversLiterals);
|
15898
15902
|
driver = unionType([sqliteDriver, postgresDriver]);
|
15899
15903
|
configMigrations = objectType({
|
15900
15904
|
table: stringType().optional(),
|
@@ -34033,6 +34037,10 @@ var init_postgres = __esm({
|
|
34033
34037
|
database: stringType().min(1),
|
34034
34038
|
secretArn: stringType().min(1),
|
34035
34039
|
resourceArn: stringType().min(1)
|
34040
|
+
}),
|
34041
|
+
objectType({
|
34042
|
+
driver: literalType("pglite"),
|
34043
|
+
url: stringType().min(1)
|
34036
34044
|
})
|
34037
34045
|
]);
|
34038
34046
|
}
|
package/bin.cjs
CHANGED
@@ -6584,7 +6584,7 @@ var init_sqliteSchema = __esm({
|
|
6584
6584
|
function isPgArrayType(sqlType) {
|
6585
6585
|
return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
|
6586
6586
|
}
|
6587
|
-
var import_fs, import_path, import_url, copy, objectValues, assertV1OutFolder, dryJournal, prepareOutFolder, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey, normaliseSQLiteUrl;
|
6587
|
+
var import_fs, import_path, import_url, copy, objectValues, assertV1OutFolder, dryJournal, prepareOutFolder, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey, normaliseSQLiteUrl, normalisePGliteUrl;
|
6588
6588
|
var init_utils = __esm({
|
6589
6589
|
"src/utils.ts"() {
|
6590
6590
|
"use strict";
|
@@ -6781,6 +6781,12 @@ var init_utils = __esm({
|
|
6781
6781
|
}
|
6782
6782
|
assertUnreachable(type);
|
6783
6783
|
};
|
6784
|
+
normalisePGliteUrl = (it) => {
|
6785
|
+
if (it.startsWith("file:")) {
|
6786
|
+
return it.substring(5);
|
6787
|
+
}
|
6788
|
+
return it;
|
6789
|
+
};
|
6784
6790
|
}
|
6785
6791
|
});
|
6786
6792
|
|
@@ -11235,7 +11241,7 @@ var init_outputs = __esm({
|
|
11235
11241
|
});
|
11236
11242
|
|
11237
11243
|
// src/cli/validations/common.ts
|
11238
|
-
var assertCollisions, sqliteDriversLiterals, prefixes, prefix, sqliteDriver, postgresDriver, driver, configMigrations, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema, drivers, wrapParam;
|
11244
|
+
var assertCollisions, sqliteDriversLiterals, postgresqlDriversLiterals, prefixes, prefix, sqliteDriver, postgresDriver, driver, configMigrations, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema, drivers, wrapParam;
|
11239
11245
|
var init_common = __esm({
|
11240
11246
|
"src/cli/validations/common.ts"() {
|
11241
11247
|
"use strict";
|
@@ -11265,6 +11271,10 @@ var init_common = __esm({
|
|
11265
11271
|
literalType("d1-http"),
|
11266
11272
|
literalType("expo")
|
11267
11273
|
];
|
11274
|
+
postgresqlDriversLiterals = [
|
11275
|
+
literalType("aws-data-api"),
|
11276
|
+
literalType("pglite")
|
11277
|
+
];
|
11268
11278
|
prefixes = [
|
11269
11279
|
"index",
|
11270
11280
|
"timestamp",
|
@@ -11277,7 +11287,7 @@ var init_common = __esm({
|
|
11277
11287
|
const _2 = "";
|
11278
11288
|
}
|
11279
11289
|
sqliteDriver = unionType(sqliteDriversLiterals);
|
11280
|
-
postgresDriver =
|
11290
|
+
postgresDriver = unionType(postgresqlDriversLiterals);
|
11281
11291
|
driver = unionType([sqliteDriver, postgresDriver]);
|
11282
11292
|
configMigrations = objectType({
|
11283
11293
|
table: stringType().optional(),
|
@@ -11333,7 +11343,7 @@ var init_common = __esm({
|
|
11333
11343
|
strict: booleanType().default(false),
|
11334
11344
|
out: stringType().optional()
|
11335
11345
|
});
|
11336
|
-
drivers = ["turso", "d1-http", "expo", "aws-data-api"];
|
11346
|
+
drivers = ["turso", "d1-http", "expo", "aws-data-api", "pglite"];
|
11337
11347
|
wrapParam = (name, param, optional = false, type) => {
|
11338
11348
|
const check2 = `[${source_default.green("\u2713")}]`;
|
11339
11349
|
const cross = `[${source_default.red("x")}]`;
|
@@ -11505,6 +11515,10 @@ var init_postgres = __esm({
|
|
11505
11515
|
database: stringType().min(1),
|
11506
11516
|
secretArn: stringType().min(1),
|
11507
11517
|
resourceArn: stringType().min(1)
|
11518
|
+
}),
|
11519
|
+
objectType({
|
11520
|
+
driver: literalType("pglite"),
|
11521
|
+
url: stringType().min(1)
|
11508
11522
|
})
|
11509
11523
|
]);
|
11510
11524
|
printConfigConnectionIssues2 = (options) => {
|
@@ -22981,11 +22995,11 @@ var init_sqlgenerator = __esm({
|
|
22981
22995
|
const schemaPrefix = column7.typeSchema && column7.typeSchema !== "public" ? `"${column7.typeSchema}".` : "";
|
22982
22996
|
const type = isPgNativeType(column7.type) ? column7.type : `${schemaPrefix}"${column7.type}"`;
|
22983
22997
|
const generated = column7.generated;
|
22984
|
-
const generatedStatement = ` GENERATED ALWAYS AS (${generated == null ? void 0 : generated.as}) STORED
|
22998
|
+
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated == null ? void 0 : generated.as}) STORED` : "";
|
22985
22999
|
const unsquashedIdentity = column7.identity ? PgSquasher.unsquashIdentity(column7.identity) : void 0;
|
22986
23000
|
const identityWithSchema = schema5 ? `"${schema5}"."${unsquashedIdentity == null ? void 0 : unsquashedIdentity.name}"` : `"${unsquashedIdentity == null ? void 0 : unsquashedIdentity.name}"`;
|
22987
23001
|
const identity = unsquashedIdentity ? ` GENERATED ${unsquashedIdentity.type === "always" ? "ALWAYS" : "BY DEFAULT"} AS IDENTITY (sequence name ${identityWithSchema}${unsquashedIdentity.increment ? ` INCREMENT BY ${unsquashedIdentity.increment}` : ""}${unsquashedIdentity.minValue ? ` MINVALUE ${unsquashedIdentity.minValue}` : ""}${unsquashedIdentity.maxValue ? ` MAXVALUE ${unsquashedIdentity.maxValue}` : ""}${unsquashedIdentity.startWith ? ` START WITH ${unsquashedIdentity.startWith}` : ""}${unsquashedIdentity.cache ? ` CACHE ${unsquashedIdentity.cache}` : ""}${unsquashedIdentity.cycle ? ` CYCLE` : ""})` : "";
|
22988
|
-
statement += ` "${column7.name}" ${type}${primaryKeyStatement}${defaultStatement}${
|
23002
|
+
statement += ` "${column7.name}" ${type}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${uniqueConstraint4}${identity}`;
|
22989
23003
|
statement += i2 === columns.length - 1 ? "" : ",\n";
|
22990
23004
|
}
|
22991
23005
|
if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
|
@@ -23032,7 +23046,7 @@ var init_sqlgenerator = __esm({
|
|
23032
23046
|
const onUpdateStatement = column7.onUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
|
23033
23047
|
const autoincrementStatement = column7.autoincrement ? " AUTO_INCREMENT" : "";
|
23034
23048
|
const generatedStatement = column7.generated ? ` GENERATED ALWAYS AS (${(_a = column7.generated) == null ? void 0 : _a.as}) ${(_b = column7.generated) == null ? void 0 : _b.type.toUpperCase()}` : "";
|
23035
|
-
statement += ` \`${column7.name}\` ${column7.type}${autoincrementStatement}${primaryKeyStatement}${notNullStatement}${defaultStatement}${onUpdateStatement}
|
23049
|
+
statement += ` \`${column7.name}\` ${column7.type}${autoincrementStatement}${primaryKeyStatement}${generatedStatement}${notNullStatement}${defaultStatement}${onUpdateStatement}`;
|
23036
23050
|
statement += i2 === columns.length - 1 ? "" : ",\n";
|
23037
23051
|
}
|
23038
23052
|
if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
|
@@ -23081,7 +23095,7 @@ var init_sqlgenerator = __esm({
|
|
23081
23095
|
const autoincrementStatement = column7.autoincrement ? " AUTOINCREMENT" : "";
|
23082
23096
|
const generatedStatement = column7.generated ? ` GENERATED ALWAYS AS ${column7.generated.as} ${column7.generated.type.toUpperCase()}` : "";
|
23083
23097
|
statement += " ";
|
23084
|
-
statement += `\`${column7.name}\` ${column7.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${
|
23098
|
+
statement += `\`${column7.name}\` ${column7.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${generatedStatement}${notNullStatement}`;
|
23085
23099
|
statement += i2 === columns.length - 1 ? "" : ",\n";
|
23086
23100
|
}
|
23087
23101
|
compositePKs.forEach((it) => {
|
@@ -23471,8 +23485,8 @@ var init_sqlgenerator = __esm({
|
|
23471
23485
|
const unsquashedIdentity = identity ? PgSquasher.unsquashIdentity(identity) : void 0;
|
23472
23486
|
const identityWithSchema = schema5 ? `"${schema5}"."${unsquashedIdentity == null ? void 0 : unsquashedIdentity.name}"` : `"${unsquashedIdentity == null ? void 0 : unsquashedIdentity.name}"`;
|
23473
23487
|
const identityStatement = unsquashedIdentity ? ` GENERATED ${unsquashedIdentity.type === "always" ? "ALWAYS" : "BY DEFAULT"} AS IDENTITY (sequence name ${identityWithSchema}${unsquashedIdentity.increment ? ` INCREMENT BY ${unsquashedIdentity.increment}` : ""}${unsquashedIdentity.minValue ? ` MINVALUE ${unsquashedIdentity.minValue}` : ""}${unsquashedIdentity.maxValue ? ` MAXVALUE ${unsquashedIdentity.maxValue}` : ""}${unsquashedIdentity.startWith ? ` START WITH ${unsquashedIdentity.startWith}` : ""}${unsquashedIdentity.cache ? ` CACHE ${unsquashedIdentity.cache}` : ""}${unsquashedIdentity.cycle ? ` CYCLE` : ""})` : "";
|
23474
|
-
const generatedStatement = ` GENERATED ALWAYS AS (${generated == null ? void 0 : generated.as}) STORED
|
23475
|
-
return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name}" ${fixedType}${primaryKeyStatement}${defaultStatement}${
|
23488
|
+
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated == null ? void 0 : generated.as}) STORED` : "";
|
23489
|
+
return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name}" ${fixedType}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${identityStatement};`;
|
23476
23490
|
}
|
23477
23491
|
};
|
23478
23492
|
MySqlAlterTableAddColumnConvertor = class extends Convertor {
|
@@ -23496,7 +23510,7 @@ var init_sqlgenerator = __esm({
|
|
23496
23510
|
const autoincrementStatement = `${autoincrement ? " AUTO_INCREMENT" : ""}`;
|
23497
23511
|
const onUpdateStatement = `${onUpdate ? " ON UPDATE CURRENT_TIMESTAMP" : ""}`;
|
23498
23512
|
const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated == null ? void 0 : generated.as}) ${generated == null ? void 0 : generated.type.toUpperCase()}` : "";
|
23499
|
-
return `ALTER TABLE \`${tableName}\` ADD \`${name}\` ${type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${
|
23513
|
+
return `ALTER TABLE \`${tableName}\` ADD \`${name}\` ${type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${generatedStatement}${notNullStatement}${onUpdateStatement};`;
|
23500
23514
|
}
|
23501
23515
|
};
|
23502
23516
|
SQLiteAlterTableAddColumnConvertor = class extends Convertor {
|
@@ -23512,7 +23526,7 @@ var init_sqlgenerator = __esm({
|
|
23512
23526
|
const referenceAsObject = referenceData ? SQLiteSquasher.unsquashFK(referenceData) : void 0;
|
23513
23527
|
const referenceStatement = `${referenceAsObject ? ` REFERENCES ${referenceAsObject.tableTo}(${referenceAsObject.columnsTo})` : ""}`;
|
23514
23528
|
const generatedStatement = generated ? ` GENERATED ALWAYS AS ${generated.as} ${generated.type.toUpperCase()}` : "";
|
23515
|
-
return `ALTER TABLE \`${tableName}\` ADD \`${name}\` ${type}${primaryKeyStatement}${defaultStatement}${
|
23529
|
+
return `ALTER TABLE \`${tableName}\` ADD \`${name}\` ${type}${primaryKeyStatement}${defaultStatement}${generatedStatement}${notNullStatement}${referenceStatement};`;
|
23516
23530
|
}
|
23517
23531
|
};
|
23518
23532
|
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
|
@@ -23973,7 +23987,7 @@ var init_sqlgenerator = __esm({
|
|
23973
23987
|
columnGenerated = statement.columnGenerated ? ` GENERATED ALWAYS AS (${(_f = statement.columnGenerated) == null ? void 0 : _f.as}) ${(_g = statement.columnGenerated) == null ? void 0 : _g.type.toUpperCase()}` : "";
|
23974
23988
|
}
|
23975
23989
|
columnDefault = columnDefault instanceof Date ? columnDefault.toISOString() : columnDefault;
|
23976
|
-
return `ALTER TABLE \`${tableName}\` MODIFY COLUMN \`${columnName}\`${columnType}${columnAutoincrement}${columnNotNull}${columnDefault}${columnOnUpdate}
|
23990
|
+
return `ALTER TABLE \`${tableName}\` MODIFY COLUMN \`${columnName}\`${columnType}${columnAutoincrement}${columnGenerated}${columnNotNull}${columnDefault}${columnOnUpdate};`;
|
23977
23991
|
}
|
23978
23992
|
};
|
23979
23993
|
SqliteAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
|
@@ -71751,7 +71765,7 @@ __export(connections_exports, {
|
|
71751
71765
|
connectToSQLite: () => connectToSQLite,
|
71752
71766
|
preparePostgresDB: () => preparePostgresDB
|
71753
71767
|
});
|
71754
|
-
var preparePostgresDB, parseMysqlCredentials, connectToMySQL, prepareSqliteParams, connectToSQLite;
|
71768
|
+
var preparePostgresDB, parseMysqlCredentials, connectToMySQL, prepareSqliteParams, preparePGliteParams, connectToSQLite;
|
71755
71769
|
var init_connections = __esm({
|
71756
71770
|
"src/cli/connections.ts"() {
|
71757
71771
|
"use strict";
|
@@ -71763,7 +71777,8 @@ var init_connections = __esm({
|
|
71763
71777
|
init_outputs();
|
71764
71778
|
preparePostgresDB = async (credentials2) => {
|
71765
71779
|
if ("driver" in credentials2) {
|
71766
|
-
|
71780
|
+
const { driver: driver2 } = credentials2;
|
71781
|
+
if (driver2 === "aws-data-api") {
|
71767
71782
|
assertPackages("@aws-sdk/client-rds-data");
|
71768
71783
|
const { RDSDataClient, ExecuteStatementCommand, TypeHint } = await Promise.resolve().then(() => __toESM(require_dist_cjs55()));
|
71769
71784
|
const { AwsDataApiSession, drizzle } = await import("drizzle-orm/aws-data-api/pg");
|
@@ -71820,7 +71835,35 @@ var init_connections = __esm({
|
|
71820
71835
|
migrate: migrateFn
|
71821
71836
|
};
|
71822
71837
|
}
|
71823
|
-
|
71838
|
+
if (driver2 === "pglite") {
|
71839
|
+
assertPackages("@electric-sql/pglite");
|
71840
|
+
const { PGlite } = await import("@electric-sql/pglite");
|
71841
|
+
const { drizzle } = await import("drizzle-orm/pglite");
|
71842
|
+
const { migrate: migrate2 } = await import("drizzle-orm/pglite/migrator");
|
71843
|
+
const pglite = new PGlite(normalisePGliteUrl(credentials2.url));
|
71844
|
+
await pglite.waitReady;
|
71845
|
+
const drzl = drizzle(pglite);
|
71846
|
+
const migrateFn = async (config) => {
|
71847
|
+
return migrate2(drzl, config);
|
71848
|
+
};
|
71849
|
+
const query = async (sql, params = []) => {
|
71850
|
+
const result = await pglite.query(sql, params);
|
71851
|
+
return result.rows;
|
71852
|
+
};
|
71853
|
+
const proxy = async (params) => {
|
71854
|
+
const preparedParams = preparePGliteParams(params.params);
|
71855
|
+
if (params.method === "values" || params.method === "get" || params.method === "all") {
|
71856
|
+
const result2 = await pglite.query(params.sql, preparedParams, {
|
71857
|
+
rowMode: params.mode
|
71858
|
+
});
|
71859
|
+
return result2.rows;
|
71860
|
+
}
|
71861
|
+
const result = await pglite.query(params.sql, preparedParams);
|
71862
|
+
return result.rows;
|
71863
|
+
};
|
71864
|
+
return { query, proxy, migrate: migrateFn };
|
71865
|
+
}
|
71866
|
+
assertUnreachable(driver2);
|
71824
71867
|
}
|
71825
71868
|
if (await checkPackage("pg")) {
|
71826
71869
|
console.log(withStyle.info(`Using 'pg' driver for database querying`));
|
@@ -71984,7 +72027,13 @@ var init_connections = __esm({
|
|
71984
72027
|
const result2 = await connection.query({
|
71985
72028
|
sql: params.sql,
|
71986
72029
|
values: params.params,
|
71987
|
-
rowsAsArray: params.mode === "array"
|
72030
|
+
rowsAsArray: params.mode === "array",
|
72031
|
+
typeCast: function(field, next) {
|
72032
|
+
if (field.type === "TIMESTAMP" || field.type === "DATETIME" || field.type === "DATE") {
|
72033
|
+
return field.string();
|
72034
|
+
}
|
72035
|
+
return next();
|
72036
|
+
}
|
71988
72037
|
});
|
71989
72038
|
return result2[0];
|
71990
72039
|
};
|
@@ -72038,6 +72087,15 @@ var init_connections = __esm({
|
|
72038
72087
|
return param;
|
72039
72088
|
});
|
72040
72089
|
};
|
72090
|
+
preparePGliteParams = (params) => {
|
72091
|
+
return params.map((param) => {
|
72092
|
+
if (param && typeof param === "object" && "type" in param && "value" in param && param.type === "binary") {
|
72093
|
+
const value = typeof param.value === "object" ? JSON.stringify(param.value) : param.value;
|
72094
|
+
return value;
|
72095
|
+
}
|
72096
|
+
return param;
|
72097
|
+
});
|
72098
|
+
};
|
72041
72099
|
connectToSQLite = async (credentials2) => {
|
72042
72100
|
if ("driver" in credentials2) {
|
72043
72101
|
const { driver: driver2 } = credentials2;
|
@@ -80400,10 +80458,13 @@ var init_studio2 = __esm({
|
|
80400
80458
|
const customDefaults = getCustomDefaults(pgSchema2);
|
80401
80459
|
let dbUrl;
|
80402
80460
|
if ("driver" in credentials2) {
|
80403
|
-
|
80461
|
+
const { driver: driver2 } = credentials2;
|
80462
|
+
if (driver2 === "aws-data-api") {
|
80404
80463
|
dbUrl = `aws-data-api://${credentials2.database}/${credentials2.secretArn}/${credentials2.resourceArn}`;
|
80464
|
+
} else if (driver2 === "pglite") {
|
80465
|
+
dbUrl = credentials2.url;
|
80405
80466
|
} else {
|
80406
|
-
assertUnreachable(
|
80467
|
+
assertUnreachable(driver2);
|
80407
80468
|
}
|
80408
80469
|
} else if ("url" in credentials2) {
|
80409
80470
|
dbUrl = credentials2.url;
|
@@ -83490,15 +83551,23 @@ var migrate = command({
|
|
83490
83551
|
try {
|
83491
83552
|
if (dialect7 === "postgresql") {
|
83492
83553
|
if ("driver" in credentials2) {
|
83493
|
-
|
83554
|
+
const { driver: driver2 } = credentials2;
|
83555
|
+
if (driver2 === "aws-data-api") {
|
83494
83556
|
if (!await ormVersionGt("0.30.10")) {
|
83495
83557
|
console.log(
|
83496
83558
|
"To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
|
83497
83559
|
);
|
83498
83560
|
process.exit(1);
|
83499
83561
|
}
|
83562
|
+
} else if (driver2 === "pglite") {
|
83563
|
+
if (!await ormVersionGt("0.30.6")) {
|
83564
|
+
console.log(
|
83565
|
+
"To use 'pglite' driver - please update drizzle-orm to the latest version"
|
83566
|
+
);
|
83567
|
+
process.exit(1);
|
83568
|
+
}
|
83500
83569
|
} else {
|
83501
|
-
assertUnreachable(
|
83570
|
+
assertUnreachable(driver2);
|
83502
83571
|
}
|
83503
83572
|
}
|
83504
83573
|
const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
@@ -83627,15 +83696,23 @@ var push = command({
|
|
83627
83696
|
);
|
83628
83697
|
} else if (dialect7 === "postgresql") {
|
83629
83698
|
if ("driver" in credentials2) {
|
83630
|
-
|
83699
|
+
const { driver: driver2 } = credentials2;
|
83700
|
+
if (driver2 === "aws-data-api") {
|
83631
83701
|
if (!await ormVersionGt("0.30.10")) {
|
83632
83702
|
console.log(
|
83633
83703
|
"To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
|
83634
83704
|
);
|
83635
83705
|
process.exit(1);
|
83636
83706
|
}
|
83707
|
+
} else if (driver2 === "pglite") {
|
83708
|
+
if (!await ormVersionGt("0.30.6")) {
|
83709
|
+
console.log(
|
83710
|
+
"To use 'pglite' driver - please update drizzle-orm to the latest version"
|
83711
|
+
);
|
83712
|
+
process.exit(1);
|
83713
|
+
}
|
83637
83714
|
} else {
|
83638
|
-
assertUnreachable(
|
83715
|
+
assertUnreachable(driver2);
|
83639
83716
|
}
|
83640
83717
|
}
|
83641
83718
|
const { pgPush: pgPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
@@ -83772,15 +83849,23 @@ var pull = command({
|
|
83772
83849
|
try {
|
83773
83850
|
if (dialect7 === "postgresql") {
|
83774
83851
|
if ("driver" in credentials2) {
|
83775
|
-
|
83852
|
+
const { driver: driver2 } = credentials2;
|
83853
|
+
if (driver2 === "aws-data-api") {
|
83776
83854
|
if (!await ormVersionGt("0.30.10")) {
|
83777
83855
|
console.log(
|
83778
83856
|
"To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
|
83779
83857
|
);
|
83780
83858
|
process.exit(1);
|
83781
83859
|
}
|
83860
|
+
} else if (driver2 === "pglite") {
|
83861
|
+
if (!await ormVersionGt("0.30.6")) {
|
83862
|
+
console.log(
|
83863
|
+
"To use 'pglite' driver - please update drizzle-orm to the latest version"
|
83864
|
+
);
|
83865
|
+
process.exit(1);
|
83866
|
+
}
|
83782
83867
|
} else {
|
83783
|
-
assertUnreachable(
|
83868
|
+
assertUnreachable(driver2);
|
83784
83869
|
}
|
83785
83870
|
}
|
83786
83871
|
const { introspectPostgres: introspectPostgres2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
@@ -83870,15 +83955,23 @@ var studio = command({
|
|
83870
83955
|
try {
|
83871
83956
|
if (dialect7 === "postgresql") {
|
83872
83957
|
if ("driver" in credentials2) {
|
83873
|
-
|
83958
|
+
const { driver: driver2 } = credentials2;
|
83959
|
+
if (driver2 === "aws-data-api") {
|
83874
83960
|
if (!await ormVersionGt("0.30.10")) {
|
83875
83961
|
console.log(
|
83876
83962
|
"To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
|
83877
83963
|
);
|
83878
83964
|
process.exit(1);
|
83879
83965
|
}
|
83966
|
+
} else if (driver2 === "pglite") {
|
83967
|
+
if (!await ormVersionGt("0.30.6")) {
|
83968
|
+
console.log(
|
83969
|
+
"To use 'pglite' driver - please update drizzle-orm to the latest version"
|
83970
|
+
);
|
83971
|
+
process.exit(1);
|
83972
|
+
}
|
83880
83973
|
} else {
|
83881
|
-
assertUnreachable(
|
83974
|
+
assertUnreachable(driver2);
|
83882
83975
|
}
|
83883
83976
|
}
|
83884
83977
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await preparePgSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
@@ -83941,7 +84034,7 @@ init_utils2();
|
|
83941
84034
|
var version2 = async () => {
|
83942
84035
|
const { npmVersion } = await ormCoreVersions();
|
83943
84036
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
83944
|
-
const envVersion = "0.24.
|
84037
|
+
const envVersion = "0.24.2-1a5913a";
|
83945
84038
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
83946
84039
|
const versions = `drizzle-kit: ${kitVersion}
|
83947
84040
|
${ormVersion}`;
|
package/index.d.mts
CHANGED
@@ -2,7 +2,7 @@ import { ConnectionOptions } from 'tls';
|
|
2
2
|
|
3
3
|
declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
|
4
4
|
type Prefix = (typeof prefixes)[number];
|
5
|
-
declare const drivers: readonly ["turso", "d1-http", "expo", "aws-data-api"];
|
5
|
+
declare const drivers: readonly ["turso", "d1-http", "expo", "aws-data-api", "pglite"];
|
6
6
|
type Driver = (typeof drivers)[number];
|
7
7
|
|
8
8
|
declare const dialects: readonly ["postgresql", "mysql", "sqlite"];
|
@@ -43,7 +43,7 @@ type Verify<T, U extends T> = U;
|
|
43
43
|
*
|
44
44
|
* ---
|
45
45
|
* `driver` - optional param that is responsible for explicitly providing a driver to use when accessing a database
|
46
|
-
* *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`
|
46
|
+
* *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`, `pglite`
|
47
47
|
* If you don't use AWS Data API, D1, Turso or Expo - ypu don't need this driver. You can check a driver strategy choice here: https://orm.drizzle.team/kit-docs/upgrade-21
|
48
48
|
*
|
49
49
|
* See https://orm.drizzle.team/kit-docs/config-reference#driver
|
@@ -135,7 +135,7 @@ type Config = {
|
|
135
135
|
authToken?: string;
|
136
136
|
};
|
137
137
|
} | {
|
138
|
-
dialect: 'sqlite'
|
138
|
+
dialect: Verify<Dialect, 'sqlite'>;
|
139
139
|
dbCredentials: {
|
140
140
|
url: string;
|
141
141
|
};
|
@@ -159,6 +159,12 @@ type Config = {
|
|
159
159
|
secretArn: string;
|
160
160
|
resourceArn: string;
|
161
161
|
};
|
162
|
+
} | {
|
163
|
+
dialect: Verify<Dialect, 'postgresql'>;
|
164
|
+
driver: Verify<Driver, 'pglite'>;
|
165
|
+
dbCredentials: {
|
166
|
+
url: string;
|
167
|
+
};
|
162
168
|
} | {
|
163
169
|
dialect: Verify<Dialect, 'mysql'>;
|
164
170
|
dbCredentials: {
|
@@ -207,7 +213,7 @@ type Config = {
|
|
207
213
|
*
|
208
214
|
* ---
|
209
215
|
* `driver` - optional param that is responsible for explicitly providing a driver to use when accessing a database
|
210
|
-
* *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`
|
216
|
+
* *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`, `pglite`
|
211
217
|
* If you don't use AWS Data API, D1, Turso or Expo - ypu don't need this driver. You can check a driver strategy choice here: https://orm.drizzle.team/kit-docs/upgrade-21
|
212
218
|
*
|
213
219
|
* See https://orm.drizzle.team/kit-docs/config-reference#driver
|
package/index.d.ts
CHANGED
@@ -2,7 +2,7 @@ import { ConnectionOptions } from 'tls';
|
|
2
2
|
|
3
3
|
declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
|
4
4
|
type Prefix = (typeof prefixes)[number];
|
5
|
-
declare const drivers: readonly ["turso", "d1-http", "expo", "aws-data-api"];
|
5
|
+
declare const drivers: readonly ["turso", "d1-http", "expo", "aws-data-api", "pglite"];
|
6
6
|
type Driver = (typeof drivers)[number];
|
7
7
|
|
8
8
|
declare const dialects: readonly ["postgresql", "mysql", "sqlite"];
|
@@ -43,7 +43,7 @@ type Verify<T, U extends T> = U;
|
|
43
43
|
*
|
44
44
|
* ---
|
45
45
|
* `driver` - optional param that is responsible for explicitly providing a driver to use when accessing a database
|
46
|
-
* *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`
|
46
|
+
* *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`, `pglite`
|
47
47
|
* If you don't use AWS Data API, D1, Turso or Expo - ypu don't need this driver. You can check a driver strategy choice here: https://orm.drizzle.team/kit-docs/upgrade-21
|
48
48
|
*
|
49
49
|
* See https://orm.drizzle.team/kit-docs/config-reference#driver
|
@@ -135,7 +135,7 @@ type Config = {
|
|
135
135
|
authToken?: string;
|
136
136
|
};
|
137
137
|
} | {
|
138
|
-
dialect: 'sqlite'
|
138
|
+
dialect: Verify<Dialect, 'sqlite'>;
|
139
139
|
dbCredentials: {
|
140
140
|
url: string;
|
141
141
|
};
|
@@ -159,6 +159,12 @@ type Config = {
|
|
159
159
|
secretArn: string;
|
160
160
|
resourceArn: string;
|
161
161
|
};
|
162
|
+
} | {
|
163
|
+
dialect: Verify<Dialect, 'postgresql'>;
|
164
|
+
driver: Verify<Driver, 'pglite'>;
|
165
|
+
dbCredentials: {
|
166
|
+
url: string;
|
167
|
+
};
|
162
168
|
} | {
|
163
169
|
dialect: Verify<Dialect, 'mysql'>;
|
164
170
|
dbCredentials: {
|
@@ -207,7 +213,7 @@ type Config = {
|
|
207
213
|
*
|
208
214
|
* ---
|
209
215
|
* `driver` - optional param that is responsible for explicitly providing a driver to use when accessing a database
|
210
|
-
* *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`
|
216
|
+
* *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`, `pglite`
|
211
217
|
* If you don't use AWS Data API, D1, Turso or Expo - ypu don't need this driver. You can check a driver strategy choice here: https://orm.drizzle.team/kit-docs/upgrade-21
|
212
218
|
*
|
213
219
|
* See https://orm.drizzle.team/kit-docs/config-reference#driver
|
package/package.json
CHANGED
package/utils.js
CHANGED
@@ -570,6 +570,7 @@ __export(utils_exports, {
|
|
570
570
|
dryJournal: () => dryJournal,
|
571
571
|
isPgArrayType: () => isPgArrayType,
|
572
572
|
kloudMeta: () => kloudMeta,
|
573
|
+
normalisePGliteUrl: () => normalisePGliteUrl,
|
573
574
|
normaliseSQLiteUrl: () => normaliseSQLiteUrl,
|
574
575
|
objectValues: () => objectValues,
|
575
576
|
prepareMigrationFolder: () => prepareMigrationFolder,
|
@@ -5740,6 +5741,12 @@ var normaliseSQLiteUrl = (it, type) => {
|
|
5740
5741
|
}
|
5741
5742
|
assertUnreachable(type);
|
5742
5743
|
};
|
5744
|
+
var normalisePGliteUrl = (it) => {
|
5745
|
+
if (it.startsWith("file:")) {
|
5746
|
+
return it.substring(5);
|
5747
|
+
}
|
5748
|
+
return it;
|
5749
|
+
};
|
5743
5750
|
function isPgArrayType(sqlType) {
|
5744
5751
|
return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
|
5745
5752
|
}
|
@@ -5751,6 +5758,7 @@ function isPgArrayType(sqlType) {
|
|
5751
5758
|
dryJournal,
|
5752
5759
|
isPgArrayType,
|
5753
5760
|
kloudMeta,
|
5761
|
+
normalisePGliteUrl,
|
5754
5762
|
normaliseSQLiteUrl,
|
5755
5763
|
objectValues,
|
5756
5764
|
prepareMigrationFolder,
|
package/utils.mjs
CHANGED
@@ -5721,6 +5721,12 @@ var normaliseSQLiteUrl = (it, type) => {
|
|
5721
5721
|
}
|
5722
5722
|
assertUnreachable(type);
|
5723
5723
|
};
|
5724
|
+
var normalisePGliteUrl = (it) => {
|
5725
|
+
if (it.startsWith("file:")) {
|
5726
|
+
return it.substring(5);
|
5727
|
+
}
|
5728
|
+
return it;
|
5729
|
+
};
|
5724
5730
|
function isPgArrayType(sqlType) {
|
5725
5731
|
return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
|
5726
5732
|
}
|
@@ -5731,6 +5737,7 @@ export {
|
|
5731
5737
|
dryJournal,
|
5732
5738
|
isPgArrayType,
|
5733
5739
|
kloudMeta,
|
5740
|
+
normalisePGliteUrl,
|
5734
5741
|
normaliseSQLiteUrl,
|
5735
5742
|
objectValues,
|
5736
5743
|
prepareMigrationFolder,
|