@prisma/migrate 6.20.0-dev.8 → 6.20.0-dev.9

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 (88) hide show
  1. package/dist/CLI.js +2 -2
  2. package/dist/Migrate.js +4 -8
  3. package/dist/SchemaEngineCLI.js +4 -4
  4. package/dist/SchemaEngineWasm.js +4 -4
  5. package/dist/bin.js +71 -74
  6. package/dist/chunk-3MCWUFUJ.js +169 -0
  7. package/dist/{chunk-O35BTK6Y.js → chunk-7BNYLV6P.js} +7 -14
  8. package/dist/{chunk-F2XCBEZ4.js → chunk-AIUUIREM.js} +27 -53
  9. package/dist/{chunk-74LUB4XX.js → chunk-BRPS327A.js} +23 -45
  10. package/dist/{chunk-7TVX3D4W.js → chunk-CQ6GMT2G.js} +23 -69
  11. package/dist/{chunk-EJG7GKM7.js → chunk-DCXZOUQV.js} +5 -5
  12. package/dist/{chunk-LLO7YF56.js → chunk-DYXUXG3K.js} +7 -7
  13. package/dist/{chunk-GSX25HRL.js → chunk-ENVEA7LT.js} +10 -13
  14. package/dist/{chunk-6ORQRJLP.js → chunk-FEUKQ7J3.js} +38 -132
  15. package/dist/{chunk-BHJMJSM4.js → chunk-IQWOR45L.js} +28 -24
  16. package/dist/{chunk-R4IWP35Z.js → chunk-IVL273O6.js} +20 -20
  17. package/dist/{chunk-PHXLQVPT.js → chunk-L7EZFBB4.js} +40 -68
  18. package/dist/{chunk-3AKRTEIK.js → chunk-N4SBKLAB.js} +24 -23
  19. package/dist/{chunk-NGQA5JTN.js → chunk-OAHBNV3B.js} +5 -5
  20. package/dist/{chunk-22YP3RXZ.js → chunk-OZ26HKM7.js} +7 -7
  21. package/dist/{chunk-AXR7LS2N.js → chunk-PEUHUCS4.js} +4 -5
  22. package/dist/{chunk-TW22Y3AA.js → chunk-QAOWTYGM.js} +31 -32
  23. package/dist/{chunk-2FXU5NZQ.js → chunk-QOPTDDIH.js} +5 -10
  24. package/dist/{chunk-J33EXHZB.js → chunk-S4LY555Z.js} +26 -46
  25. package/dist/{chunk-NB4FRYRQ.js → chunk-TLHUBVSH.js} +6 -6
  26. package/dist/{chunk-Z27SI4AV.js → chunk-TRUKHPCA.js} +20 -15
  27. package/dist/{chunk-D4TRX77Y.js → chunk-WF7UXKO5.js} +6 -9
  28. package/dist/{chunk-ZTIS675B.js → chunk-XFASRSQR.js} +81 -172
  29. package/dist/{chunk-3WC4XD74.js → chunk-XGTVKL4L.js} +11 -4
  30. package/dist/{chunk-VU5BLQUI.js → chunk-ZOT2HSX5.js} +218 -22
  31. package/dist/commands/DbCommand.js +2 -2
  32. package/dist/commands/DbDrop.js +5 -5
  33. package/dist/commands/DbExecute.js +5 -9
  34. package/dist/commands/DbPull.js +10 -16
  35. package/dist/commands/DbPush.js +8 -12
  36. package/dist/commands/DbSeed.js +3 -3
  37. package/dist/commands/MigrateCommand.js +2 -2
  38. package/dist/commands/MigrateDeploy.js +7 -11
  39. package/dist/commands/MigrateDev.js +8 -13
  40. package/dist/commands/MigrateDiff.js +6 -9
  41. package/dist/commands/MigrateReset.js +8 -13
  42. package/dist/commands/MigrateResolve.js +7 -11
  43. package/dist/commands/MigrateStatus.js +7 -11
  44. package/dist/index.js +44 -48
  45. package/dist/internals/src/cli/getSchema.d.ts +1 -15
  46. package/dist/migrate/src/CLI.d.ts +1 -1
  47. package/dist/migrate/src/Migrate.d.ts +2 -3
  48. package/dist/migrate/src/SchemaEngineCLI.d.ts +4 -3
  49. package/dist/migrate/src/commands/DbCommand.d.ts +1 -1
  50. package/dist/migrate/src/commands/DbDrop.d.ts +1 -1
  51. package/dist/migrate/src/commands/DbExecute.d.ts +1 -1
  52. package/dist/migrate/src/commands/DbPull.d.ts +1 -2
  53. package/dist/migrate/src/commands/DbPush.d.ts +1 -1
  54. package/dist/migrate/src/commands/MigrateCommand.d.ts +1 -1
  55. package/dist/migrate/src/commands/MigrateDeploy.d.ts +1 -1
  56. package/dist/migrate/src/commands/MigrateDev.d.ts +1 -1
  57. package/dist/migrate/src/commands/MigrateDiff.d.ts +2 -1
  58. package/dist/migrate/src/commands/MigrateReset.d.ts +1 -1
  59. package/dist/migrate/src/commands/MigrateResolve.d.ts +1 -1
  60. package/dist/migrate/src/commands/MigrateStatus.d.ts +1 -1
  61. package/dist/migrate/src/utils/ensureDatabaseExists.d.ts +9 -5
  62. package/dist/migrate/src/utils/errors.d.ts +3 -0
  63. package/dist/migrate/src/utils/getDatabaseVersionSafe.d.ts +2 -1
  64. package/dist/migrate/src/utils/introspectSql.d.ts +2 -2
  65. package/dist/migrate/src/utils/printDatasource.d.ts +1 -3
  66. package/dist/migrate/src/utils/seed.d.ts +0 -6
  67. package/dist/utils/ensureDatabaseExists.js +6 -6
  68. package/dist/utils/errors.js +8 -7
  69. package/dist/utils/getDatabaseVersionSafe.js +5 -9
  70. package/dist/utils/introspectSql.js +5 -9
  71. package/dist/utils/printDatasource.js +2 -2
  72. package/dist/utils/printDatasources.js +31 -3
  73. package/dist/utils/seed.js +2 -3
  74. package/dist/utils/setupMSSQL.js +18 -3
  75. package/dist/utils/spinner.js +2 -3
  76. package/dist/views/handleViewsIO.js +2 -2
  77. package/package.json +11 -11
  78. package/dist/chunk-AI6DH66U.js +0 -55
  79. package/dist/chunk-D6LYHB65.js +0 -905
  80. package/dist/chunk-RR6BKMNO.js +0 -80
  81. package/dist/chunk-T64SUJ5L.js +0 -46
  82. package/dist/chunk-VV4M6AN7.js +0 -233
  83. package/dist/migrate/src/utils/replaceOrAddDatasource.d.ts +0 -2
  84. package/dist/migrate/src/utils/replaceOrAddDatasource.test.d.ts +0 -1
  85. package/dist/migrate/src/utils/warnDatasourceDriverAdapter.d.ts +0 -2
  86. package/dist/utils/replaceOrAddDatasource.js +0 -25
  87. package/dist/utils/replaceOrAddDatasource.test.js +0 -207
  88. package/dist/utils/warnDatasourceDriverAdapter.js +0 -25
