drizzle-kit 0.24.1 → 0.24.2-12ef143

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 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}${notNullStatement}${uniqueConstraint4}${generated ? generatedStatement : ""}${identity}`;
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}${generatedStatement}`;
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}${notNullStatement}${generatedStatement}`;
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}${notNullStatement}${generated ? generatedStatement : ""}${identityStatement};`;
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}${notNullStatement}${onUpdateStatement}${generatedStatement};`;
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}${notNullStatement}${generatedStatement}${referenceStatement};`;
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}${columnGenerated};`;
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 = literalType("aws-data-api");
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}${notNullStatement}${uniqueConstraint4}${generated ? generatedStatement : ""}${identity}`;
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}${generatedStatement}`;
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}${notNullStatement}${generatedStatement}`;
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}${notNullStatement}${generated ? generatedStatement : ""}${identityStatement};`;
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}${notNullStatement}${onUpdateStatement}${generatedStatement};`;
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}${notNullStatement}${generatedStatement}${referenceStatement};`;
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}${columnGenerated};`;
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 = literalType("aws-data-api");
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 = literalType("aws-data-api");
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}${notNullStatement}${uniqueConstraint4}${generated ? generatedStatement : ""}${identity}`;
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}${generatedStatement}`;
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}${notNullStatement}${generatedStatement}`;
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}${notNullStatement}${generated ? generatedStatement : ""}${identityStatement};`;
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}${notNullStatement}${onUpdateStatement}${generatedStatement};`;
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}${notNullStatement}${generatedStatement}${referenceStatement};`;
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}${columnGenerated};`;
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
- if (credentials2.driver === "aws-data-api") {
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,46 @@ var init_connections = __esm({
71820
71835
  migrate: migrateFn
71821
71836
  };
71822
71837
  }
71823
- assertUnreachable(credentials2.driver);
71838
+ if (driver2 === "pglite") {
71839
+ assertPackages("@electric-sql/pglite");
71840
+ const { PGlite, types: types3 } = 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 parsers = {
71850
+ [types3.TIMESTAMP]: (value) => value,
71851
+ [types3.TIMESTAMPTZ]: (value) => value,
71852
+ [types3.INTERVAL]: (value) => value,
71853
+ [types3.DATE]: (value) => value
71854
+ };
71855
+ const query = async (sql, params = []) => {
71856
+ const result = await pglite.query(sql, params, {
71857
+ parsers
71858
+ });
71859
+ return result.rows;
71860
+ };
71861
+ const proxy = async (params) => {
71862
+ const preparedParams = preparePGliteParams(params.params);
71863
+ if (params.method === "values" || params.method === "get" || params.method === "all") {
71864
+ const result2 = await pglite.query(params.sql, preparedParams, {
71865
+ rowMode: params.mode,
71866
+ parsers
71867
+ });
71868
+ return result2.rows;
71869
+ }
71870
+ const result = await pglite.query(params.sql, preparedParams, {
71871
+ parsers
71872
+ });
71873
+ return result.rows;
71874
+ };
71875
+ return { query, proxy, migrate: migrateFn };
71876
+ }
71877
+ assertUnreachable(driver2);
71824
71878
  }
71825
71879
  if (await checkPackage("pg")) {
71826
71880
  console.log(withStyle.info(`Using 'pg' driver for database querying`));
@@ -71828,6 +71882,10 @@ var init_connections = __esm({
71828
71882
  const { drizzle } = await import("drizzle-orm/node-postgres");
71829
71883
  const { migrate: migrate2 } = await import("drizzle-orm/node-postgres/migrator");
71830
71884
  const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
71885
+ pg.types.setTypeParser(pg.types.builtins.TIMESTAMPTZ, (val2) => val2);
71886
+ pg.types.setTypeParser(pg.types.builtins.TIMESTAMP, (val2) => val2);
71887
+ pg.types.setTypeParser(pg.types.builtins.DATE, (val2) => val2);
71888
+ pg.types.setTypeParser(pg.types.builtins.INTERVAL, (val2) => val2);
71831
71889
  const client = "url" in credentials2 ? new pg.default.Pool({ connectionString: credentials2.url, max: 1 }) : new pg.default.Pool({ ...credentials2, ssl, max: 1 });
71832
71890
  const db = drizzle(client);
71833
71891
  const migrateFn = async (config) => {
@@ -71855,6 +71913,13 @@ var init_connections = __esm({
71855
71913
  const { drizzle } = await import("drizzle-orm/postgres-js");
71856
71914
  const { migrate: migrate2 } = await import("drizzle-orm/postgres-js/migrator");
71857
71915
  const client = "url" in credentials2 ? postgres.default(credentials2.url, { max: 1 }) : postgres.default({ ...credentials2, max: 1 });
71916
+ const transparentParser = (val2) => val2;
71917
+ for (const type of ["1184", "1082", "1083", "1114"]) {
71918
+ client.options.parsers[type] = transparentParser;
71919
+ client.options.serializers[type] = transparentParser;
71920
+ }
71921
+ client.options.serializers["114"] = transparentParser;
71922
+ client.options.serializers["3802"] = transparentParser;
71858
71923
  const db = drizzle(client);
71859
71924
  const migrateFn = async (config) => {
71860
71925
  return migrate2(db, config);
@@ -71880,10 +71945,14 @@ var init_connections = __esm({
71880
71945
  "'@vercel/postgres' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
71881
71946
  )
71882
71947
  );
71883
- const { VercelPool } = await import("@vercel/postgres");
71948
+ const { VercelPool, types: types3 } = await import("@vercel/postgres");
71884
71949
  const { drizzle } = await import("drizzle-orm/vercel-postgres");
71885
71950
  const { migrate: migrate2 } = await import("drizzle-orm/vercel-postgres/migrator");
71886
71951
  const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
71952
+ types3.setTypeParser(types3.builtins.TIMESTAMPTZ, (val2) => val2);
71953
+ types3.setTypeParser(types3.builtins.TIMESTAMP, (val2) => val2);
71954
+ types3.setTypeParser(types3.builtins.DATE, (val2) => val2);
71955
+ types3.setTypeParser(types3.builtins.INTERVAL, (val2) => val2);
71887
71956
  const client = "url" in credentials2 ? new VercelPool({ connectionString: credentials2.url }) : new VercelPool({ ...credentials2, ssl });
71888
71957
  await client.connect();
71889
71958
  const db = drizzle(client);
@@ -71915,10 +71984,14 @@ var init_connections = __esm({
71915
71984
  "'@neondatabase/serverless' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
71916
71985
  )
71917
71986
  );
71918
- const { Pool, neonConfig } = await import("@neondatabase/serverless");
71987
+ const { Pool, neonConfig, types: types3 } = await import("@neondatabase/serverless");
71919
71988
  const { drizzle } = await import("drizzle-orm/neon-serverless");
71920
71989
  const { migrate: migrate2 } = await import("drizzle-orm/neon-serverless/migrator");
71921
71990
  const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
71991
+ types3.setTypeParser(types3.builtins.TIMESTAMPTZ, (val2) => val2);
71992
+ types3.setTypeParser(types3.builtins.TIMESTAMP, (val2) => val2);
71993
+ types3.setTypeParser(types3.builtins.DATE, (val2) => val2);
71994
+ types3.setTypeParser(types3.builtins.INTERVAL, (val2) => val2);
71922
71995
  const client = "url" in credentials2 ? new Pool({ connectionString: credentials2.url, max: 1 }) : new Pool({ ...credentials2, max: 1, ssl });
71923
71996
  neonConfig.webSocketConstructor = wrapper_default;
71924
71997
  const db = drizzle(client);
@@ -71975,16 +72048,27 @@ var init_connections = __esm({
71975
72048
  const migrateFn = async (config) => {
71976
72049
  return migrate2(db, config);
71977
72050
  };
72051
+ const typeCast = (field, next) => {
72052
+ if (field.type === "TIMESTAMP" || field.type === "DATETIME" || field.type === "DATE") {
72053
+ return field.string();
72054
+ }
72055
+ return next();
72056
+ };
71978
72057
  await connection.connect();
71979
72058
  const query = async (sql, params) => {
71980
- const res = await connection.execute(sql, params);
72059
+ const res = await connection.execute({
72060
+ sql,
72061
+ values: params,
72062
+ typeCast
72063
+ });
71981
72064
  return res[0];
71982
72065
  };
71983
72066
  const proxy = async (params) => {
71984
72067
  const result2 = await connection.query({
71985
72068
  sql: params.sql,
71986
72069
  values: params.params,
71987
- rowsAsArray: params.mode === "array"
72070
+ rowsAsArray: params.mode === "array",
72071
+ typeCast
71988
72072
  });
71989
72073
  return result2[0];
71990
72074
  };
@@ -72038,6 +72122,15 @@ var init_connections = __esm({
72038
72122
  return param;
72039
72123
  });
72040
72124
  };
72125
+ preparePGliteParams = (params) => {
72126
+ return params.map((param) => {
72127
+ if (param && typeof param === "object" && "type" in param && "value" in param && param.type === "binary") {
72128
+ const value = typeof param.value === "object" ? JSON.stringify(param.value) : param.value;
72129
+ return value;
72130
+ }
72131
+ return param;
72132
+ });
72133
+ };
72041
72134
  connectToSQLite = async (credentials2) => {
72042
72135
  if ("driver" in credentials2) {
72043
72136
  const { driver: driver2 } = credentials2;
@@ -80400,10 +80493,13 @@ var init_studio2 = __esm({
80400
80493
  const customDefaults = getCustomDefaults(pgSchema2);
80401
80494
  let dbUrl;
80402
80495
  if ("driver" in credentials2) {
80403
- if (credentials2.driver === "aws-data-api") {
80496
+ const { driver: driver2 } = credentials2;
80497
+ if (driver2 === "aws-data-api") {
80404
80498
  dbUrl = `aws-data-api://${credentials2.database}/${credentials2.secretArn}/${credentials2.resourceArn}`;
