@prisma/migrate 6.19.0-integration-next.21 → 6.19.0

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.
Files changed (52) hide show
  1. package/dist/Migrate.js +3 -3
  2. package/dist/bin.js +28 -27
  3. package/dist/{chunk-KWS3KTC2.js → chunk-3AKRTEIK.js} +11 -10
  4. package/dist/{chunk-QXGJ64OM.js → chunk-6ORQRJLP.js} +53 -18
  5. package/dist/{chunk-TCBZUTEL.js → chunk-7TVX3D4W.js} +65 -27
  6. package/dist/{chunk-UBJBWA5R.js → chunk-BHJMJSM4.js} +7 -6
  7. package/dist/{chunk-WF7UXKO5.js → chunk-D4TRX77Y.js} +9 -6
  8. package/dist/{chunk-V5D5NSLS.js → chunk-D6LYHB65.js} +25 -33
  9. package/dist/{chunk-SWKWTYSR.js → chunk-F2XCBEZ4.js} +13 -10
  10. package/dist/{chunk-Y66LIIF7.js → chunk-J33EXHZB.js} +12 -9
  11. package/dist/{chunk-LNQIFWXN.js → chunk-NB4FRYRQ.js} +5 -5
  12. package/dist/{chunk-PYQR4PVV.js → chunk-O35BTK6Y.js} +13 -9
  13. package/dist/{chunk-FRY7T46S.js → chunk-OP2BDF75.js} +11 -10
  14. package/dist/{chunk-L7EZFBB4.js → chunk-PHXLQVPT.js} +68 -40
  15. package/dist/{chunk-XA2JOJS2.js → chunk-QVMYNWAN.js} +70 -157
  16. package/dist/{chunk-SJKDB5VT.js → chunk-R4IWP35Z.js} +9 -8
  17. package/dist/chunk-RR6BKMNO.js +80 -0
  18. package/dist/{chunk-5VRSNV7F.js → chunk-TW22Y3AA.js} +7 -6
  19. package/dist/{chunk-T2ACIU5M.js → chunk-VU5BLQUI.js} +8 -14
  20. package/dist/{chunk-JX2HIV7V.js → chunk-VV4M6AN7.js} +10 -10
  21. package/dist/{chunk-GY34KW2I.js → chunk-Z27SI4AV.js} +4 -6
  22. package/dist/{chunk-FWKRNLVM.js → chunk-ZTIS675B.js} +82 -68
  23. package/dist/commands/DbDrop.js +2 -2
  24. package/dist/commands/DbExecute.js +4 -4
  25. package/dist/commands/DbPull.js +6 -5
  26. package/dist/commands/DbPush.js +4 -4
  27. package/dist/commands/DbSeed.js +3 -3
  28. package/dist/commands/MigrateDeploy.js +4 -4
  29. package/dist/commands/MigrateDev.js +5 -5
  30. package/dist/commands/MigrateDiff.js +4 -4
  31. package/dist/commands/MigrateReset.js +5 -5
  32. package/dist/commands/MigrateResolve.js +4 -4
  33. package/dist/commands/MigrateStatus.js +4 -4
  34. package/dist/index.js +32 -31
  35. package/dist/internals/src/cli/getSchema.d.ts +15 -1
  36. package/dist/migrate/src/Migrate.d.ts +2 -1
  37. package/dist/migrate/src/utils/introspectSql.d.ts +1 -2
  38. package/dist/migrate/src/utils/replaceOrAddDatasource.d.ts +2 -0
  39. package/dist/migrate/src/utils/replaceOrAddDatasource.test.d.ts +1 -0
  40. package/dist/migrate/src/utils/seed.d.ts +6 -0
  41. package/dist/utils/getDatabaseVersionSafe.js +4 -4
  42. package/dist/utils/introspectSql.js +4 -4
  43. package/dist/utils/replaceOrAddDatasource.js +25 -0
  44. package/dist/utils/replaceOrAddDatasource.test.js +207 -0
  45. package/dist/utils/seed.js +3 -2
  46. package/dist/utils/setupCockroach.js +2 -2
  47. package/dist/utils/setupMSSQL.js +30480 -31090
  48. package/dist/utils/setupMongo.js +768 -2048
  49. package/dist/utils/setupPostgres.js +2 -2
  50. package/dist/utils/spinner.js +3 -3
  51. package/package.json +11 -11
  52. package/dist/open-GFNXULGD.js +0 -593
