drizzle-kit 0.24.1-87d7704 → 0.24.1-e2f75fb
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 +6681 -48191
- package/api.mjs +6681 -48190
- package/bin.cjs +122 -35
- package/index.d.mts +10 -4
- package/index.d.ts +10 -4
- package/package.json +1 -2
- package/utils.js +8 -0
- package/utils.mjs +7 -0
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 {
|
@@ -67548,9 +67562,9 @@ var require_dist_cjs47 = __commonJS({
|
|
67548
67562
|
}
|
67549
67563
|
});
|
67550
67564
|
|
67551
|
-
// ../node_modules/.pnpm/@aws-sdk+token-providers@3.577.0_@aws-sdk+client-sso-oidc@3.583.
|
67565
|
+
// ../node_modules/.pnpm/@aws-sdk+token-providers@3.577.0_@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0_/node_modules/@aws-sdk/token-providers/dist-cjs/index.js
|
67552
67566
|
var require_dist_cjs48 = __commonJS({
|
67553
|
-
"../node_modules/.pnpm/@aws-sdk+token-providers@3.577.0_@aws-sdk+client-sso-oidc@3.583.
|
67567
|
+
"../node_modules/.pnpm/@aws-sdk+token-providers@3.577.0_@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0_/node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2, module2) {
|
67554
67568
|
"use strict";
|
67555
67569
|
var __create3 = Object.create;
|
67556
67570
|
var __defProp3 = Object.defineProperty;
|
@@ -67728,9 +67742,9 @@ var require_dist_cjs48 = __commonJS({
|
|
67728
67742
|
}
|
67729
67743
|
});
|
67730
67744
|
|
67731
|
-
// ../node_modules/.pnpm/@aws-sdk+credential-provider-sso@3.583.0_@aws-sdk+client-sso-oidc@3.583.
|
67745
|
+
// ../node_modules/.pnpm/@aws-sdk+credential-provider-sso@3.583.0_@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0_/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js
|
67732
67746
|
var require_dist_cjs49 = __commonJS({
|
67733
|
-
"../node_modules/.pnpm/@aws-sdk+credential-provider-sso@3.583.0_@aws-sdk+client-sso-oidc@3.583.
|
67747
|
+
"../node_modules/.pnpm/@aws-sdk+credential-provider-sso@3.583.0_@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0_/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js"(exports2, module2) {
|
67734
67748
|
"use strict";
|
67735
67749
|
var __defProp3 = Object.defineProperty;
|
67736
67750
|
var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
|
@@ -70005,9 +70019,9 @@ var require_dist_cjs52 = __commonJS({
|
|
70005
70019
|
}
|
70006
70020
|
});
|
70007
70021
|
|
70008
|
-
// ../node_modules/.pnpm/@aws-sdk+credential-provider-ini@3.583.0_@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-
|
70022
|
+
// ../node_modules/.pnpm/@aws-sdk+credential-provider-ini@3.583.0_@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts_n4voux45fymjghrdt4o3r57x4m/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js
|
70009
70023
|
var require_dist_cjs53 = __commonJS({
|
70010
|
-
"../node_modules/.pnpm/@aws-sdk+credential-provider-ini@3.583.0_@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-
|
70024
|
+
"../node_modules/.pnpm/@aws-sdk+credential-provider-ini@3.583.0_@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts_n4voux45fymjghrdt4o3r57x4m/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js"(exports2, module2) {
|
70011
70025
|
"use strict";
|
70012
70026
|
var __create3 = Object.create;
|
70013
70027
|
var __defProp3 = Object.defineProperty;
|
@@ -70175,9 +70189,9 @@ var require_dist_cjs53 = __commonJS({
|
|
70175
70189
|
}
|
70176
70190
|
});
|
70177
70191
|
|
70178
|
-
// ../node_modules/.pnpm/@aws-sdk+credential-provider-node@3.583.0_@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-
|
70192
|
+
// ../node_modules/.pnpm/@aws-sdk+credential-provider-node@3.583.0_@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-st_qaylqvuvqkdeetlwmxiq34v6lq/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js
|
70179
70193
|
var require_dist_cjs54 = __commonJS({
|
70180
|
-
"../node_modules/.pnpm/@aws-sdk+credential-provider-node@3.583.0_@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-
|
70194
|
+
"../node_modules/.pnpm/@aws-sdk+credential-provider-node@3.583.0_@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-st_qaylqvuvqkdeetlwmxiq34v6lq/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js"(exports2, module2) {
|
70181
70195
|
"use strict";
|
70182
70196
|
var __create3 = Object.create;
|
70183
70197
|
var __defProp3 = Object.defineProperty;
|
@@ -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`));
|
@@ -72038,6 +72081,15 @@ var init_connections = __esm({
|
|
72038
72081
|
return param;
|
72039
72082
|
});
|
72040
72083
|
};
|
72084
|
+
preparePGliteParams = (params) => {
|
72085
|
+
return params.map((param) => {
|
72086
|
+
if (param && typeof param === "object" && "type" in param && "value" in param && param.type === "binary") {
|
72087
|
+
const value = typeof param.value === "object" ? JSON.stringify(param.value) : param.value;
|
72088
|
+
return value;
|
72089
|
+
}
|
72090
|
+
return param;
|
72091
|
+
});
|
72092
|
+
};
|
72041
72093
|
connectToSQLite = async (credentials2) => {
|
72042
72094
|
if ("driver" in credentials2) {
|
72043
72095
|
const { driver: driver2 } = credentials2;
|
@@ -80400,10 +80452,13 @@ var init_studio2 = __esm({
|
|
80400
80452
|
const customDefaults = getCustomDefaults(pgSchema2);
|
80401
80453
|
let dbUrl;
|
80402
80454
|
if ("driver" in credentials2) {
|
80403
|
-
|
80455
|
+
const { driver: driver2 } = credentials2;
|
80456
|
+
if (driver2 === "aws-data-api") {
|
80404
80457
|
dbUrl = `aws-data-api://${credentials2.database}/${credentials2.secretArn}/${credentials2.resourceArn}`;
|
80458
|
+
} else if (driver2 === "pglite") {
|
80459
|
+
dbUrl = credentials2.url;
|
80405
80460
|
} else {
|
80406
|
-
assertUnreachable(
|
80461
|
+
assertUnreachable(driver2);
|
80407
80462
|
}
|
80408
80463
|
} else if ("url" in credentials2) {
|
80409
80464
|
dbUrl = credentials2.url;
|
@@ -83490,15 +83545,23 @@ var migrate = command({
|
|
83490
83545
|
try {
|
83491
83546
|
if (dialect7 === "postgresql") {
|
83492
83547
|
if ("driver" in credentials2) {
|
83493
|
-
|
83548
|
+
const { driver: driver2 } = credentials2;
|
83549
|
+
if (driver2 === "aws-data-api") {
|
83494
83550
|
if (!await ormVersionGt("0.30.10")) {
|
83495
83551
|
console.log(
|
83496
83552
|
"To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
|
83497
83553
|
);
|
83498
83554
|
process.exit(1);
|
83499
83555
|
}
|
83556
|
+
} else if (driver2 === "pglite") {
|
83557
|
+
if (!await ormVersionGt("0.30.6")) {
|
83558
|
+
console.log(
|
83559
|
+
"To use 'pglite' driver - please update drizzle-orm to the latest version"
|
83560
|
+
);
|
83561
|
+
process.exit(1);
|
83562
|
+
}
|
83500
83563
|
} else {
|
83501
|
-
assertUnreachable(
|
83564
|
+
assertUnreachable(driver2);
|
83502
83565
|
}
|
83503
83566
|
}
|
83504
83567
|
const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
@@ -83627,15 +83690,23 @@ var push = command({
|
|
83627
83690
|
);
|
83628
83691
|
} else if (dialect7 === "postgresql") {
|
83629
83692
|
if ("driver" in credentials2) {
|
83630
|
-
|
83693
|
+
const { driver: driver2 } = credentials2;
|
83694
|
+
if (driver2 === "aws-data-api") {
|
83631
83695
|
if (!await ormVersionGt("0.30.10")) {
|
83632
83696
|
console.log(
|
83633
83697
|
"To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
|
83634
83698
|
);
|
83635
83699
|
process.exit(1);
|
83636
83700
|
}
|
83701
|
+
} else if (driver2 === "pglite") {
|
83702
|
+
if (!await ormVersionGt("0.30.6")) {
|
83703
|
+
console.log(
|
83704
|
+
"To use 'pglite' driver - please update drizzle-orm to the latest version"
|
83705
|
+
);
|
83706
|
+
process.exit(1);
|
83707
|
+
}
|
83637
83708
|
} else {
|
83638
|
-
assertUnreachable(
|
83709
|
+
assertUnreachable(driver2);
|
83639
83710
|
}
|
83640
83711
|
}
|
83641
83712
|
const { pgPush: pgPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
@@ -83772,15 +83843,23 @@ var pull = command({
|
|
83772
83843
|
try {
|
83773
83844
|
if (dialect7 === "postgresql") {
|
83774
83845
|
if ("driver" in credentials2) {
|
83775
|
-
|
83846
|
+
const { driver: driver2 } = credentials2;
|
83847
|
+
if (driver2 === "aws-data-api") {
|
83776
83848
|
if (!await ormVersionGt("0.30.10")) {
|
83777
83849
|
console.log(
|
83778
83850
|
"To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
|
83779
83851
|
);
|
83780
83852
|
process.exit(1);
|
83781
83853
|
}
|
83854
|
+
} else if (driver2 === "pglite") {
|
83855
|
+
if (!await ormVersionGt("0.30.6")) {
|
83856
|
+
console.log(
|
83857
|
+
"To use 'pglite' driver - please update drizzle-orm to the latest version"
|
83858
|
+
);
|
83859
|
+
process.exit(1);
|
83860
|
+
}
|
83782
83861
|
} else {
|
83783
|
-
assertUnreachable(
|
83862
|
+
assertUnreachable(driver2);
|
83784
83863
|
}
|
83785
83864
|
}
|
83786
83865
|
const { introspectPostgres: introspectPostgres2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
@@ -83870,15 +83949,23 @@ var studio = command({
|
|
83870
83949
|
try {
|
83871
83950
|
if (dialect7 === "postgresql") {
|
83872
83951
|
if ("driver" in credentials2) {
|
83873
|
-
|
83952
|
+
const { driver: driver2 } = credentials2;
|
83953
|
+
if (driver2 === "aws-data-api") {
|
83874
83954
|
if (!await ormVersionGt("0.30.10")) {
|
83875
83955
|
console.log(
|
83876
83956
|
"To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
|
83877
83957
|
);
|
83878
83958
|
process.exit(1);
|
83879
83959
|
}
|
83960
|
+
} else if (driver2 === "pglite") {
|
83961
|
+
if (!await ormVersionGt("0.30.6")) {
|
83962
|
+
console.log(
|
83963
|
+
"To use 'pglite' driver - please update drizzle-orm to the latest version"
|
83964
|
+
);
|
83965
|
+
process.exit(1);
|
83966
|
+
}
|
83880
83967
|
} else {
|
83881
|
-
assertUnreachable(
|
83968
|
+
assertUnreachable(driver2);
|
83882
83969
|
}
|
83883
83970
|
}
|
83884
83971
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await preparePgSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
@@ -83941,7 +84028,7 @@ init_utils2();
|
|
83941
84028
|
var version2 = async () => {
|
83942
84029
|
const { npmVersion } = await ormCoreVersions();
|
83943
84030
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
83944
|
-
const envVersion = "0.24.1-
|
84031
|
+
const envVersion = "0.24.1-e2f75fb";
|
83945
84032
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
83946
84033
|
const versions = `drizzle-kit: ${kitVersion}
|
83947
84034
|
${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
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "drizzle-kit",
|
3
|
-
"version": "0.24.1-
|
3
|
+
"version": "0.24.1-e2f75fb",
|
4
4
|
"homepage": "https://orm.drizzle.team",
|
5
5
|
"keywords": [
|
6
6
|
"drizzle",
|
@@ -74,7 +74,6 @@
|
|
74
74
|
"@vercel/postgres": "^0.8.0",
|
75
75
|
"ava": "^5.1.0",
|
76
76
|
"better-sqlite3": "^9.4.3",
|
77
|
-
"bun-types": "^0.6.6",
|
78
77
|
"camelcase": "^7.0.1",
|
79
78
|
"chalk": "^5.2.0",
|
80
79
|
"commander": "^12.1.0",
|
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,
|