@prisma/migrate 6.20.0-integration-next.2 → 6.20.0-integration-merge-release-workflows.1

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 (59) hide show
  1. package/dist/Migrate.js +6 -6
  2. package/dist/SchemaEngineCLI.js +4 -4
  3. package/dist/SchemaEngineWasm.js +4 -4
  4. package/dist/bin.js +31 -30
  5. package/dist/{chunk-GH6IOZTT.js → chunk-22YP3RXZ.js} +7 -7
  6. package/dist/{chunk-4BAGKFIV.js → chunk-3AKRTEIK.js} +11 -10
  7. package/dist/{chunk-FBPXMCYK.js → chunk-6ORQRJLP.js} +109 -28
  8. package/dist/{chunk-EVUHOCOP.js → chunk-7TVX3D4W.js} +65 -27
  9. package/dist/{chunk-PEUHUCS4.js → chunk-AXR7LS2N.js} +5 -4
  10. package/dist/{chunk-EERZNF42.js → chunk-BHJMJSM4.js} +7 -6
  11. package/dist/{chunk-WF7UXKO5.js → chunk-D4TRX77Y.js} +9 -6
  12. package/dist/{chunk-V3D2XB5I.js → chunk-D6LYHB65.js} +29 -37
  13. package/dist/{chunk-BP3VX5NQ.js → chunk-F2XCBEZ4.js} +13 -10
  14. package/dist/{chunk-SYWL5XS4.js → chunk-GSX25HRL.js} +5 -5
  15. package/dist/{chunk-SFX5KEGP.js → chunk-J33EXHZB.js} +12 -9
  16. package/dist/{chunk-PQ3UMDEP.js → chunk-NB4FRYRQ.js} +5 -5
  17. package/dist/{chunk-BB43AVYJ.js → chunk-O35BTK6Y.js} +13 -9
  18. package/dist/{chunk-FRY7T46S.js → chunk-OP2BDF75.js} +11 -10
  19. package/dist/{chunk-L7EZFBB4.js → chunk-PHXLQVPT.js} +68 -40
  20. package/dist/{chunk-XA2JOJS2.js → chunk-QVMYNWAN.js} +70 -157
  21. package/dist/{chunk-Z7WLEGCP.js → chunk-R4IWP35Z.js} +9 -8
  22. package/dist/chunk-RR6BKMNO.js +80 -0
  23. package/dist/{chunk-6FL2LODV.js → chunk-TW22Y3AA.js} +7 -6
  24. package/dist/{chunk-T2ACIU5M.js → chunk-VU5BLQUI.js} +8 -14
  25. package/dist/{chunk-JX2HIV7V.js → chunk-VV4M6AN7.js} +10 -10
  26. package/dist/{chunk-GY34KW2I.js → chunk-Z27SI4AV.js} +4 -6
  27. package/dist/{chunk-QCMPSEBY.js → chunk-ZTIS675B.js} +205 -138
  28. package/dist/commands/DbDrop.js +2 -2
  29. package/dist/commands/DbExecute.js +7 -7
  30. package/dist/commands/DbPull.js +9 -8
  31. package/dist/commands/DbPush.js +7 -7
  32. package/dist/commands/DbSeed.js +3 -3
  33. package/dist/commands/MigrateDeploy.js +7 -7
  34. package/dist/commands/MigrateDev.js +8 -8
  35. package/dist/commands/MigrateDiff.js +7 -8
  36. package/dist/commands/MigrateReset.js +8 -8
  37. package/dist/commands/MigrateResolve.js +7 -7
  38. package/dist/commands/MigrateStatus.js +7 -7
  39. package/dist/index.js +37 -36
  40. package/dist/internals/src/cli/getSchema.d.ts +15 -1
  41. package/dist/migrate/src/Migrate.d.ts +2 -1
  42. package/dist/migrate/src/commands/MigrateDiff.d.ts +0 -1
  43. package/dist/migrate/src/utils/introspectSql.d.ts +1 -2
  44. package/dist/migrate/src/utils/replaceOrAddDatasource.d.ts +2 -0
  45. package/dist/migrate/src/utils/replaceOrAddDatasource.test.d.ts +1 -0
  46. package/dist/migrate/src/utils/seed.d.ts +6 -0
  47. package/dist/utils/getDatabaseVersionSafe.js +7 -7
  48. package/dist/utils/introspectSql.js +7 -7
  49. package/dist/utils/replaceOrAddDatasource.js +25 -0
  50. package/dist/utils/replaceOrAddDatasource.test.js +207 -0
  51. package/dist/utils/seed.js +3 -2
  52. package/dist/utils/setupCockroach.js +2 -2
  53. package/dist/utils/setupMSSQL.js +30480 -31090
  54. package/dist/utils/setupMongo.js +768 -2048
  55. package/dist/utils/setupPostgres.js +2 -2
  56. package/dist/utils/spinner.js +3 -3
  57. package/dist/views/handleViewsIO.js +2 -2
  58. package/package.json +11 -11
  59. package/dist/open-GFNXULGD.js +0 -593