package/dist/CLI.js CHANGED
@@ -18,9 +18,9 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var CLI_exports = {};
20
20
  __export(CLI_exports, {
21
- CLI: () => import_chunk_NGQA5JTN.CLI
21
+ CLI: () => import_chunk_OAHBNV3B.CLI
22
22
  });
23
23
  module.exports = __toCommonJS(CLI_exports);
24
- var import_chunk_NGQA5JTN = require("./chunk-NGQA5JTN.js");
24
+ var import_chunk_OAHBNV3B = require("./chunk-OAHBNV3B.js");
25
25
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
26
26
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
package/dist/Migrate.js CHANGED
@@ -18,18 +18,14 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var Migrate_exports = {};
20
20
  __export(Migrate_exports, {
21
- Migrate: () => import_chunk_D6LYHB65.Migrate
21
+ Migrate: () => import_chunk_3MCWUFUJ.Migrate
22
22
  });
23
23
  module.exports = __toCommonJS(Migrate_exports);
24
- var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
25
- var import_chunk_T64SUJ5L = require("./chunk-T64SUJ5L.js");
26
- var import_chunk_VV4M6AN7 = require("./chunk-VV4M6AN7.js");
24
+ var import_chunk_3MCWUFUJ = require("./chunk-3MCWUFUJ.js");
27
25
  var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
28
26
  var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
29
- var import_chunk_3WDCTXHL = require("./chunk-3WDCTXHL.js");
30
- var import_chunk_22YP3RXZ = require("./chunk-22YP3RXZ.js");
31
- var import_chunk_GSX25HRL = require("./chunk-GSX25HRL.js");
32
- var import_chunk_AXR7LS2N = require("./chunk-AXR7LS2N.js");
27
+ var import_chunk_ENVEA7LT = require("./chunk-ENVEA7LT.js");
28
+ var import_chunk_PEUHUCS4 = require("./chunk-PEUHUCS4.js");
33
29
  var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
34
30
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
35
31
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
@@ -18,12 +18,12 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var SchemaEngineCLI_exports = {};
20
20
  __export(SchemaEngineCLI_exports, {
21
- EngineError: () => import_chunk_GSX25HRL.EngineError,
22
- SchemaEngineCLI: () => import_chunk_GSX25HRL.SchemaEngineCLI
21
+ EngineError: () => import_chunk_ENVEA7LT.EngineError,
22
+ SchemaEngineCLI: () => import_chunk_ENVEA7LT.SchemaEngineCLI
23
23
  });
24
24
  module.exports = __toCommonJS(SchemaEngineCLI_exports);