@@ -16,11 +16,11 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_XA2JOJS2_exports = {};
20
- __export(chunk_XA2JOJS2_exports, {
19
+ var chunk_QVMYNWAN_exports = {};
20
+ __export(chunk_QVMYNWAN_exports, {
21
21
  require_lib: () => require_lib2
22
22
  });
23
- module.exports = __toCommonJS(chunk_XA2JOJS2_exports);
23
+ module.exports = __toCommonJS(chunk_QVMYNWAN_exports);
24
24
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
25
25
  var require_postgres_array = (0, import_chunk_2ESYSVXG.__commonJS)({
26
26
  "../../node_modules/.pnpm/postgres-array@2.0.0/node_modules/postgres-array/index.js"(exports) {
@@ -1552,9 +1552,9 @@ var require_type_overrides = (0, import_chunk_2ESYSVXG.__commonJS)({
1552
1552
  }
1553
1553
  });
1554
1554
  var require_pg_connection_string = (0, import_chunk_2ESYSVXG.__commonJS)({
1555
- "../../node_modules/.pnpm/pg-connection-string@2.9.1/node_modules/pg-connection-string/index.js"(exports, module2) {
1555
+ "../../node_modules/.pnpm/pg-connection-string@2.7.0/node_modules/pg-connection-string/index.js"(exports, module2) {
1556
1556
  "use strict";
1557
- function parse(str, options = {}) {
1557
+ function parse(str) {
1558
1558
  if (str.charAt(0) === "/") {
1559
1559
  const config2 = str.split(" ");
1560
1560
  return { host: config2[0], database: config2[1] };
@@ -1563,17 +1563,13 @@ var require_pg_connection_string = (0, import_chunk_2ESYSVXG.__commonJS)({
1563
1563
  let result;
1564
1564
  let dummyHost = false;
1565
1565
  if (/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(str)) {
1566
- str = encodeURI(str).replace(/%25(\d\d)/g, "%$1");
1566
+ str = encodeURI(str).replace(/\%25(\d\d)/g, "%$1");
1567
1567
  }
1568
1568
  try {
1569
- try {
1570
- result = new URL(str, "postgres://base");
1571
- } catch (e) {
1572
- result = new URL(str.replace("@/", "@___DUMMY___/"), "postgres://base");
1573
- dummyHost = true;
1574
- }
1575
- } catch (err) {
1576
- err.input && (err.input = "*****REDACTED*****");
1569
+ result = new URL(str, "postgres://base");
1570
+ } catch (e) {
1571
+ result = new URL(str.replace("@/", "@___DUMMY___/"), "postgres://base");
1572
+ dummyHost = true;
1577
1573
  }
1578
1574
  for (const entry of result.searchParams.entries()) {
1579
1575
  config[entry[0]] = entry[1];
@@ -1616,105 +1612,26 @@ var require_pg_connection_string = (0, import_chunk_2ESYSVXG.__commonJS)({
1616
1612
  if (config.sslrootcert) {
1617
1613
  config.ssl.ca = fs.readFileSync(config.sslrootcert).toString();
1618
1614
  }
1619
- if (options.useLibpqCompat && config.uselibpqcompat) {
1620
- throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
1621
- }
1622
- if (config.uselibpqcompat === "true" || options.useLibpqCompat) {
1623
- switch (config.sslmode) {
1624
- case "disable": {
1625
- config.ssl = false;
1626
- break;
1627
- }
1628
- case "prefer": {
1629
- config.ssl.rejectUnauthorized = false;
1630
- break;
1631
- }
1632
- case "require": {
1633
- if (config.sslrootcert) {
1634
- config.ssl.checkServerIdentity = function() {
1635
- };
1636
- } else {
1637
- config.ssl.rejectUnauthorized = false;
1638
- }
1639
- break;
1640
- }
1641
- case "verify-ca": {
1642
- if (!config.ssl.ca) {
1643
- throw new Error(
1644
- "SECURITY WARNING: Using sslmode=verify-ca requires specifying a CA with sslrootcert. If a public CA is used, verify-ca allows connections to a server that somebody else may have registered with the CA, making you vulnerable to Man-in-the-Middle attacks. Either specify a custom CA certificate with sslrootcert parameter or use sslmode=verify-full for proper security."
1645
- );
1646
- }
1647
- config.ssl.checkServerIdentity = function() {
1648
- };
1649
- break;
1650
- }
1651
- case "verify-full": {
1652
- break;
1653
- }
1615
+ switch (config.sslmode) {
1616
+ case "disable": {
1617
+ config.ssl = false;
1618
+ break;
1654
1619
  }
1655
- } else {
1656
- switch (config.sslmode) {
1657
- case "disable": {
1658
- config.ssl = false;
1659
- break;
1660
- }
1661
- case "prefer":
1662
- case "require":
1663
- case "verify-ca":
1664
- case "verify-full": {
1665
- break;
1666
- }
1667
- case "no-verify": {
1668
- config.ssl.rejectUnauthorized = false;
1669
- break;
1670
- }
1620
+ case "prefer":
1621
+ case "require":
1622
+ case "verify-ca":
1623
+ case "verify-full": {
1624
+ break;
1625
+ }
1626
+ case "no-verify": {
1627
+ config.ssl.rejectUnauthorized = false;
1628
+ break;
1671
1629
  }
1672
1630
  }
1673
1631
  return config;
1674
1632
  }
1675
- function toConnectionOptions(sslConfig) {
1676
- const connectionOptions = Object.entries(sslConfig).reduce((c, [key, value]) => {
1677
- if (value !== void 0 && value !== null) {
1678
- c[key] = value;
1679
- }
1680
- return c;
1681
- }, {});
1682
- return connectionOptions;
1683
- }
1684
- function toClientConfig(config) {
1685
- const poolConfig = Object.entries(config).reduce((c, [key, value]) => {
1686
- if (key === "ssl") {
1687
- const sslConfig = value;
1688
- if (typeof sslConfig === "boolean") {
1689
- c[key] = sslConfig;
1690
- }
1691
- if (typeof sslConfig === "object") {
1692
- c[key] = toConnectionOptions(sslConfig);
1693
- }
1694
- } else if (value !== void 0 && value !== null) {
1695
- if (key === "port") {
1696
- if (value !== "") {
1697
- const v = parseInt(value, 10);
1698
- if (isNaN(v)) {
1699
- throw new Error(`Invalid ${key}: ${value}`);
1700
- }
1701
- c[key] = v;
1702
- }
1703
- } else {
1704
- c[key] = value;
1705
- }
1706
- }
1707
- return c;
1708
- }, {});
1709
- return poolConfig;
1710
- }
1711
- function parseIntoClientConfig(str) {
1712
- return toClientConfig(parse(str));
1713
- }
1714
1633
  module2.exports = parse;
1715
1634
  parse.parse = parse;
1716
- parse.toClientConfig = toClientConfig;
1717
- parse.parseIntoClientConfig = parseIntoClientConfig;
1718
1635
  }
1719
1636
  });
1720
1637
  var require_connection_parameters = (0, import_chunk_2ESYSVXG.__commonJS)({
@@ -2138,7 +2055,7 @@ var require_query = (0, import_chunk_2ESYSVXG.__commonJS)({
2138
2055
  }
2139
2056
  });
2140
2057
  var require_messages = (0, import_chunk_2ESYSVXG.__commonJS)({
2141
- "../../node_modules/.pnpm/pg-protocol@1.10.3/node_modules/pg-protocol/dist/messages.js"(exports) {
2058
+ "../../node_modules/.pnpm/pg-protocol@1.8.0/node_modules/pg-protocol/dist/messages.js"(exports) {
2142
2059
  "use strict";
2143
2060
  Object.defineProperty(exports, "__esModule", { value: true });
2144
2061
  exports.NoticeMessage = exports.DataRowMessage = exports.CommandCompleteMessage = exports.ReadyForQueryMessage = exports.NotificationResponseMessage = exports.BackendKeyDataMessage = exports.AuthenticationMD5Password = exports.ParameterStatusMessage = exports.ParameterDescriptionMessage = exports.RowDescriptionMessage = exports.Field = exports.CopyResponse = exports.CopyDataMessage = exports.DatabaseError = exports.copyDone = exports.emptyQuery = exports.replicationStart = exports.portalSuspended = exports.noData = exports.closeComplete = exports.bindComplete = exports.parseComplete = void 0;
@@ -2301,7 +2218,7 @@ var require_messages = (0, import_chunk_2ESYSVXG.__commonJS)({
2301
2218
  }
2302
2219
  });
2303
2220
  var require_buffer_writer = (0, import_chunk_2ESYSVXG.__commonJS)({
2304
- "../../node_modules/.pnpm/pg-protocol@1.10.3/node_modules/pg-protocol/dist/buffer-writer.js"(exports) {
2221
+ "../../node_modules/.pnpm/pg-protocol@1.8.0/node_modules/pg-protocol/dist/buffer-writer.js"(exports) {
2305
2222
  "use strict";
2306
2223
  Object.defineProperty(exports, "__esModule", { value: true });
2307
2224
  exports.Writer = void 0;
@@ -2313,10 +2230,10 @@ var require_buffer_writer = (0, import_chunk_2ESYSVXG.__commonJS)({
2313
2230
  this.buffer = Buffer.allocUnsafe(size);
2314
2231
  }
2315
2232
  ensure(size) {
2316
- const remaining = this.buffer.length - this.offset;
2233
+ var remaining = this.buffer.length - this.offset;
2317
2234
  if (remaining < size) {
2318
- const oldBuffer = this.buffer;
2319
- const newSize = oldBuffer.length + (oldBuffer.length >> 1) + size;
2235
+ var oldBuffer = this.buffer;
2236
+ var newSize = oldBuffer.length + (oldBuffer.length >> 1) + size;
2320
2237
  this.buffer = Buffer.allocUnsafe(newSize);
2321
2238
  oldBuffer.copy(this.buffer);
2322
2239
  }
@@ -2339,7 +2256,7 @@ var require_buffer_writer = (0, import_chunk_2ESYSVXG.__commonJS)({
2339
2256
  if (!string) {
2340
2257
  this.ensure(1);
2341
2258
  } else {
2342
- const len = Buffer.byteLength(string);
2259
+ var len = Buffer.byteLength(string);
2343
2260
  this.ensure(len + 1);
2344
2261
  this.buffer.write(string, this.offset, "utf-8");
2345
2262
  this.offset += len;
@@ -2348,7 +2265,7 @@ var require_buffer_writer = (0, import_chunk_2ESYSVXG.__commonJS)({
2348
2265
  return this;
2349
2266
  }
2350
2267
  addString(string = "") {
2351
- const len = Buffer.byteLength(string);
2268
+ var len = Buffer.byteLength(string);
2352
2269
  this.ensure(len);
2353
2270
  this.buffer.write(string, this.offset);
2354
2271
  this.offset += len;
@@ -2369,7 +2286,7 @@ var require_buffer_writer = (0, import_chunk_2ESYSVXG.__commonJS)({
2369
2286
  return this.buffer.slice(code ? 0 : 5, this.offset);
2370
2287
  }
2371
2288
  flush(code) {
2372
- const result = this.join(code);
2289
+ var result = this.join(code);
2373
2290
  this.offset = 5;
2374
2291
  this.headerPosition = 0;
2375
2292
  this.buffer = Buffer.allocUnsafe(this.size);
@@ -2380,7 +2297,7 @@ var require_buffer_writer = (0, import_chunk_2ESYSVXG.__commonJS)({
2380
2297
  }
2381
2298
  });
2382
2299
  var require_serializer = (0, import_chunk_2ESYSVXG.__commonJS)({
2383
- "../../node_modules/.pnpm/pg-protocol@1.10.3/node_modules/pg-protocol/dist/serializer.js"(exports) {
2300
+ "../../node_modules/.pnpm/pg-protocol@1.8.0/node_modules/pg-protocol/dist/serializer.js"(exports) {
2384
2301
  "use strict";
2385
2302
  Object.defineProperty(exports, "__esModule", { value: true });
2386
2303
  exports.serialize = void 0;
@@ -2392,8 +2309,8 @@ var require_serializer = (0, import_chunk_2ESYSVXG.__commonJS)({
2392
2309
  writer.addCString(key).addCString(opts[key]);
2393
2310
  }
2394
2311
  writer.addCString("client_encoding").addCString("UTF8");
2395
- const bodyBuffer = writer.addCString("").flush();
2396
- const length = bodyBuffer.length + 4;
2312
+ var bodyBuffer = writer.addCString("").flush();
2313
+ var length = bodyBuffer.length + 4;
2397
2314
  return new buffer_writer_1.Writer().addInt32(length).add(bodyBuffer).flush();
2398
2315
  };
2399
2316
  var requestSsl = () => {
@@ -2436,9 +2353,9 @@ var require_serializer = (0, import_chunk_2ESYSVXG.__commonJS)({
2436
2353
  console.error("This can cause conflicts and silent errors executing queries");
2437
2354
  }
2438
2355
  const types = query2.types || emptyArray;
2439
- const len = types.length;
2440
- const buffer = writer.addCString(name).addCString(query2.text).addInt16(len);
2441
- for (let i = 0; i < len; i++) {
2356
+ var len = types.length;
2357
+ var buffer = writer.addCString(name).addCString(query2.text).addInt16(len);
2358
+ for (var i = 0; i < len; i++) {
2442
2359
  buffer.addInt32(types[i]);
2443
2360
  }
2444
2361
  return writer.flush(
@@ -2484,7 +2401,6 @@ var require_serializer = (0, import_chunk_2ESYSVXG.__commonJS)({
2484
2401
  writeValues(values, config.valueMapper);
2485
2402
  writer.addInt16(len);
2486
2403
  writer.add(paramWriter.flush());
2487
- writer.addInt16(1);
2488
2404
  writer.addInt16(
2489
2405
  binary ? 1 : 0
2490
2406
  /* ParamType.STRING */
@@ -2595,7 +2511,7 @@ var require_serializer = (0, import_chunk_2ESYSVXG.__commonJS)({
2595
2511
  }
2596
2512
  });
2597
2513
  var require_buffer_reader = (0, import_chunk_2ESYSVXG.__commonJS)({
2598
- "../../node_modules/.pnpm/pg-protocol@1.10.3/node_modules/pg-protocol/dist/buffer-reader.js"(exports) {
2514
+ "../../node_modules/.pnpm/pg-protocol@1.8.0/node_modules/pg-protocol/dist/buffer-reader.js"(exports) {
2599
2515
  "use strict";
2600
2516
  Object.defineProperty(exports, "__esModule", { value: true });
2601
2517
  exports.BufferReader = void 0;
@@ -2653,7 +2569,7 @@ var require_buffer_reader = (0, import_chunk_2ESYSVXG.__commonJS)({
2653
2569
  }
2654
2570
  });
2655
2571
  var require_parser = (0, import_chunk_2ESYSVXG.__commonJS)({
2656
- "../../node_modules/.pnpm/pg-protocol@1.10.3/node_modules/pg-protocol/dist/parser.js"(exports) {
2572
+ "../../node_modules/.pnpm/pg-protocol@1.8.0/node_modules/pg-protocol/dist/parser.js"(exports) {
2657
2573
  "use strict";
2658
2574
  Object.defineProperty(exports, "__esModule", { value: true });
2659
2575
  exports.Parser = void 0;
@@ -2886,17 +2802,15 @@ var require_parser = (0, import_chunk_2ESYSVXG.__commonJS)({
2886
2802
  }
2887
2803
  break;
2888
2804
  case 10:
2889
- {
2890
- message.name = "authenticationSASL";
2891
- message.mechanisms = [];
2892
- let mechanism;
2893
- do {
2894
- mechanism = this.reader.cstring();
2895
- if (mechanism) {
2896
- message.mechanisms.push(mechanism);
2897
- }
2898
- } while (mechanism);
2899
- }
2805
+ message.name = "authenticationSASL";
2806
+ message.mechanisms = [];
2807
+ let mechanism;
2808
+ do {
2809
+ mechanism = this.reader.cstring();
2810
+ if (mechanism) {
2811
+ message.mechanisms.push(mechanism);
2812
+ }
2813
+ } while (mechanism);
2900
2814
  break;
2901
2815
  case 11:
2902
2816
  message.name = "authenticationSASLContinue";
@@ -2944,7 +2858,7 @@ var require_parser = (0, import_chunk_2ESYSVXG.__commonJS)({
2944
2858
  }
2945
2859
  });
2946
2860
  var require_dist = (0, import_chunk_2ESYSVXG.__commonJS)({
2947
- "../../node_modules/.pnpm/pg-protocol@1.10.3/node_modules/pg-protocol/dist/index.js"(exports) {
2861
+ "../../node_modules/.pnpm/pg-protocol@1.8.0/node_modules/pg-protocol/dist/index.js"(exports) {
2948
2862
  "use strict";
2949
2863
  Object.defineProperty(exports, "__esModule", { value: true });
2950
2864
  exports.DatabaseError = exports.serialize = exports.parse = void 0;
@@ -2965,11 +2879,15 @@ var require_dist = (0, import_chunk_2ESYSVXG.__commonJS)({
2965
2879
  exports.parse = parse;
2966
2880
  }
2967
2881
  });
2968
- var require_empty = (0, import_chunk_2ESYSVXG.__commonJS)({
2969
- "../../node_modules/.pnpm/pg-cloudflare@1.2.7/node_modules/pg-cloudflare/dist/empty.js"(exports) {
2882
+ var empty_exports = {};
2883
+ (0, import_chunk_2ESYSVXG.__export)(empty_exports, {
2884
+ default: () => empty_default
2885
+ });
2886
+ var empty_default;
2887
+ var init_empty = (0, import_chunk_2ESYSVXG.__esm)({
2888
+ "../../node_modules/.pnpm/pg-cloudflare@1.1.1/node_modules/pg-cloudflare/dist/empty.js"() {
2970
2889
  "use strict";
2971
- Object.defineProperty(exports, "__esModule", { value: true });
2972
- exports.default = {};
2890
+ empty_default = {};
2973
2891
  }
2974
2892
  });
2975
2893
  var require_stream = (0, import_chunk_2ESYSVXG.__commonJS)({
@@ -3005,7 +2923,7 @@ var require_stream = (0, import_chunk_2ESYSVXG.__commonJS)({
3005
2923
  }
3006
2924
  function getCloudflareStreamFuncs() {
3007
2925
  function getStream2(ssl) {
3008
- const { CloudflareSocket } = require_empty();
2926
+ const { CloudflareSocket } = (init_empty(), (0, import_chunk_2ESYSVXG.__toCommonJS)(empty_exports));
3009
2927
  return new CloudflareSocket(ssl);
3010
2928
  }
3011
2929
  function getSecureStream2(options) {
@@ -4032,7 +3950,7 @@ var require_client = (0, import_chunk_2ESYSVXG.__commonJS)({
4032
3950
  }
4033
3951
  });
4034
3952
  var require_pg_pool = (0, import_chunk_2ESYSVXG.__commonJS)({
4035
- "../../node_modules/.pnpm/pg-pool@3.10.1_pg@8.14.1/node_modules/pg-pool/index.js"(exports, module2) {
3953
+ "../../node_modules/.pnpm/pg-pool@3.8.0_pg@8.14.1/node_modules/pg-pool/index.js"(exports, module2) {
4036
3954
  "use strict";
4037
3955
  var EventEmitter = (0, import_chunk_2ESYSVXG.__require)("events").EventEmitter;
4038
3956
  var NOOP = function() {
@@ -4103,7 +4021,6 @@ var require_pg_pool = (0, import_chunk_2ESYSVXG.__commonJS)({
4103
4021
  });
4104
4022
  }
4105
4023
  this.options.max = this.options.max || this.options.poolSize || 10;
4106
- this.options.min = this.options.min || 0;
4107
4024
  this.options.maxUses = this.options.maxUses || Infinity;
4108
4025
  this.options.allowExitOnIdle = this.options.allowExitOnIdle || false;
4109
4026
  this.options.maxLifetimeSeconds = this.options.maxLifetimeSeconds || 0;
@@ -4125,9 +4042,6 @@ var require_pg_pool = (0, import_chunk_2ESYSVXG.__commonJS)({
4125
4042
  _isFull() {
4126
4043
  return this._clients.length >= this.options.max;
4127
4044
  }
4128
- _isAboveMin() {
4129
- return this._clients.length > this.options.min;
4130
- }
4131
4045
  _pulseQueue() {
4132
4046
  this.log("pulse queue");
4133
4047
  if (this.ended) {
@@ -4168,19 +4082,14 @@ var require_pg_pool = (0, import_chunk_2ESYSVXG.__commonJS)({
4168
4082
  }
4169
4083
  throw new Error("unexpected condition");
4170
4084
  }
4171
- _remove(client, callback) {
4085
+ _remove(client) {
4172
4086
  const removed = removeWhere(this._idle, (item) => item.client === client);
4173
4087
  if (removed !== void 0) {
4174
4088
  clearTimeout(removed.timeoutId);
4175
4089
  }
4176
4090
  this._clients = this._clients.filter((c) => c !== client);
4177
- const context = this;
4178
- client.end(() => {
4179
- context.emit("remove", client);
4180
- if (typeof callback === "function") {
4181
- callback();
4182
- }
4183
- });
4091
+ client.end();
4092
+ this.emit("remove", client);
4184
4093
  }
4185
4094
  connect(cb) {
4186
4095
  if (this.ending) {
@@ -4318,19 +4227,23 @@ var require_pg_pool = (0, import_chunk_2ESYSVXG.__commonJS)({
4318
4227
  if (client._poolUseCount >= this.options.maxUses) {
4319
4228
  this.log("remove expended client");
4320
4229
  }
4321
- return this._remove(client, this._pulseQueue.bind(this));
4230
+ this._remove(client);
4231
+ this._pulseQueue();
4232
+ return;
4322
4233
  }
4323
4234
  const isExpired = this._expired.has(client);
4324
4235
  if (isExpired) {
4325
4236
  this.log("remove expired client");
4326
4237
  this._expired.delete(client);
4327
- return this._remove(client, this._pulseQueue.bind(this));
4238
+ this._remove(client);
4239
+ this._pulseQueue();
4240
+ return;
4328
4241
  }
4329
4242
  let tid;
4330
- if (this.options.idleTimeoutMillis && this._isAboveMin()) {
4243
+ if (this.options.idleTimeoutMillis) {
4331
4244
  tid = setTimeout(() => {
4332
4245
  this.log("remove idle client");
4333
- this._remove(client, this._pulseQueue.bind(this));
4246
+ this._remove(client);
4334
4247
  }, this.options.idleTimeoutMillis);
4335
4248
  if (this.options.allowExitOnIdle) {
4336
4249
  tid.unref();
@@ -26,14 +26,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_SJKDB5VT_exports = {};
30
- __export(chunk_SJKDB5VT_exports, {
29
+ var chunk_R4IWP35Z_exports = {};
30
+ __export(chunk_R4IWP35Z_exports, {
31
31
  MigrateStatus: () => MigrateStatus
32
32
  });
33
- module.exports = __toCommonJS(chunk_SJKDB5VT_exports);
33
+ module.exports = __toCommonJS(chunk_R4IWP35Z_exports);
34
34
  var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
35
35
  var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
36
- var import_chunk_V5D5NSLS = require("./chunk-V5D5NSLS.js");
36
+ var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
37
37
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
38
38
  var import_debug = __toESM(require("@prisma/debug"));
39
39
  var import_internals = require("@prisma/internals");
@@ -48,7 +48,7 @@ Check the status of your database migrations
48
48
  ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
49
49
 
50
50
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate status [options]
51
-
51
+
52
52
  ${(0, import_chunk_SKRR5WT4.bold)("Options")}
53
53
 
54
54
  -h, --help Display this help message
@@ -81,6 +81,7 @@ Check the status of your database migrations
81
81
  if (args["--help"]) {
82
82
  return this.help();
83
83
  }
84
+ await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
84
85
  const schemaContext = await (0, import_internals.loadSchemaContext)({
85
86
  schemaPathFromArg: args["--schema"],
86
87
  schemaPathFromConfig: config.schema,
@@ -94,7 +95,7 @@ Check the status of your database migrations
94
95
  externalTables: config.tables?.external ?? [],
95
96
  externalEnums: config.enums?.external ?? []
96
97
  };
97
- const migrate = await import_chunk_V5D5NSLS.Migrate.setup({
98
+ const migrate = await import_chunk_D6LYHB65.Migrate.setup({
98
99
  schemaEngineConfig: config,
99
100
  migrationsDirPath,
100
101
  schemaContext,
@@ -154,7 +155,7 @@ ${diagnoseResult.history.unpersistedMigrationNames.join("\n")}`);
154
155
  if (!diagnoseResult.hasMigrationsTable) {
155
156
  if (listMigrationDirectoriesResult.migrations.length === 0) {
156
157
  console.error(`The current database is not managed by Prisma Migrate.
157
-
158
+
158
159
  Read more about how to baseline an existing production database:
159
160
  ${(0, import_internals.link)("https://pris.ly/d/migrate-baseline")}`);
160
161
  process.exit(1);
@@ -181,7 +182,7 @@ During development if the failed migration(s) have not been deployed to a produc
181
182
  `
182
183
  );
183
184
  console.error(`The failed migration(s) can be marked as rolled back or applied:
184
-
185
+
185
186
  - If you rolled back the migration(s) manually:
186
187
  ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`prisma migrate resolve --rolled-back "${failedMigrations[0]}"`)))}
187
188
 
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var chunk_RR6BKMNO_exports = {};
20
+ __export(chunk_RR6BKMNO_exports, {
21
+ replaceOrAddDatasource: () => replaceOrAddDatasource
22
+ });
23
+ module.exports = __toCommonJS(chunk_RR6BKMNO_exports);
24
+ var import_internals = require("@prisma/internals");
25
+ function replaceOrAddDatasource(newDatasource, files) {
26
+ let replaced = false;
27
+ const result = files.map(([path, content]) => {
28
+ const replaceResult = replaceDatasourceSingle(newDatasource, content);
29
+ if (replaceResult.replaced) {
30
+ replaced = true;
31
+ }
32
+ return [path, replaceResult.content];
33
+ });
34
+ if (!replaced) {
35
+ appendToFirstFile(newDatasource, result);
36
+ }
37
+ return result;
38
+ }
39
+ function appendToFirstFile(newDatasource, files) {
40
+ const firstFile = files[0];
41
+ (0, import_internals.assertAlways)(firstFile, "There always should be at least on file in the schema");
42
+ firstFile[1] = `${newDatasource}
43
+ ${firstFile[1]}`;
44
+ }
45
+ function replaceDatasourceSingle(newDatasource, content) {
46
+ const lines = content.split(/\r\n|\r|\n/g);
47
+ const existingDatasource = findDatasource(lines);
48
+ if (!existingDatasource) {
49
+ return { replaced: false, content };
50
+ }
51
+ lines.splice(existingDatasource.startLine, existingDatasource.endLine - existingDatasource.startLine + 1);
52
+ const noDatasource = lines.join("\n").trim();
53
+ return { replaced: true, content: `${newDatasource}
54
+
55
+ ${noDatasource}` };
56
+ }
57
+ function findDatasource(lines) {
58
+ if (lines.length <= 2) {
59
+ return void 0;
60
+ }
61
+ const startLine = lines.findIndex((line) => {
62
+ const lineTrimmed = line.trim();
63
+ return lineTrimmed.startsWith("datasource") && lineTrimmed.endsWith("{");
64
+ });
65
+ if (startLine === -1) {
66
+ return void 0;
67
+ }
68
+ let endLine = -1;
69
+ for (let index = startLine; index < lines.length; index++) {
70
+ const lineTrimmed = lines[index].trim();
71
+ if (lineTrimmed.endsWith("}") && !lineTrimmed.startsWith("//")) {
72
+ endLine = index;
73
+ break;
74
+ }
75
+ }
76
+ if (endLine === -1) {
77
+ return void 0;
78
+ }
79
+ return { startLine, endLine };
80
+ }
@@ -26,16 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_5VRSNV7F_exports = {};
30
- __export(chunk_5VRSNV7F_exports, {
29
+ var chunk_TW22Y3AA_exports = {};
30
+ __export(chunk_TW22Y3AA_exports, {
31
31
  DbPush: () => DbPush
32
32
  });
33
- module.exports = __toCommonJS(chunk_5VRSNV7F_exports);
33
+ module.exports = __toCommonJS(chunk_TW22Y3AA_exports);
34
34
  var import_chunk_FBDQVK4W = require("./chunk-FBDQVK4W.js");
35
35
  var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
36
36
  var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
37
37
  var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
38
- var import_chunk_V5D5NSLS = require("./chunk-V5D5NSLS.js");
38
+ var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
39
39
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
40
40
  var import_internals = require("@prisma/internals");
41
41
  var import_prompts = __toESM(require("prompts"));
@@ -91,6 +91,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
91
91
  if (args["--help"]) {
92
92
  return this.help();
93
93
  }
94
+ await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
94
95
  const schemaContext = await (0, import_internals.loadSchemaContext)({
95
96
  schemaPathFromArg: args["--schema"],
96
97
  schemaPathFromConfig: config.schema,
@@ -105,7 +106,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
105
106
  externalTables: config.tables?.external ?? [],
106
107
  externalEnums: config.enums?.external ?? []
107
108
  };
108
- const migrate = await import_chunk_V5D5NSLS.Migrate.setup({
109
+ const migrate = await import_chunk_D6LYHB65.Migrate.setup({
109
110
  schemaEngineConfig: config,
110
111
  migrationsDirPath,
111
112
  schemaContext,
@@ -232,7 +233,7 @@ ${rocketEmoji}${provider === "mongodb" ? migrationSuccessMongoMessage : migratio
232
233
  );
233
234
  }
234
235
  if (!process.env.PRISMA_MIGRATE_SKIP_GENERATE && !args["--skip-generate"]) {
235
- await migrate.tryToRunGenerate();
236
+ await migrate.tryToRunGenerate(datasourceInfo);
236
237
  }
237
238
  return ``;
238
239
  }
@@ -26,12 +26,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_T2ACIU5M_exports = {};
30
- __export(chunk_T2ACIU5M_exports, {
29
+ var chunk_VU5BLQUI_exports = {};
30
+ __export(chunk_VU5BLQUI_exports, {
31
31
  createSpinner: () => createSpinner
32
32
  });
33
- module.exports = __toCommonJS(chunk_T2ACIU5M_exports);
34
- var import_chunk_JX2HIV7V = require("./chunk-JX2HIV7V.js");
33
+ module.exports = __toCommonJS(chunk_VU5BLQUI_exports);
34
+ var import_chunk_VV4M6AN7 = require("./chunk-VV4M6AN7.js");
35
35
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
36
36
  var import_node_process = __toESM(require("node:process"));
37
37
  var import_node_process2 = __toESM(require("node:process"));
@@ -1952,12 +1952,6 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
1952
1952
  if (env.TERM === "xterm-kitty") {
1953
1953
  return 3;
1954
1954
  }
1955
- if (env.TERM === "xterm-ghostty") {
1956
- return 3;
1957
- }
1958
- if (env.TERM === "wezterm") {
1959
- return 3;
1960
- }
1961
1955
  if ("TERM_PROGRAM" in env) {
1962
1956
  const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
1963
1957
  switch (env.TERM_PROGRAM) {
@@ -2388,8 +2382,8 @@ var Ora = class {
2388
2382
  const fullSuffixText = this.#getFullSuffixText(this.#suffixText, "-");
2389
2383
  const fullText = " ".repeat(this.#indent) + fullPrefixText + "--" + this.#text + "--" + fullSuffixText;
2390
2384
  this.#lineCount = 0;
2391
- for (const line of (0, import_chunk_JX2HIV7V.stripAnsi)(fullText).split("\n")) {
2392
- this.#lineCount += Math.max(1, Math.ceil((0, import_chunk_JX2HIV7V.stringWidth)(line, { countAnsiEscapeCodes: true }) / columns));
2385
+ for (const line of (0, import_chunk_VV4M6AN7.stripAnsi)(fullText).split("\n")) {
2386
+ this.#lineCount += Math.max(1, Math.ceil((0, import_chunk_VV4M6AN7.stringWidth)(line, { countAnsiEscapeCodes: true }) / columns));
2393
2387
  }
2394
2388
  }
2395
2389
  get isEnabled() {
@@ -2471,7 +2465,7 @@ var Ora = class {
2471
2465
  return this;
2472
2466
  }
2473
2467
  if (this.#options.hideCursor) {
2474
- import_chunk_JX2HIV7V.cli_cursor_default.hide(this.#stream);
2468
+ import_chunk_VV4M6AN7.cli_cursor_default.hide(this.#stream);
2475
2469
  }
2476
2470
  if (this.#options.discardStdin && import_node_process.default.stdin.isTTY) {
2477
2471
  this.#isDiscardingStdin = true;
@@ -2490,7 +2484,7 @@ var Ora = class {
2490
2484
  this.#frameIndex = 0;
2491
2485
  this.clear();
2492
2486
  if (this.#options.hideCursor) {
2493
- import_chunk_JX2HIV7V.cli_cursor_default.show(this.#stream);
2487
+ import_chunk_VV4M6AN7.cli_cursor_default.show(this.#stream);
2494
2488
  }
2495
2489
  if (this.#options.discardStdin && import_node_process.default.stdin.isTTY && this.#isDiscardingStdin) {
2496
2490
  stdin_discarder_default.stop();