@@ -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_EVUHOCOP_exports = {};
30
- __export(chunk_EVUHOCOP_exports, {
29
+ var chunk_7TVX3D4W_exports = {};
30
+ __export(chunk_7TVX3D4W_exports, {
31
31
  DbExecute: () => DbExecute
32
32
  });
33
- module.exports = __toCommonJS(chunk_EVUHOCOP_exports);
34
- var import_chunk_V3D2XB5I = require("./chunk-V3D2XB5I.js");
33
+ module.exports = __toCommonJS(chunk_7TVX3D4W_exports);
34
+ var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
35
35
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
36
36
  var import_consumers = __toESM(require("node:stream/consumers"));
37
37
  var import_internals = require("@prisma/internals");
@@ -47,7 +47,9 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
47
47
  -h, --help Display this help message
48
48
  --config Custom path to your Prisma config file
49
49
 
50
- Datasource configuration is read from ${(0, import_chunk_SKRR5WT4.italic)("prisma.config.ts")}.
50
+ ${(0, import_chunk_SKRR5WT4.italic)("Datasource input, only 1 must be provided:")}
51
+ --url URL of the datasource to run the command on
52
+ --schema Path to your Prisma schema file to take the datasource URL from
51
53
 
52
54
  ${(0, import_chunk_SKRR5WT4.italic)("Script input, only 1 must be provided:")}
53
55
  --file Path to a file. The content will be sent as the script to be executed
@@ -66,11 +68,11 @@ var DbExecute = class _DbExecute {
66
68
  static help = (0, import_internals.format)(`
67
69
  ${process.platform === "win32" ? "" : "\u{1F4DD} "}Execute native commands to your database
68
70
 
69
- This command takes as input a datasource defined in ${(0, import_chunk_SKRR5WT4.italic)("prisma.config.ts")} and a script, using ${(0, import_chunk_SKRR5WT4.green)(
71
+ This command takes as input a datasource, using ${(0, import_chunk_SKRR5WT4.green)(`--url`)} or ${(0, import_chunk_SKRR5WT4.green)(`--schema`)} and a script, using ${(0, import_chunk_SKRR5WT4.green)(
70
72
  `--stdin`
71
73
  )} or ${(0, import_chunk_SKRR5WT4.green)(`--file`)}.
72
- The script input parameters are mutually exclusive, only 1 must be provided.
73
-
74
+ The input parameters are mutually exclusive, only 1 of each (datasource & script) must be provided.
75
+
74
76
  The output of the command is connector-specific, and is not meant for returning data, but only to report success or failure.
75
77
 
76
78
  On SQL databases, this command takes as input a SQL script.
@@ -80,14 +82,23 @@ ${(0, import_chunk_SKRR5WT4.italic)(`This command is currently not supported on
80
82
 
81
83
  ${helpOptions}
82
84
  ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
85
+
86
+ Execute the content of a SQL script file to the datasource URL taken from the schema
87
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute
88
+ --file ./script.sql \\
89
+ --schema schema.prisma
83
90
 
84
- Execute the content of a SQL script file using the datasource configured in prisma.config.ts
85
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute --file ./script.sql
91
+ Execute the SQL script from stdin to the datasource URL specified via the \`DATABASE_URL\` environment variable
92
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
93
+ prisma db execute \\
94
+ --stdin \\
95
+ --url="$DATABASE_URL"
86
96
 
87
- Execute the SQL script from stdin using the configured datasource
97
+ Like previous example, but exposing the datasource url credentials to your terminal history
88
98
  ${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
89
99
  prisma db execute \\
90
- --stdin
100
+ --stdin \\
101
+ --url="mysql://root:root@localhost/mydb"
91
102
  `);
92
103
  async parse(argv, config) {
93
104
  const args = (0, import_internals.arg)(
@@ -98,6 +109,8 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
98
109
  "--config": String,
99
110
  "--stdin": Boolean,
100
111
  "--file": String,
112
+ "--schema": String,
113
+ "--url": String,
101
114
  "--telemetry-information": String
102
115
  },
103
116
  false
@@ -108,15 +121,33 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
108
121
  if (args["--help"]) {
109
122
  return this.help();
110
123
  }
124
+ await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: false, config });
111
125
  const cmd = "db execute";
126
+ (0, import_internals.checkUnsupportedSchemaEngineWasm)({
127
+ cmd,
128
+ config,
129
+ args,
130
+ flags: ["--url"]
131
+ });
112
132
  if (args["--stdin"] && args["--file"]) {
113
133
  throw new Error(
114
- `--stdin and --file cannot be used at the same time. Only 1 must be provided.
134
+ `--stdin and --file cannot be used at the same time. Only 1 must be provided.
115
135
  See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
116
136
  );
117
137
  } else if (!args["--stdin"] && !args["--file"]) {
118
138
  throw new Error(
119
139
  `Either --stdin or --file must be provided.
140
+ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
141
+ );
142
+ }
143
+ if (args["--url"] && args["--schema"]) {
144
+ throw new Error(
145
+ `--url and --schema cannot be used at the same time. Only 1 must be provided.
146
+ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
147
+ );
148
+ } else if (!args["--url"] && !args["--schema"]) {
149
+ throw new Error(
150
+ `Either --url or --schema must be provided.
120
151
  See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
121
152
  );
122
153
  }
@@ -136,21 +167,28 @@ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExec
136
167
  if (args["--stdin"]) {
137
168
  script = await import_consumers.default.text(process.stdin);
138
169
  }
139
- if (config.engine === "js") {
140
- throw new Error('engine: "js" is not yet supported in `db execute`.');
141
- }
142
- if (config.engine !== "classic" || !config.datasource?.url) {
143
- throw new Error(
144
- `A datasource URL must be provided via prisma.config.ts.
145
- See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
146
- );
170
+ let datasourceType;
171
+ if (args["--url"]) {
172
+ (0, import_internals.checkUnsupportedDataProxy)({ cmd, urls: [args["--url"]] });
173
+ datasourceType = {
174
+ tag: "url",
175
+ url: args["--url"]
176
+ };
177
+ } else {
178
+ const schemaContext = await (0, import_internals.loadSchemaContext)({
179
+ schemaPathFromArg: args["--schema"],
180
+ schemaPathFromConfig: config.schema,
181
+ schemaEngineConfig: config,
182
+ printLoadMessage: false
183
+ });
184
+ (0, import_internals.checkUnsupportedDataProxy)({ cmd, schemaContext });
185
+ datasourceType = {
186
+ tag: "schema",
187
+ ...(0, import_internals.toSchemasContainer)(schemaContext.schemaFiles),
188
+ configDir: schemaContext.primaryDatasourceDirectory
189
+ };
147
190
  }
148
- (0, import_internals.checkUnsupportedDataProxy)({ cmd, urls: [config.datasource.url] });
149
- const datasourceType = {
150
- tag: "url",
151
- url: config.datasource.url
152
- };
153
- const migrate = await import_chunk_V3D2XB5I.Migrate.setup({ schemaEngineConfig: config, extensions: config["extensions"] });
191
+ const migrate = await import_chunk_D6LYHB65.Migrate.setup({ schemaEngineConfig: config, extensions: config["extensions"] });
154
192
  try {
155
193
  await migrate.engine.dbExecute({
156
194
  script,
@@ -26,11 +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_PEUHUCS4_exports = {};
30
- __export(chunk_PEUHUCS4_exports, {
31
- handleViewsIO: () => handleViewsIO
29
+ var chunk_AXR7LS2N_exports = {};
30
+ __export(chunk_AXR7LS2N_exports, {
31
+ handleViewsIO: () => handleViewsIO,
32
+ z: () => z
32
33
  });
33
- module.exports = __toCommonJS(chunk_PEUHUCS4_exports);
34
+ module.exports = __toCommonJS(chunk_AXR7LS2N_exports);
34
35
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
35
36
  var import_internals = require("@prisma/internals");
36
37
  var import_path = __toESM(require("path"));
@@ -26,15 +26,15 @@ 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_EERZNF42_exports = {};
30
- __export(chunk_EERZNF42_exports, {
29
+ var chunk_BHJMJSM4_exports = {};
30
+ __export(chunk_BHJMJSM4_exports, {
31
31
  MigrateDeploy: () => MigrateDeploy
32
32
  });
33
- module.exports = __toCommonJS(chunk_EERZNF42_exports);
33
+ module.exports = __toCommonJS(chunk_BHJMJSM4_exports);
34
34
  var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
35
35
  var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
36
36
  var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
37
- var import_chunk_V3D2XB5I = require("./chunk-V3D2XB5I.js");
37
+ var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
38
38
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
39
39
  var import_debug = __toESM(require("@prisma/debug"));
40
40
  var import_internals = require("@prisma/internals");
@@ -83,6 +83,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
83
83
  if (args["--help"]) {
84
84
  return this.help();
85
85
  }
86
+ await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
86
87
  const schemaContext = await (0, import_internals.loadSchemaContext)({
87
88
  schemaPathFromArg: args["--schema"],
88
89
  schemaPathFromConfig: config.schema,
@@ -96,7 +97,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
96
97
  externalTables: config.tables?.external ?? [],
97
98
  externalEnums: config.enums?.external ?? []
98
99
  };
99
- const migrate = await import_chunk_V3D2XB5I.Migrate.setup({
100
+ const migrate = await import_chunk_D6LYHB65.Migrate.setup({
100
101
  schemaEngineConfig: config,
101
102
  migrationsDirPath,
102
103
  schemaContext,
@@ -148,7 +149,7 @@ ${(0, import_chunk_KRQEFTDT.printFilesFromMigrationIds)(
148
149
  "migration.sql": ""
149
150
  }
150
151
  )}
151
-
152
+
152
153
  ${(0, import_chunk_SKRR5WT4.green)("All migrations have been successfully applied.")}`;
153
154
  }
154
155
  }
@@ -16,12 +16,12 @@ 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_WF7UXKO5_exports = {};
20
- __export(chunk_WF7UXKO5_exports, {
19
+ var chunk_D4TRX77Y_exports = {};
20
+ __export(chunk_D4TRX77Y_exports, {
21
21
  DbSeed: () => DbSeed
22
22
  });
23
- module.exports = __toCommonJS(chunk_WF7UXKO5_exports);
24
- var import_chunk_L7EZFBB4 = require("./chunk-L7EZFBB4.js");
23
+ module.exports = __toCommonJS(chunk_D4TRX77Y_exports);
24
+ var import_chunk_PHXLQVPT = require("./chunk-PHXLQVPT.js");
25
25
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
26
26
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
27
27
  var import_internals = require("@prisma/internals");
@@ -213,10 +213,13 @@ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db seed -- --arg1 value1 --arg2 va
213
213
  if (args["--help"]) {
214
214
  return this.help();
215
215
  }
216
- const seedCommand = config.migrations?.seed;
216
+ await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
217
+ const seedCommandFromPrismaConfig = config.migrations?.seed;
218
+ const seedCommandFromPkgJson = await (0, import_chunk_PHXLQVPT.getSeedCommandFromPackageJson)(process.cwd());
219
+ const seedCommand = seedCommandFromPrismaConfig ?? seedCommandFromPkgJson;
217
220
  if (!seedCommand) return ``;
218
221
  const extraArgs = args._.join(" ");
219
- const successfulSeeding = await (0, import_chunk_L7EZFBB4.executeSeedCommand)({ commandFromConfig: seedCommand, extraArgs });
222
+ const successfulSeeding = await (0, import_chunk_PHXLQVPT.executeSeedCommand)({ commandFromConfig: seedCommand, extraArgs });
220
223
  if (successfulSeeding) {
221
224
  return `
222
225
  ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.`;
@@ -26,17 +26,17 @@ 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_V3D2XB5I_exports = {};
30
- __export(chunk_V3D2XB5I_exports, {
29
+ var chunk_D6LYHB65_exports = {};
30
+ __export(chunk_D6LYHB65_exports, {
31
31
  Migrate: () => Migrate
32
32
  });
33
- module.exports = __toCommonJS(chunk_V3D2XB5I_exports);
34
- var import_chunk_JX2HIV7V = require("./chunk-JX2HIV7V.js");
33
+ module.exports = __toCommonJS(chunk_D6LYHB65_exports);
35
34
  var import_chunk_T64SUJ5L = require("./chunk-T64SUJ5L.js");
35
+ var import_chunk_VV4M6AN7 = require("./chunk-VV4M6AN7.js");
36
36
  var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
37
37
  var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
38
- var import_chunk_GH6IOZTT = require("./chunk-GH6IOZTT.js");
39
- var import_chunk_SYWL5XS4 = require("./chunk-SYWL5XS4.js");
38
+ var import_chunk_22YP3RXZ = require("./chunk-22YP3RXZ.js");
39
+ var import_chunk_GSX25HRL = require("./chunk-GSX25HRL.js");
40
40
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
41
41
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
42
42
  var import_client_generator_registry = require("@prisma/client-generator-registry");
@@ -46,11 +46,9 @@ var import_node_process = __toESM(require("node:process"));
46
46
  var import_node_process2 = __toESM(require("node:process"));
47
47
  var base_exports = {};
48
48
  (0, import_chunk_2ESYSVXG.__export)(base_exports, {
49
- ConEmu: () => ConEmu,
50
49
  beep: () => beep,
51
50
  clearScreen: () => clearScreen,
52
51
  clearTerminal: () => clearTerminal,
53
- clearViewport: () => clearViewport,
54
52
  cursorBackward: () => cursorBackward,
55
53
  cursorDown: () => cursorDown,
56
54
  cursorForward: () => cursorForward,
@@ -78,8 +76,7 @@ var base_exports = {};
78
76
  image: () => image,
79
77
  link: () => link,
80
78
  scrollDown: () => scrollDown,
81
- scrollUp: () => scrollUp,
82
- setCwd: () => setCwd
79
+ scrollUp: () => scrollUp
83
80
  });
84
81
  var isBrowser = globalThis.window?.document !== void 0;
85
82
  var isNode = globalThis.process?.versions?.node !== void 0;
@@ -163,7 +160,6 @@ var eraseScreen = ESC + "2J";
163
160
  var scrollUp = ESC + "S";
164
161
  var scrollDown = ESC + "T";
165
162
  var clearScreen = "\x1Bc";
166
- var clearViewport = `${eraseScreen}${ESC}H`;
167
163
  var clearTerminal = isWindows2 ? `${eraseScreen}${ESC}0f` : `${eraseScreen}${ESC}3J${ESC}H`;
168
164
  var enterAlternativeScreen = ESC + "?1049h";
169
165
  var exitAlternativeScreen = ESC + "?1049l";
@@ -193,8 +189,7 @@ var image = (data, options = {}) => {
193
189
  if (options.preserveAspectRatio === false) {
194
190
  returnValue += ";preserveAspectRatio=0";
195
191
  }
196
- const imageBuffer = Buffer.from(data);
197
- return returnValue + `;size=${imageBuffer.byteLength}:` + imageBuffer.toString("base64") + BEL;
192
+ return returnValue + ":" + Buffer.from(data).toString("base64") + BEL;
198
193
  };
199
194
  var iTerm = {
200
195
  setCwd: (cwd = cwdFunction()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
@@ -215,10 +210,6 @@ var iTerm = {
215
210
  return returnValue + BEL;
216
211
  }
217
212
  };
218
- var ConEmu = {
219
- setCwd: (cwd = cwdFunction()) => `${OSC}9;9;${cwd}${BEL}`
220
- };
221
- var setCwd = (cwd = cwdFunction()) => iTerm.setCwd(cwd) + ConEmu.setCwd(cwd);
222
213
  var ANSI_BACKGROUND_OFFSET = 10;
223
214
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
224
215
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -317,7 +308,7 @@ function assembleStyles() {
317
308
  styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
318
309
  Object.defineProperties(styles, {
319
310
  rgbToAnsi256: {
320
- value(red, green, blue) {
311
+ value: (red, green, blue) => {
321
312
  if (red === green && green === blue) {
322
313
  if (red < 8) {
323
314
  return 16;
@@ -332,7 +323,7 @@ function assembleStyles() {
332
323
  enumerable: false
333
324
  },
334
325
  hexToRgb: {
335
- value(hex) {
326
+ value: (hex) => {
336
327
  const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
337
328
  if (!matches) {
338
329
  return [0, 0, 0];
@@ -357,7 +348,7 @@ function assembleStyles() {
357
348
  enumerable: false
358
349
  },
359
350
  ansi256ToAnsi: {
360
- value(code) {
351
+ value: (code) => {
361
352
  if (code < 8) {
362
353
  return 30 + code;
363
354
  }
@@ -415,14 +406,14 @@ var ANSI_SGR_TERMINATOR = "m";
415
406
  var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
416
407
  var wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
417
408
  var wrapAnsiHyperlink = (url) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
418
- var wordLengths = (string) => string.split(" ").map((character) => (0, import_chunk_JX2HIV7V.stringWidth)(character));
409
+ var wordLengths = (string) => string.split(" ").map((character) => (0, import_chunk_VV4M6AN7.stringWidth)(character));
419
410
  var wrapWord = (rows, word, columns) => {
420
411
  const characters = [...word];
421
412
  let isInsideEscape = false;
422
413
  let isInsideLinkEscape = false;
423
- let visible = (0, import_chunk_JX2HIV7V.stringWidth)((0, import_chunk_JX2HIV7V.stripAnsi)(rows.at(-1)));
414
+ let visible = (0, import_chunk_VV4M6AN7.stringWidth)((0, import_chunk_VV4M6AN7.stripAnsi)(rows.at(-1)));
424
415
  for (const [index, character] of characters.entries()) {
425
- const characterLength = (0, import_chunk_JX2HIV7V.stringWidth)(character);
416
+ const characterLength = (0, import_chunk_VV4M6AN7.stringWidth)(character);
426
417
  if (visible + characterLength <= columns) {
427
418
  rows[rows.length - 1] += character;
428
419
  } else {
@@ -459,7 +450,7 @@ var stringVisibleTrimSpacesRight = (string) => {
459
450
  const words = string.split(" ");
460
451
  let last = words.length;
461
452
  while (last > 0) {
462
- if ((0, import_chunk_JX2HIV7V.stringWidth)(words[last - 1]) > 0) {
453
+ if ((0, import_chunk_VV4M6AN7.stringWidth)(words[last - 1]) > 0) {
463
454
  break;
464
455
  }
465
456
  last--;
@@ -482,7 +473,7 @@ var exec = (string, columns, options = {}) => {
482
473
  if (options.trim !== false) {
483
474
  rows[rows.length - 1] = rows.at(-1).trimStart();
484
475
  }
485
- let rowLength = (0, import_chunk_JX2HIV7V.stringWidth)(rows.at(-1));
476
+ let rowLength = (0, import_chunk_VV4M6AN7.stringWidth)(rows.at(-1));
486
477
  if (index !== 0) {
487
478
  if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
488
479
  rows.push("");
@@ -560,12 +551,11 @@ function isFullwidthCodePoint(codePoint) {
560
551
  if (!Number.isInteger(codePoint)) {
561
552
  return false;
562
553
  }
563
- return (0, import_chunk_JX2HIV7V.isFullWidth)(codePoint) || (0, import_chunk_JX2HIV7V.isWide)(codePoint);
554
+ return (0, import_chunk_VV4M6AN7.eastAsianWidth)(codePoint) === 2;
564
555
  }
565
556
  var ESCAPES2 = /* @__PURE__ */ new Set([27, 155]);
566
557
  var CODE_POINT_0 = "0".codePointAt(0);
567
558
  var CODE_POINT_9 = "9".codePointAt(0);
568
- var MAX_ANSI_SEQUENCE_LENGTH = 19;
569
559
  var endCodesSet = /* @__PURE__ */ new Set();
570
560
  var endCodesMap = /* @__PURE__ */ new Map();
571
561
  for (const [start, end] of ansi_styles_default.codes) {
@@ -599,7 +589,7 @@ function findNumberIndex(string) {
599
589
  return -1;
600
590
  }
601
591
  function parseAnsiCode(string, offset) {
602
- string = string.slice(offset, offset + MAX_ANSI_SEQUENCE_LENGTH);
592
+ string = string.slice(offset, offset + 19);
603
593
  const startIndex = findNumberIndex(string);
604
594
  if (startIndex !== -1) {
605
595
  let endIndex = string.indexOf("m", startIndex);
@@ -627,15 +617,15 @@ function tokenize(string, endCharacter = Number.POSITIVE_INFINITY) {
627
617
  continue;
628
618
  }
629
619
  }
630
- const isFullWidth2 = isFullwidthCodePoint(codePoint);
620
+ const isFullWidth = isFullwidthCodePoint(codePoint);
631
621
  const character = String.fromCodePoint(codePoint);
632
622
  returnValue.push({
633
623
  type: "character",
634
624
  value: character,
635
- isFullWidth: isFullWidth2
625
+ isFullWidth
636
626
  });
637
627
  index += character.length;
638
- visibleCount += isFullWidth2 ? 2 : character.length;
628
+ visibleCount += isFullWidth ? 2 : character.length;
639
629
  if (visibleCount >= endCharacter) {
640
630
  break;
641
631
  }
@@ -697,7 +687,7 @@ var fitToTerminalHeight = (stream, text) => {
697
687
  const terminalHeight = stream.rows ?? defaultTerminalHeight;
698
688
  const lines = text.split("\n");
699
689
  const toRemove = Math.max(0, lines.length - terminalHeight);
700
- return toRemove ? sliceAnsi(text, (0, import_chunk_JX2HIV7V.stripAnsi)(lines.slice(0, toRemove).join("\n")).length + 1) : text;
690
+ return toRemove ? sliceAnsi(text, (0, import_chunk_VV4M6AN7.stripAnsi)(lines.slice(0, toRemove).join("\n")).length + 1) : text;
701
691
  };
702
692
  function createLogUpdate(stream, { showCursor = false } = {}) {
703
693
  let previousLineCount = 0;
@@ -710,7 +700,7 @@ function createLogUpdate(stream, { showCursor = false } = {}) {
710
700
  };
711
701
  const render = (...arguments_) => {
712
702
  if (!showCursor) {
713
- import_chunk_JX2HIV7V.cli_cursor_default.hide();
703
+ import_chunk_VV4M6AN7.cli_cursor_default.hide();
714
704
  }
715
705
  let output = fitToTerminalHeight(stream, arguments_.join(" ") + "\n");
716
706
  const width = getWidth(stream);
@@ -730,7 +720,7 @@ function createLogUpdate(stream, { showCursor = false } = {}) {
730
720
  render.done = () => {
731
721
  reset();
732
722
  if (!showCursor) {
733
- import_chunk_JX2HIV7V.cli_cursor_default.show();
723
+ import_chunk_VV4M6AN7.cli_cursor_default.show();
734
724
  }
735
725
  };
736
726
  return render;
@@ -756,10 +746,10 @@ var Migrate = class _Migrate {
756
746
  if (schemaEngineConfig?.engine === "js") {
757
747
  const adapter = await schemaEngineConfig.adapter();
758
748
  (0, import_chunk_T64SUJ5L.warnDatasourceDriverAdapter)(schemaContext);
759
- return await import_chunk_GH6IOZTT.SchemaEngineWasm.setup({ adapter, schemaContext, ...rest });
749
+ return await import_chunk_22YP3RXZ.SchemaEngineWasm.setup({ adapter, schemaContext, ...rest });
760
750
  }
761
751
  const datasource = schemaEngineConfig?.engine === "classic" ? schemaEngineConfig.datasource : void 0;
762
- return await import_chunk_SYWL5XS4.SchemaEngineCLI.setup({ datasource, schemaContext, ...rest });
752
+ return await import_chunk_GSX25HRL.SchemaEngineCLI.setup({ datasource, schemaContext, ...rest });
763
753
  })();
764
754
  return new _Migrate({ engine: schemaEngine, schemaContext, ...rest });
765
755
  }
@@ -884,8 +874,9 @@ var Migrate = class _Migrate {
884
874
  unexecutable
885
875
  };
886
876
  }
887
- async tryToRunGenerate() {
877
+ async tryToRunGenerate(datasourceInfo) {
888
878
  if (!this.schemaContext) throw new Error("this.schemaContext is undefined");
879
+ const skipEngines = (0, import_internals.isPrismaPostgres)(datasourceInfo.url);
889
880
  const message = [];
890
881
  process.stdout.write("\n");
891
882
  log_update_default(`Running generate... ${(0, import_chunk_SKRR5WT4.dim)("(Use --skip-generate to skip the generators)")}`);
@@ -893,6 +884,7 @@ var Migrate = class _Migrate {
893
884
  schemaContext: this.schemaContext,
894
885
  printDownloadProgress: true,
895
886
  version: import_engines_version.enginesVersion,
887
+ noEngine: skipEngines,
896
888
  registry: import_client_generator_registry.defaultRegistry.toInternal()
897
889
  });
898
890
  for (const generator of generators) {
@@ -26,11 +26,11 @@ 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_BP3VX5NQ_exports = {};
30
- __export(chunk_BP3VX5NQ_exports, {
29
+ var chunk_F2XCBEZ4_exports = {};
30
+ __export(chunk_F2XCBEZ4_exports, {
31
31
  MigrateDev: () => MigrateDev
32
32
  });
33
- module.exports = __toCommonJS(chunk_BP3VX5NQ_exports);
33
+ module.exports = __toCommonJS(chunk_F2XCBEZ4_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");
@@ -38,8 +38,8 @@ var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
38
38
  var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
39
39
  var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
40
40
  var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
41
- var import_chunk_L7EZFBB4 = require("./chunk-L7EZFBB4.js");
42
- var import_chunk_V3D2XB5I = require("./chunk-V3D2XB5I.js");
41
+ var import_chunk_PHXLQVPT = require("./chunk-PHXLQVPT.js");
42
+ var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
43
43
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
44
44
  var import_node_path = __toESM(require("node:path"));
45
45
  var import_debug = __toESM(require("@prisma/debug"));
@@ -52,7 +52,7 @@ var MigrateDev = class _MigrateDev {
52
52
  }
53
53
  static help = (0, import_internals.format)(`
54
54
  ${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
-
55
+
56
56
  ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
57
57
 
58
58
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev [options]
@@ -100,6 +100,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
100
100
  if (args["--help"]) {
101
101
  return this.help();
102
102
  }
103
+ await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
103
104
  const schemaContext = await (0, import_internals.loadSchemaContext)({
104
105
  schemaPathFromArg: args["--schema"],
105
106
  schemaPathFromConfig: config.schema,
@@ -123,7 +124,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
123
124
  externalTables: config.tables?.external ?? [],
124
125
  externalEnums: config.enums?.external ?? []
125
126
  };
126
- const migrate = await import_chunk_V3D2XB5I.Migrate.setup({
127
+ const migrate = await import_chunk_D6LYHB65.Migrate.setup({
127
128
  schemaEngineConfig: config,
128
129
  migrationsDirPath,
129
130
  schemaContext,
@@ -280,15 +281,17 @@ ${(0, import_chunk_SKRR5WT4.green)("Your database is now in sync with your schem
280
281
  );
281
282
  }
282
283
  if (!process.env.PRISMA_MIGRATE_SKIP_GENERATE && !args["--skip-generate"]) {
283
- await migrate.tryToRunGenerate();
284
+ await migrate.tryToRunGenerate(datasourceInfo);
284
285
  process.stdout.write("\n");
285
286
  }
286
287
  if (wasDbCreated && !process.env.PRISMA_MIGRATE_SKIP_SEED && !args["--skip-seed"]) {
287
288
  try {
288
- const seedCommand = config.migrations?.seed;
289
+ const seedCommandFromPrismaConfig = config.migrations?.seed;
290
+ const seedCommandFromPkgJson = await (0, import_chunk_PHXLQVPT.getSeedCommandFromPackageJson)(process.cwd());
291
+ const seedCommand = seedCommandFromPrismaConfig ?? seedCommandFromPkgJson;
289
292
  if (seedCommand) {
290
293
  process.stdout.write("\n");
291
- const successfulSeeding = await (0, import_chunk_L7EZFBB4.executeSeedCommand)({ commandFromConfig: seedCommand });
294
+ const successfulSeeding = await (0, import_chunk_PHXLQVPT.executeSeedCommand)({ commandFromConfig: seedCommand });
292
295
  if (successfulSeeding) {
293
296
  process.stdout.write(`
294
297
  ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.
@@ -26,13 +26,13 @@ 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_SYWL5XS4_exports = {};
30
- __export(chunk_SYWL5XS4_exports, {
29
+ var chunk_GSX25HRL_exports = {};
30
+ __export(chunk_GSX25HRL_exports, {
31
31
  EngineError: () => EngineError,
32
32
  SchemaEngineCLI: () => SchemaEngineCLI
33
33
  });
34
- module.exports = __toCommonJS(chunk_SYWL5XS4_exports);
35
- var import_chunk_PEUHUCS4 = require("./chunk-PEUHUCS4.js");
34
+ module.exports = __toCommonJS(chunk_GSX25HRL_exports);
35
+ var import_chunk_AXR7LS2N = require("./chunk-AXR7LS2N.js");
36
36
  var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
37
37
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
38
38
  var import_debug = __toESM(require("@prisma/debug"));
@@ -188,7 +188,7 @@ var SchemaEngineCLI = class _SchemaEngineCLI {
188
188
  );
189
189
  const { views } = introspectResult;
190
190
  if (views) {
191
- await (0, import_chunk_PEUHUCS4.handleViewsIO)({ views, viewsDirectoryPath });
191
+ await (0, import_chunk_AXR7LS2N.handleViewsIO)({ views, viewsDirectoryPath });
192
192
  }
193
193
  return introspectResult;
194
194
  } finally {
@@ -26,18 +26,18 @@ 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_SFX5KEGP_exports = {};
30
- __export(chunk_SFX5KEGP_exports, {
29
+ var chunk_J33EXHZB_exports = {};
30
+ __export(chunk_J33EXHZB_exports, {
31
31
  MigrateReset: () => MigrateReset
32
32
  });
33
- module.exports = __toCommonJS(chunk_SFX5KEGP_exports);
33
+ module.exports = __toCommonJS(chunk_J33EXHZB_exports);
34
34
  var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
35
35
  var import_chunk_FBDQVK4W = require("./chunk-FBDQVK4W.js");
36
36
  var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
37
37
  var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
38
38
  var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
39
- var import_chunk_L7EZFBB4 = require("./chunk-L7EZFBB4.js");
40
- var import_chunk_V3D2XB5I = require("./chunk-V3D2XB5I.js");
39
+ var import_chunk_PHXLQVPT = require("./chunk-PHXLQVPT.js");
40
+ var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
41
41
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
42
42
  var import_internals = require("@prisma/internals");
43
43
  var import_prompts = __toESM(require("prompts"));
@@ -90,6 +90,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
90
90
  if (args["--help"]) {
91
91
  return this.help();
92
92
  }
93
+ await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
93
94
  const schemaContext = await (0, import_internals.loadSchemaContext)({
94
95
  schemaPathFromArg: args["--schema"],
95
96
  schemaPathFromConfig: config.schema,
@@ -127,7 +128,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
127
128
  externalTables: config.tables?.external ?? [],
128
129
  externalEnums: config.enums?.external ?? []
129
130
  };
130
- const migrate = await import_chunk_V3D2XB5I.Migrate.setup({
131
+ const migrate = await import_chunk_D6LYHB65.Migrate.setup({
131
132
  schemaEngineConfig: config,
132
133
  migrationsDirPath,
133
134
  schemaContext,
@@ -159,13 +160,15 @@ ${(0, import_chunk_KRQEFTDT.printFilesFromMigrationIds)("migrations", migrationI
159
160
  );
160
161
  }
161
162
  if (!process.env.PRISMA_MIGRATE_SKIP_GENERATE && !args["--skip-generate"]) {
162
- await migrate.tryToRunGenerate();
163
+ await migrate.tryToRunGenerate(datasourceInfo);
163
164
  }
164
165
  if (!process.env.PRISMA_MIGRATE_SKIP_SEED && !args["--skip-seed"]) {
165
- const seedCommand = config.migrations?.seed;
166
+ const seedCommandFromPrismaConfig = config.migrations?.seed;
167
+ const seedCommandFromPkgJson = await (0, import_chunk_PHXLQVPT.getSeedCommandFromPackageJson)(process.cwd());
168
+ const seedCommand = seedCommandFromPrismaConfig ?? seedCommandFromPkgJson;
166
169
  if (seedCommand) {
167
170
  process.stdout.write("\n");
168
- const successfulSeeding = await (0, import_chunk_L7EZFBB4.executeSeedCommand)({ commandFromConfig: seedCommand });
171
+ const successfulSeeding = await (0, import_chunk_PHXLQVPT.executeSeedCommand)({ commandFromConfig: seedCommand });
169
172
  if (successfulSeeding) {
170
173
  process.stdout.write(`
171
174
  ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.