25
- var import_chunk_GSX25HRL = require("./chunk-GSX25HRL.js");
26
- var import_chunk_AXR7LS2N = require("./chunk-AXR7LS2N.js");
25
+ var import_chunk_ENVEA7LT = require("./chunk-ENVEA7LT.js");
26
+ var import_chunk_PEUHUCS4 = require("./chunk-PEUHUCS4.js");
27
27
  var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
28
28
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
29
29
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
@@ -18,12 +18,12 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var SchemaEngineWasm_exports = {};
20
20
  __export(SchemaEngineWasm_exports, {
21
- SchemaEngineWasm: () => import_chunk_22YP3RXZ.SchemaEngineWasm
21
+ SchemaEngineWasm: () => import_chunk_OZ26HKM7.SchemaEngineWasm
22
22
  });
23
23
  module.exports = __toCommonJS(SchemaEngineWasm_exports);
24
- var import_chunk_22YP3RXZ = require("./chunk-22YP3RXZ.js");
25
- var import_chunk_GSX25HRL = require("./chunk-GSX25HRL.js");
26
- var import_chunk_AXR7LS2N = require("./chunk-AXR7LS2N.js");
24
+ var import_chunk_OZ26HKM7 = require("./chunk-OZ26HKM7.js");
25
+ var import_chunk_ENVEA7LT = require("./chunk-ENVEA7LT.js");
26
+ var import_chunk_PEUHUCS4 = require("./chunk-PEUHUCS4.js");
27
27
  var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
28
28
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
29
29
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
package/dist/bin.js CHANGED
@@ -22,57 +22,53 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
23
  mod
24
24
  ));
25
- var import_chunk_NGQA5JTN = require("./chunk-NGQA5JTN.js");
26
- var import_chunk_NB4FRYRQ = require("./chunk-NB4FRYRQ.js");
27
- var import_chunk_BHJMJSM4 = require("./chunk-BHJMJSM4.js");
28
- var import_chunk_F2XCBEZ4 = require("./chunk-F2XCBEZ4.js");
25
+ var import_chunk_OAHBNV3B = require("./chunk-OAHBNV3B.js");
26
+ var import_chunk_TLHUBVSH = require("./chunk-TLHUBVSH.js");
27
+ var import_chunk_IQWOR45L = require("./chunk-IQWOR45L.js");
28
+ var import_chunk_AIUUIREM = require("./chunk-AIUUIREM.js");
29
29
  var import_chunk_C3722PDA = require("./chunk-C3722PDA.js");
30
30
  var import_chunk_7CQBDP4H = require("./chunk-7CQBDP4H.js");
31
- var import_chunk_ZTIS675B = require("./chunk-ZTIS675B.js");
31
+ var import_chunk_XFASRSQR = require("./chunk-XFASRSQR.js");
32
32
  var import_chunk_VAJ4VX67 = require("./chunk-VAJ4VX67.js");
33
- var import_chunk_J33EXHZB = require("./chunk-J33EXHZB.js");
33
+ var import_chunk_S4LY555Z = require("./chunk-S4LY555Z.js");
34
34
  var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
35
35
  var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
36
- var import_chunk_3AKRTEIK = require("./chunk-3AKRTEIK.js");
37
- var import_chunk_R4IWP35Z = require("./chunk-R4IWP35Z.js");
38
- var import_chunk_EJG7GKM7 = require("./chunk-EJG7GKM7.js");
39
- var import_chunk_7TVX3D4W = require("./chunk-7TVX3D4W.js");
40
- var import_chunk_6ORQRJLP = require("./chunk-6ORQRJLP.js");
41
- var import_chunk_VU5BLQUI = require("./chunk-VU5BLQUI.js");
36
+ var import_chunk_2R6DII47 = require("./chunk-2R6DII47.js");
37
+ var import_chunk_N4SBKLAB = require("./chunk-N4SBKLAB.js");
38
+ var import_chunk_IVL273O6 = require("./chunk-IVL273O6.js");
39
+ var import_chunk_DCXZOUQV = require("./chunk-DCXZOUQV.js");
40
+ var import_chunk_CQ6GMT2G = require("./chunk-CQ6GMT2G.js");
41
+ var import_chunk_FEUKQ7J3 = require("./chunk-FEUKQ7J3.js");
42
+ var import_chunk_ZOT2HSX5 = require("./chunk-ZOT2HSX5.js");
42
43
  var import_chunk_AHJ2N6BJ = require("./chunk-AHJ2N6BJ.js");
43
44
  var import_chunk_JZ75RIMZ = require("./chunk-JZ75RIMZ.js");
44
- var import_chunk_RR6BKMNO = require("./chunk-RR6BKMNO.js");
45
45
  var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
46
46
  var import_chunk_JFKDSUIE = require("./chunk-JFKDSUIE.js");
47
- var import_chunk_AI6DH66U = require("./chunk-AI6DH66U.js");
48
47
  var import_chunk_LGYRZ6CV = require("./chunk-LGYRZ6CV.js");
49
- var import_chunk_2R6DII47 = require("./chunk-2R6DII47.js");
50
- var import_chunk_TW22Y3AA = require("./chunk-TW22Y3AA.js");
48
+ var import_chunk_QAOWTYGM = require("./chunk-QAOWTYGM.js");
51
49
  var import_chunk_FBDQVK4W = require("./chunk-FBDQVK4W.js");