80499
+ } else if (driver2 === "pglite") {
80500
+ dbUrl = credentials2.url;
80405
80501
  } else {
80406
- assertUnreachable(credentials2.driver);
80502
+ assertUnreachable(driver2);
80407
80503
  }
80408
80504
  } else if ("url" in credentials2) {
80409
80505
  dbUrl = credentials2.url;
@@ -83490,15 +83586,23 @@ var migrate = command({
83490
83586
  try {
83491
83587
  if (dialect7 === "postgresql") {
83492
83588
  if ("driver" in credentials2) {
83493
- if (credentials2.driver === "aws-data-api") {
83589
+ const { driver: driver2 } = credentials2;
83590
+ if (driver2 === "aws-data-api") {
83494
83591
  if (!await ormVersionGt("0.30.10")) {
83495
83592
  console.log(
83496
83593
  "To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
83497
83594
  );
83498
83595
  process.exit(1);
83499
83596
  }
83597
+ } else if (driver2 === "pglite") {
83598
+ if (!await ormVersionGt("0.30.6")) {
83599
+ console.log(
83600
+ "To use 'pglite' driver - please update drizzle-orm to the latest version"
83601
+ );
83602
+ process.exit(1);
83603
+ }
83500
83604
  } else {
83501
- assertUnreachable(credentials2.driver);
83605
+ assertUnreachable(driver2);
83502
83606
  }
83503
83607
  }
83504
83608
  const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
@@ -83627,15 +83731,23 @@ var push = command({
83627
83731
  );
83628
83732
  } else if (dialect7 === "postgresql") {
83629
83733
  if ("driver" in credentials2) {
83630
- if (credentials2.driver === "aws-data-api") {
83734
+ const { driver: driver2 } = credentials2;
83735
+ if (driver2 === "aws-data-api") {
83631
83736
  if (!await ormVersionGt("0.30.10")) {
83632
83737
  console.log(
83633
83738
  "To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
83634
83739
  );
83635
83740
  process.exit(1);
83636
83741
  }
83742
+ } else if (driver2 === "pglite") {
83743
+ if (!await ormVersionGt("0.30.6")) {
83744
+ console.log(
83745
+ "To use 'pglite' driver - please update drizzle-orm to the latest version"
83746
+ );
83747
+ process.exit(1);
83748
+ }
83637
83749
  } else {
83638
- assertUnreachable(credentials2.driver);
83750
+ assertUnreachable(driver2);
83639
83751
  }
83640
83752
  }
83641
83753
  const { pgPush: pgPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
@@ -83772,15 +83884,23 @@ var pull = command({
83772
83884
  try {
83773
83885
  if (dialect7 === "postgresql") {
83774
83886
  if ("driver" in credentials2) {
83775
- if (credentials2.driver === "aws-data-api") {
83887
+ const { driver: driver2 } = credentials2;
83888
+ if (driver2 === "aws-data-api") {
83776
83889
  if (!await ormVersionGt("0.30.10")) {
83777
83890
  console.log(
83778
83891
  "To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
83779
83892
  );
83780
83893
  process.exit(1);
83781
83894
  }
83895
+ } else if (driver2 === "pglite") {
83896
+ if (!await ormVersionGt("0.30.6")) {
83897
+ console.log(
83898
+ "To use 'pglite' driver - please update drizzle-orm to the latest version"
83899
+ );
83900
+ process.exit(1);
83901
+ }
83782
83902
  } else {
83783
- assertUnreachable(credentials2.driver);
83903
+ assertUnreachable(driver2);
83784
83904
  }
83785
83905
  }
83786
83906
  const { introspectPostgres: introspectPostgres2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
@@ -83870,15 +83990,23 @@ var studio = command({
83870
83990
  try {
83871
83991
  if (dialect7 === "postgresql") {
83872
83992
  if ("driver" in credentials2) {
83873
- if (credentials2.driver === "aws-data-api") {
83993
+ const { driver: driver2 } = credentials2;
83994
+ if (driver2 === "aws-data-api") {
83874
83995
  if (!await ormVersionGt("0.30.10")) {
83875
83996
  console.log(
83876
83997
  "To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
83877
83998
  );
83878
83999
  process.exit(1);
83879
84000
  }
84001
+ } else if (driver2 === "pglite") {
84002
+ if (!await ormVersionGt("0.30.6")) {
84003
+ console.log(
84004
+ "To use 'pglite' driver - please update drizzle-orm to the latest version"
84005
+ );
84006
+ process.exit(1);
84007
+ }
83880
84008
  } else {
83881
- assertUnreachable(credentials2.driver);
84009
+ assertUnreachable(driver2);
83882
84010
  }
83883
84011
  }
83884
84012
  const { schema: schema5, relations: relations4, files } = schemaPath ? await preparePgSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
@@ -83941,7 +84069,7 @@ init_utils2();
83941
84069
  var version2 = async () => {
83942
84070
  const { npmVersion } = await ormCoreVersions();
83943
84071
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
83944
- const envVersion = "0.24.1";
84072
+ const envVersion = "0.24.2-12ef143";
83945
84073
  const kitVersion = envVersion ? `v${envVersion}` : "--";
83946
84074
  const versions = `drizzle-kit: ${kitVersion}
83947
84075
  ${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.2-12ef143",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",
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,