52
- var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
53
- var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
54
- var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
50
+ var import_chunk_XGTVKL4L = require("./chunk-XGTVKL4L.js");
51
+ var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
52
+ var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
55
53
  var import_chunk_TWPTG4XS = require("./chunk-TWPTG4XS.js");
56
- var import_chunk_D4TRX77Y = require("./chunk-D4TRX77Y.js");
57
- var import_chunk_PHXLQVPT = require("./chunk-PHXLQVPT.js");
58
- var import_chunk_LLO7YF56 = require("./chunk-LLO7YF56.js");
59
- var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
60
- var import_chunk_T64SUJ5L = require("./chunk-T64SUJ5L.js");
61
- var import_chunk_VV4M6AN7 = require("./chunk-VV4M6AN7.js");
54
+ var import_chunk_WF7UXKO5 = require("./chunk-WF7UXKO5.js");
55
+ var import_chunk_L7EZFBB4 = require("./chunk-L7EZFBB4.js");
56
+ var import_chunk_3WDCTXHL = require("./chunk-3WDCTXHL.js");
57
+ var import_chunk_DYXUXG3K = require("./chunk-DYXUXG3K.js");
58
+ var import_chunk_3MCWUFUJ = require("./chunk-3MCWUFUJ.js");
62
59
  var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
63
60
  var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
64
- var import_chunk_3WDCTXHL = require("./chunk-3WDCTXHL.js");
65
- var import_chunk_22YP3RXZ = require("./chunk-22YP3RXZ.js");
66
- var import_chunk_GSX25HRL = require("./chunk-GSX25HRL.js");
67
- var import_chunk_AXR7LS2N = require("./chunk-AXR7LS2N.js");
61
+ var import_chunk_ENVEA7LT = require("./chunk-ENVEA7LT.js");
62
+ var import_chunk_PEUHUCS4 = require("./chunk-PEUHUCS4.js");
68
63
  var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
69
64
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
70
65
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
66
+ var import_node_path = __toESM(require("node:path"));
71
67
  var import_config = require("@prisma/config");
72
68
  var import_debug = __toESM(require("@prisma/debug"));
73
69
  var import_engines_version = require("@prisma/engines-version");
74
70
  var import_internals = require("@prisma/internals");
75
- var version = "6.20.0-dev.8";
71
+ var version = "6.20.0-dev.9";
76
72
  process.on("uncaughtException", (e) => {
77
73
  console.log(e);
78
74
  });
@@ -92,66 +88,67 @@ var args = (0, import_internals.arg)(
92
88
  true
93
89
  );
94
90
  async function main() {
95
- const cli = import_chunk_NGQA5JTN.CLI.new({
96
- migrate: import_chunk_LLO7YF56.MigrateCommand.new({
97
- dev: import_chunk_F2XCBEZ4.MigrateDev.new(),
98
- status: import_chunk_R4IWP35Z.MigrateStatus.new(),
99
- resolve: import_chunk_3AKRTEIK.MigrateResolve.new(),
100
- reset: import_chunk_J33EXHZB.MigrateReset.new(),
101
- deploy: import_chunk_BHJMJSM4.MigrateDeploy.new(),
102
- diff: import_chunk_ZTIS675B.MigrateDiff.new()
91
+ const cli = import_chunk_OAHBNV3B.CLI.new({
92
+ migrate: import_chunk_DYXUXG3K.MigrateCommand.new({
93
+ dev: import_chunk_AIUUIREM.MigrateDev.new(),
94
+ status: import_chunk_IVL273O6.MigrateStatus.new(),
95
+ resolve: import_chunk_N4SBKLAB.MigrateResolve.new(),
96
+ reset: import_chunk_S4LY555Z.MigrateReset.new(),
97
+ deploy: import_chunk_IQWOR45L.MigrateDeploy.new(),
98
+ diff: import_chunk_XFASRSQR.MigrateDiff.new()
103
99
  }),
104
- db: import_chunk_EJG7GKM7.DbCommand.new({
105
- execute: import_chunk_7TVX3D4W.DbExecute.new(),
106
- pull: import_chunk_6ORQRJLP.DbPull.new(),
107
- push: import_chunk_TW22Y3AA.DbPush.new(),
100
+ db: import_chunk_DCXZOUQV.DbCommand.new({
101
+ execute: import_chunk_CQ6GMT2G.DbExecute.new(),
102
+ pull: import_chunk_FEUKQ7J3.DbPull.new(),
103
+ push: import_chunk_QAOWTYGM.DbPush.new(),
108
104
  // drop: DbDrop.new(),
109
- seed: import_chunk_D4TRX77Y.DbSeed.new()
105
+ seed: import_chunk_WF7UXKO5.DbSeed.new()
110
106
  })
111
107
  });
112
- const { config, error } = await (0, import_config.loadConfigFromFile)({ configFile: args["--config"] });
108
+ const configFile = args["--config"];
109
+ const configDir = configFile ? import_node_path.default.resolve(configFile, "..") : process.cwd();
110
+ const { config, error } = await (0, import_config.loadConfigFromFile)({ configFile });
113
111
  if (error) {
114
112
  console.error(`Failed to load config file: ${error._tag}`);
115
113
  return 1;
116
114
  }
117
- const result = await cli.parse(commandArray, config);
118
- if (result instanceof import_internals.HelpError) {
119
- console.error(result);
120
- return 1;
121
- } else if ((0, import_internals.isError)(result)) {
122
- console.error(result);
115
+ if (!config) {
116
+ console.error("`prisma.config.ts` not found");
123
117
  return 1;
124
118
  }
125
- console.log(result);
126
- return 0;
119
+ try {
120
+ const result = await cli.parse(commandArray, config, configDir);
121
+ if (result instanceof import_internals.HelpError) {
122
+ console.error(result);
123
+ return 1;
124
+ } else if ((0, import_internals.isError)(result)) {
125
+ console.error(result);
126
+ return 1;
127
+ }
128
+ console.log(result);
129
+ return 0;
130
+ } catch (error2) {
131
+ if (error2.rustStack) {
132
+ await (0, import_internals.handlePanic)({
133
+ error: error2,
134
+ cliVersion: version,
135
+ enginesVersion: import_engines_version.enginesVersion,
136
+ command: commandArray.join(" "),
137
+ getDatabaseVersionSafe: (args2) => (0, import_chunk_TLHUBVSH.getDatabaseVersionSafe)(args2, config, configDir)
138
+ });
139
+ }
140
+ throw error2;
141
+ }
127
142
  }
128
143
  main().then((code) => {
129
144
  if (code !== 0) {
130
145
  process.exit(code);
131
146
  }
132
147
  }).catch((error) => {
133
- if (error.rustStack) {
134
- (0, import_internals.handlePanic)({
135
- error,
136
- cliVersion: version,
137
- enginesVersion: import_engines_version.enginesVersion,
138
- command: commandArray.join(" "),
139
- getDatabaseVersionSafe: import_chunk_NB4FRYRQ.getDatabaseVersionSafe
140
- }).catch((e) => {
141
- if (import_debug.default.enabled("migrate")) {
142
- console.error((0, import_chunk_SKRR5WT4.red)((0, import_chunk_SKRR5WT4.bold)("Error: ")) + e.stack);
143
- } else {
144
- console.error((0, import_chunk_SKRR5WT4.red)((0, import_chunk_SKRR5WT4.bold)("Error: ")) + e.message);
145
- }
146
- }).finally(() => {
147
- process.exit(1);
148
- });
148
+ if (import_debug.default.enabled("migrate")) {
149
+ console.error((0, import_chunk_SKRR5WT4.red)((0, import_chunk_SKRR5WT4.bold)("Error: ")) + error.stack);
149
150
  } else {
150
- if (import_debug.default.enabled("migrate")) {
151
- console.error((0, import_chunk_SKRR5WT4.red)((0, import_chunk_SKRR5WT4.bold)("Error: ")) + error.stack);
152
- } else {
153
- console.error((0, import_chunk_SKRR5WT4.red)((0, import_chunk_SKRR5WT4.bold)("Error: ")) + error.message);
154
- }
155
- process.exit(1);
151
+ console.error((0, import_chunk_SKRR5WT4.red)((0, import_chunk_SKRR5WT4.bold)("Error: ")) + error.message);
156
152
  }
153
+ process.exit(1);
157
154
  });
@@ -0,0 +1,169 @@
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_3MCWUFUJ_exports = {};
20
+ __export(chunk_3MCWUFUJ_exports, {
21
+ Migrate: () => Migrate
22
+ });
23
+ module.exports = __toCommonJS(chunk_3MCWUFUJ_exports);
24
+ var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
25
+ var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
26
+ var import_chunk_ENVEA7LT = require("./chunk-ENVEA7LT.js");
27
+ var import_internals = require("@prisma/internals");
28
+ var Migrate = class _Migrate {
29
+ engine;
30
+ schemaContext;
31
+ schemaFilter;
32
+ shadowDbInitScript;
33
+ migrationsDirectoryPath;
34
+ constructor({ schemaContext, migrationsDirPath, engine, schemaFilter, shadowDbInitScript }) {
35
+ this.engine = engine;
36
+ this.schemaContext = schemaContext;
37
+ this.migrationsDirectoryPath = migrationsDirPath;
38
+ this.schemaFilter = schemaFilter ?? { externalTables: [], externalEnums: [] };
39
+ this.shadowDbInitScript = shadowDbInitScript ?? "";
40
+ }
41
+ static async setup({ schemaContext, schemaEngineConfig, ...rest }) {
42
+ const schemaEngine = await (async () => {
43
+ const datasource = schemaEngineConfig.datasource;
44
+ return await import_chunk_ENVEA7LT.SchemaEngineCLI.setup({ datasource, schemaContext, ...rest });
45
+ })();
46
+ return new _Migrate({ engine: schemaEngine, schemaContext, ...rest });
47
+ }
48
+ async stop() {
49
+ await this.engine.stop();
50
+ }
51
+ getPrismaSchema() {
52
+ if (!this.schemaContext) throw new Error("this.schemaContext is undefined");
53
+ return (0, import_internals.toSchemasContainer)(this.schemaContext.schemaFiles);
54
+ }
55
+ reset() {
56
+ return this.engine.reset({
57
+ filter: this.schemaFilter
58
+ });
59
+ }
60
+ async createMigration(params) {
61
+ if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
62
+ const migrationsList = await (0, import_chunk_GGA2F64G.listMigrations)(this.migrationsDirectoryPath, this.shadowDbInitScript);
63
+ const { connectorType, generatedMigrationName, extension, migrationScript } = await this.engine.createMigration({
64
+ ...params,
65
+ migrationsList,
66
+ filters: this.schemaFilter
67
+ });
68
+ const { baseDir, lockfile } = migrationsList;
69
+ if (migrationScript === null) {
70
+ return {
71
+ generatedMigrationName: void 0
72
+ };
73
+ }
74
+ const directoryPath = await (0, import_chunk_23DZXSTI.createMigration)({
75
+ baseDir,
76
+ generatedMigrationName
77
+ }).catch((e) => {
78
+ throw new Error(`Failed to create a new migration directory: ${e.message}`);
79
+ });
80
+ await (0, import_chunk_23DZXSTI.writeMigrationScript)({
81
+ baseDir,
82
+ extension,
83
+ migrationName: generatedMigrationName,
84
+ script: migrationScript
85
+ }).catch((e) => {
86
+ throw new Error(`Failed to write migration script to ${directoryPath}: ${e.message}`);
87
+ });
88
+ await (0, import_chunk_23DZXSTI.writeMigrationLockfile)({
89
+ baseDir,
90
+ connectorType,
91
+ lockfile
92
+ }).catch((e) => {
93
+ throw new Error(`Failed to write the migration lock file to ${baseDir}: ${e.message}`);
94
+ });
95
+ return {
96
+ generatedMigrationName
97
+ };
98
+ }
99
+ async diagnoseMigrationHistory({
100
+ optInToShadowDatabase
101
+ }) {
102
+ if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
103
+ const migrationsList = await (0, import_chunk_GGA2F64G.listMigrations)(this.migrationsDirectoryPath, this.shadowDbInitScript);
104
+ return this.engine.diagnoseMigrationHistory({
105
+ migrationsList,
106
+ optInToShadowDatabase,
107
+ filters: this.schemaFilter
108
+ });
109
+ }
110
+ async listMigrationDirectories() {
111
+ if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
112
+ const migrationsList = await (0, import_chunk_GGA2F64G.listMigrations)(this.migrationsDirectoryPath, this.shadowDbInitScript);
113
+ return {
114
+ migrations: migrationsList.migrationDirectories.map((dir) => dir.path)
115
+ };
116
+ }
117
+ async devDiagnostic() {
118
+ if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
119
+ const migrationsList = await (0, import_chunk_GGA2F64G.listMigrations)(this.migrationsDirectoryPath, this.shadowDbInitScript);
120
+ return this.engine.devDiagnostic({
121
+ migrationsList,
122
+ filters: this.schemaFilter
123
+ });
124
+ }
125
+ async markMigrationApplied({ migrationId }) {
126
+ if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
127
+ const migrationsList = await (0, import_chunk_GGA2F64G.listMigrations)(this.migrationsDirectoryPath, this.shadowDbInitScript);
128
+ return await this.engine.markMigrationApplied({
129
+ migrationsList,
130
+ migrationName: migrationId
131
+ });
132
+ }
133
+ markMigrationRolledBack({ migrationId }) {
134
+ return this.engine.markMigrationRolledBack({
135
+ migrationName: migrationId
136
+ });
137
+ }
138
+ async applyMigrations() {
139
+ if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
140
+ const migrationsList = await (0, import_chunk_GGA2F64G.listMigrations)(this.migrationsDirectoryPath, this.shadowDbInitScript);
141
+ return this.engine.applyMigrations({
142
+ migrationsList,
143
+ filters: this.schemaFilter
144
+ });
145
+ }
146
+ async evaluateDataLoss() {
147
+ if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
148
+ const migrationsList = await (0, import_chunk_GGA2F64G.listMigrations)(this.migrationsDirectoryPath, this.shadowDbInitScript);
149
+ const schema = this.getPrismaSchema();
150
+ return this.engine.evaluateDataLoss({
151
+ migrationsList,
152
+ schema,
153
+ filters: this.schemaFilter
154
+ });
155
+ }
156
+ async push({ force = false }) {
157
+ const schema = this.getPrismaSchema();
158
+ const { warnings, unexecutable, executedSteps } = await this.engine.schemaPush({
159
+ force,
160
+ schema,
161
+ filters: this.schemaFilter
162
+ });
163
+ return {
164
+ executedSteps,
165
+ warnings,
166
+ unexecutable
167
+ };
168
+ }
169
+ };
@@ -16,15 +16,14 @@ 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_O35BTK6Y_exports = {};
20
- __export(chunk_O35BTK6Y_exports, {
19
+ var chunk_7BNYLV6P_exports = {};
20
+ __export(chunk_7BNYLV6P_exports, {
21
21
  introspectSql: () => introspectSql
22
22
  });
23
- module.exports = __toCommonJS(chunk_O35BTK6Y_exports);
24
- var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
25
- var import_internals = require("@prisma/internals");
23
+ module.exports = __toCommonJS(chunk_7BNYLV6P_exports);
24
+ var import_chunk_3MCWUFUJ = require("./chunk-3MCWUFUJ.js");
26
25
  var supportedProviders = ["postgresql", "cockroachdb", "mysql", "sqlite"];
27
- async function introspectSql(schemaContext, queries) {
26
+ async function introspectSql(schemaContext, config, configDir, queries) {
28
27
  if (!isTypedSqlEnabled(schemaContext.generators)) {
29
28
  throw new Error(`\`typedSql\` preview feature needs to be enabled in ${schemaContext.loadedFromPathForLogMessages}`);
30
29
  }
@@ -35,19 +34,13 @@ async function introspectSql(schemaContext, queries) {
35
34
  if (!supportedProviders.includes(firstDatasource.activeProvider)) {
36
35
  throw new Error(`Typed SQL is supported only for ${supportedProviders.join(", ")} providers`);
37
36
  }
38
- const url = (0, import_internals.getEffectiveUrl)(firstDatasource).value;
39
- if (!url) {
40
- throw new Error(
41
- `Could not get url from datasource ${firstDatasource.name} in ${schemaContext.loadedFromPathForLogMessages}`
42
- );
43
- }
44
- const migrate = await import_chunk_D6LYHB65.Migrate.setup({ schemaContext });
37
+ const migrate = await import_chunk_3MCWUFUJ.Migrate.setup({ schemaContext, schemaEngineConfig: config, configDir });
45
38
  const schemaEngine = migrate.engine;
46
39
  const results = [];
47
40
  const errors = [];
48
41
  try {
49
42
  for (const query of queries) {
50
- const queryResult = await introspectSingleQuery(schemaEngine, url, query);
43
+ const queryResult = await introspectSingleQuery(schemaEngine, config.datasource.url, query);
51
44
  if (queryResult.ok) {
52
45
  results.push(queryResult.result);
53
46
  } else {
@@ -26,20 +26,19 @@ 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_F2XCBEZ4_exports = {};
30
- __export(chunk_F2XCBEZ4_exports, {
29
+ var chunk_AIUUIREM_exports = {};
30
+ __export(chunk_AIUUIREM_exports, {
31
31
  MigrateDev: () => MigrateDev
32
32
  });
33
- module.exports = __toCommonJS(chunk_F2XCBEZ4_exports);
33
+ module.exports = __toCommonJS(chunk_AIUUIREM_exports);
34
34
  var import_chunk_C3722PDA = require("./chunk-C3722PDA.js");
35
35
  var import_chunk_7CQBDP4H = require("./chunk-7CQBDP4H.js");
36
36
  var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
37
37
  var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
38
- var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
39
- var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
40
- var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
41
- var import_chunk_PHXLQVPT = require("./chunk-PHXLQVPT.js");
42
- var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
38
+ var import_chunk_XGTVKL4L = require("./chunk-XGTVKL4L.js");
39
+ var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
40
+ var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
41
+ var import_chunk_3MCWUFUJ = require("./chunk-3MCWUFUJ.js");
43
42
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
44
43
  var import_node_path = __toESM(require("node:path"));
45
44
  var import_debug = __toESM(require("@prisma/debug"));
@@ -52,11 +51,13 @@ var MigrateDev = class _MigrateDev {
52
51
  }
53
52
  static help = (0, import_internals.format)(`
54
53
  ${process.platform === "win32" ? "" : "\u{1F3CB}\uFE0F "}Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client)
55
-
54
+
56
55
  ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
57
56
 
58
57
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev [options]
59
58
 
59
+ The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma.config.ts")}).
60
+
60
61
  ${(0, import_chunk_SKRR5WT4.bold)("Options")}
61
62
 
62
63
  -h, --help Display this help message
@@ -65,8 +66,6 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
65
66
  -n, --name Name the migration
66
67
  --create-only Create a new migration but do not apply it
67
68
  The migration will be empty if there are no changes in Prisma schema
68
- --skip-generate Skip triggering generators (e.g. Prisma Client)
69
- --skip-seed Skip triggering seed
70
69
 
71
70
  ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
72
71
 
@@ -79,7 +78,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
79
78
  Create a migration without applying it
80
79
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev --create-only
81
80
  `);
82
- async parse(argv, config) {
81
+ async parse(argv, config, configDir) {
83
82
  const args = (0, import_internals.arg)(argv, {
84
83
  "--help": Boolean,
85
84
  "-h": "--help",
@@ -90,8 +89,6 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
90
89
  "--create-only": Boolean,
91
90
  "--schema": String,
92
91
  "--config": String,
93
- "--skip-generate": Boolean,
94
- "--skip-seed": Boolean,
95
92
  "--telemetry-information": String
96
93
  });
97
94
  if ((0, import_internals.isError)(args)) {
@@ -100,32 +97,33 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
100
97
  if (args["--help"]) {
101
98
  return this.help();
102
99
  }
103
- await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
104
100
  const schemaContext = await (0, import_internals.loadSchemaContext)({
105
101
  schemaPathFromArg: args["--schema"],
106
- schemaPathFromConfig: config.schema,
107
- schemaEngineConfig: config
102
+ schemaPathFromConfig: config.schema
108
103
  });
109
104
  const { migrationsDirPath } = (0, import_internals.inferDirectoryConfig)(schemaContext, config);
110
- (0, import_internals.checkUnsupportedDataProxy)({ cmd: "migrate dev", schemaContext });
111
- const datasourceInfo = (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext.primaryDatasource);
112
- const adapter = config.engine === "js" ? await config.adapter() : void 0;
113
- (0, import_chunk_2FXU5NZQ.printDatasource)({ datasourceInfo, adapter });
105
+ const cmd = "migrate dev";
106
+ const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config, cmd });
107
+ (0, import_internals.checkUnsupportedDataProxy)({ cmd, validatedConfig });
108
+ const datasourceInfo = (0, import_chunk_BRPS327A.parseDatasourceInfo)(schemaContext.primaryDatasource, validatedConfig);
109
+ (0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo });
114
110
  process.stdout.write("\n");
115
111
  (0, import_internals.validate)({ schemas: schemaContext.schemaFiles });
116
- let wasDbCreated;
117
- if (!adapter) {
118
- wasDbCreated = await (0, import_chunk_74LUB4XX.ensureDatabaseExists)(schemaContext.primaryDatasource);
119
- if (wasDbCreated) {
120
- process.stdout.write(wasDbCreated + "\n\n");
121
- }
112
+ const successMessage = await (0, import_chunk_BRPS327A.ensureDatabaseExists)(
113
+ configDir,
114
+ (0, import_internals.getSchemaDatasourceProvider)(schemaContext),
115
+ validatedConfig
116
+ );
117
+ if (successMessage) {
118
+ process.stdout.write(successMessage + "\n\n");
122
119
  }
123
120
  const schemaFilter = {
124
121
  externalTables: config.tables?.external ?? [],
125
122
  externalEnums: config.enums?.external ?? []
126
123
  };
127
- const migrate = await import_chunk_D6LYHB65.Migrate.setup({
124
+ const migrate = await import_chunk_3MCWUFUJ.Migrate.setup({
128
125
  schemaEngineConfig: config,
126
+ configDir,
129
127
  migrationsDirPath,
130
128
  schemaContext,
131
129
  schemaFilter,
@@ -206,7 +204,7 @@ ${(0, import_chunk_KRQEFTDT.printFilesFromMigrationIds)(
206
204
  if (!args["--force"]) {
207
205
  if (!(0, import_internals.canPrompt)()) {
208
206
  await migrate.stop();
209
- throw new import_chunk_3WC4XD74.MigrateDevEnvNonInteractiveError();
207
+ throw new import_chunk_XGTVKL4L.MigrateDevEnvNonInteractiveError();
210
208
  }
211
209
  const message = args["--create-only"] ? "Are you sure you want to create this migration?" : "Are you sure you want to create and apply this migration?";
212
210
  const confirmation = await (0, import_prompts.default)({
@@ -280,30 +278,6 @@ ${(0, import_chunk_SKRR5WT4.green)("Your database is now in sync with your schem
280
278
  `
281
279
  );
282
280
  }
283
- if (!process.env.PRISMA_MIGRATE_SKIP_GENERATE && !args["--skip-generate"]) {
284
- await migrate.tryToRunGenerate(datasourceInfo);
285
- process.stdout.write("\n");
286
- }
287
- if (wasDbCreated && !process.env.PRISMA_MIGRATE_SKIP_SEED && !args["--skip-seed"]) {
288
- try {
289
- const seedCommandFromPrismaConfig = config.migrations?.seed;
290
- const seedCommandFromPkgJson = await (0, import_chunk_PHXLQVPT.getSeedCommandFromPackageJson)(process.cwd());
291
- const seedCommand = seedCommandFromPrismaConfig ?? seedCommandFromPkgJson;
292
- if (seedCommand) {
293
- process.stdout.write("\n");
294
- const successfulSeeding = await (0, import_chunk_PHXLQVPT.executeSeedCommand)({ commandFromConfig: seedCommand });
295
- if (successfulSeeding) {
296
- process.stdout.write(`
297
- ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.
298
- `);
299
- } else {
300
- process.exit(1);
301
- }
302
- }
303
- } catch (e) {
304
- console.error(e);
305
- }
306
- }
307
281
  return "";
308
282
  }
309
283
  logResetReason({ datasourceInfo, reason }) {