@prisma/migrate 6.6.0-dev.9 → 6.6.0-dev.91

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 (150) hide show
  1. package/dist/CLI.js +3 -3
  2. package/dist/Migrate.js +8 -6
  3. package/dist/SchemaEngine.js +5 -5
  4. package/dist/bin.js +47 -46
  5. package/dist/chunk-23DZXSTI.js +62 -0
  6. package/dist/{chunk-WWAWV7DQ.js → chunk-2ESYSVXG.js} +3 -27
  7. package/dist/{chunk-LKTTJWFT.js → chunk-2R6DII47.js} +5 -5
  8. package/dist/chunk-33LPBNDX.js +1399 -0
  9. package/dist/{chunk-V3ZMNXZC.js → chunk-5LKIRKDL.js} +307 -382
  10. package/dist/{chunk-IR55GBON.js → chunk-5LTDMS3H.js} +18 -18
  11. package/dist/{chunk-LOGAFLCN.js → chunk-5R44VVVX.js} +29 -29
  12. package/dist/{chunk-Q3ZLC44N.js → chunk-63X7FE2R.js} +57 -66
  13. package/dist/{chunk-DJMFXNR4.js → chunk-74LUB4XX.js} +56 -57
  14. package/dist/{chunk-N4XTKFY6.js → chunk-7RM467G7.js} +39 -38
  15. package/dist/{chunk-RP2N6UXA.js → chunk-AI6DH66U.js} +6 -6
  16. package/dist/{chunk-A6PMXMMT.js → chunk-AUGZZ6RT.js} +105 -13
  17. package/dist/{chunk-G2XUUMKH.js → chunk-B4SUSDC2.js} +31 -39
  18. package/dist/{chunk-ZOEKRXDP.js → chunk-D2DGSPW6.js} +29 -55
  19. package/dist/{chunk-W2SZNLK4.js → chunk-EJG7GKM7.js} +37 -39
  20. package/dist/{chunk-5PSO7BDO.js → chunk-EJUXYFV3.js} +15 -15
  21. package/dist/{chunk-HCBZB4XC.js → chunk-FFPSJTA6.js} +53 -52
  22. package/dist/{chunk-N3KYWSX2.js → chunk-FZGPSDP7.js} +55 -49
  23. package/dist/{chunk-LKOMAN5A.js → chunk-HQ7VGVZ5.js} +371 -530
  24. package/dist/{chunk-MCWCB2AX.js → chunk-IINN7QUV.js} +170 -643
  25. package/dist/{chunk-QYHXOHG3.js → chunk-IQB54PSS.js} +370 -529
  26. package/dist/{chunk-255BRND3.js → chunk-KRQEFTDT.js} +6 -6
  27. package/dist/{chunk-VVKOFN3Y.js → chunk-LLO7YF56.js} +44 -46
  28. package/dist/{chunk-VZ23KD5C.js → chunk-NGQA5JTN.js} +8 -10
  29. package/dist/{chunk-MKK3GSDF.js → chunk-NIKXBMZL.js} +5 -5
  30. package/dist/{chunk-GG54LOYV.js → chunk-O6RQXRWU.js} +45 -44
  31. package/dist/{chunk-MATFO4ZW.js → chunk-OEWQACEH.js} +38 -39
  32. package/dist/{chunk-EGPJABTW.js → chunk-QVMYNWAN.js} +257 -103
  33. package/dist/{chunk-V5TUSOJX.js → chunk-SQKGZVG3.js} +45 -45
  34. package/dist/{chunk-CQZFVAXC.js → chunk-TN7JMNXD.js} +42 -41
  35. package/dist/chunk-URKH6SE2.js +479 -0
  36. package/dist/chunk-V6PVGSDJ.js +76 -0
  37. package/dist/{chunk-DLLXDCI2.js → chunk-VAJ4VX67.js} +5 -6
  38. package/dist/{chunk-OCQGHQED.js → chunk-YBX7R3MT.js} +12 -12
  39. package/dist/{chunk-KS7IEA6Z.js → chunk-YGBJA7QJ.js} +50 -52
  40. package/dist/{chunk-WI2A2TQE.js → chunk-ZJ4IDCRR.js} +90 -91
  41. package/dist/chunk-ZLHWX5PJ.js +883 -0
  42. package/dist/commands/DbCommand.js +3 -3
  43. package/dist/commands/DbDrop.js +4 -5
  44. package/dist/commands/DbExecute.js +9 -7
  45. package/dist/commands/DbPull.js +11 -10
  46. package/dist/commands/DbPush.js +10 -9
  47. package/dist/commands/DbSeed.js +4 -5
  48. package/dist/commands/MigrateCommand.js +3 -3
  49. package/dist/commands/MigrateDeploy.js +12 -11
  50. package/dist/commands/MigrateDev.js +14 -13
  51. package/dist/commands/MigrateDiff.js +12 -10
  52. package/dist/commands/MigrateReset.js +13 -12
  53. package/dist/commands/MigrateResolve.js +10 -9
  54. package/dist/commands/MigrateStatus.js +10 -9
  55. package/dist/index.js +50 -51
  56. package/dist/internals/src/Generator.d.ts +23 -5
  57. package/dist/internals/src/cli/checkUnsupportedDataProxy.d.ts +12 -17
  58. package/dist/internals/src/cli/directoryConfig.d.ts +7 -0
  59. package/dist/internals/src/cli/getSchema.d.ts +3 -28
  60. package/dist/internals/src/cli/hashes.d.ts +1 -2
  61. package/dist/internals/src/cli/schemaContext.d.ts +59 -0
  62. package/dist/internals/src/client/getClientEngineType.d.ts +1 -1
  63. package/dist/internals/src/convertCredentials.d.ts +1 -1
  64. package/dist/internals/src/engine-commands/getConfig.d.ts +1 -5
  65. package/dist/internals/src/engine-commands/getDmmf.d.ts +3 -6
  66. package/dist/internals/src/engine-commands/lintSchema.d.ts +1 -1
  67. package/dist/internals/src/errorReporting.d.ts +0 -1
  68. package/dist/internals/src/get-generators/getGenerators.d.ts +22 -9
  69. package/dist/internals/src/get-generators/utils/binaryTypeToEngineType.d.ts +1 -1
  70. package/dist/internals/src/get-generators/utils/engineTypeToBinaryType.d.ts +1 -1
  71. package/dist/internals/src/get-generators/utils/fixBinaryTargets.d.ts +1 -1
  72. package/dist/internals/src/get-generators/utils/getBinaryPathsByVersion.d.ts +1 -1
  73. package/dist/internals/src/get-generators/utils/getEngineVersionForGenerator.d.ts +1 -1
  74. package/dist/internals/src/get-generators/utils/printGeneratorConfig.d.ts +1 -1
  75. package/dist/internals/src/index.d.ts +7 -7
  76. package/dist/internals/src/migrateTypes.d.ts +63 -0
  77. package/dist/internals/src/panic.d.ts +1 -4
  78. package/dist/internals/src/resolvePkg.d.ts +7 -0
  79. package/dist/internals/src/types.d.ts +1 -1
  80. package/dist/internals/src/utils/extractPreviewFeatures.d.ts +2 -2
  81. package/dist/internals/src/utils/getEnvPaths.d.ts +1 -1
  82. package/dist/internals/src/utils/parseEnvValue.d.ts +1 -1
  83. package/dist/internals/src/utils/schemaFileInput.d.ts +0 -4
  84. package/dist/internals/src/utils/toSchemasContainer.d.ts +2 -3
  85. package/dist/migrate/src/Migrate.d.ts +7 -5
  86. package/dist/migrate/src/SchemaEngine.d.ts +5 -9
  87. package/dist/migrate/src/index.d.ts +0 -1
  88. package/dist/migrate/src/types.d.ts +14 -10
  89. package/dist/migrate/src/utils/createMigration.d.ts +21 -0
  90. package/dist/migrate/src/utils/ensureDatabaseExists.d.ts +4 -6
  91. package/dist/migrate/src/utils/introspectSql.d.ts +3 -2
  92. package/dist/migrate/src/utils/listMigrations.d.ts +9 -0
  93. package/dist/migrate/src/utils/printDatasources.d.ts +1 -1
  94. package/dist/migrate/src/utils/seed.d.ts +0 -2
  95. package/dist/migrate/src/views/handleViewsIO.d.ts +2 -2
  96. package/dist/{multipart-parser-54WEFGGN-NLZG56KM.js → multipart-parser-ASKQAOL4-WZ47HU6G.js} +92 -125
  97. package/dist/{multipart-parser-NDLECNMN.js → multipart-parser-QCI3Y5IB.js} +66 -68
  98. package/dist/types.js +1 -1
  99. package/dist/{typescript-WN4QH2CP.js → typescript-2LKASCMC.js} +33 -33
  100. package/dist/{typescript-AILDXN3I.js → typescript-H3AVJ6KX.js} +32 -32
  101. package/dist/utils/byline.js +1 -1
  102. package/dist/utils/captureStdout.js +3 -3
  103. package/dist/utils/countModelsAndTypes.js +1 -1
  104. package/dist/utils/{getSchemaPathAndPrint.js → createMigration.js} +8 -8
  105. package/dist/utils/customColors.js +1 -1
  106. package/dist/utils/ensureDatabaseExists.js +7 -7
  107. package/dist/utils/errors.js +1 -1
  108. package/dist/utils/flagErrors.js +1 -1
  109. package/dist/utils/getDatabaseVersionSafe.js +5 -5
  110. package/dist/utils/handleEvaluateDataloss.js +1 -1
  111. package/dist/utils/introspectSql.js +5 -5
  112. package/dist/utils/isSchemaEmpty.js +1 -1
  113. package/dist/utils/listMigrations.js +25 -0
  114. package/dist/utils/now.js +1 -1
  115. package/dist/utils/printDatasource.js +1 -1
  116. package/dist/utils/printDatasources.js +5 -5
  117. package/dist/utils/printFiles.js +5 -5
  118. package/dist/utils/printIntrospectedSchema.js +1 -1
  119. package/dist/utils/printMigrationId.js +1 -1
  120. package/dist/utils/promptForMigrationName.js +3 -3
  121. package/dist/utils/removeSchemaFiles.js +1 -1
  122. package/dist/utils/replaceOrAddDatasource.js +1 -1
  123. package/dist/utils/replaceOrAddDatasource.test.js +1 -1
  124. package/dist/utils/saveSchemaFiles.js +1 -1
  125. package/dist/utils/seed.js +4 -7
  126. package/dist/utils/setupCockroach.js +3 -3
  127. package/dist/utils/setupMSSQL.js +1478 -707
  128. package/dist/utils/setupMongo.js +553 -552
  129. package/dist/utils/setupMysql.js +508 -563
  130. package/dist/utils/setupPostgres.js +3 -3
  131. package/dist/utils/spinner.js +4 -3
  132. package/dist/utils/test-handlePanic.js +1 -30
  133. package/dist/utils/unixSocket.js +1 -1
  134. package/dist/views/handleViewsIO.js +3 -3
  135. package/package.json +11 -11
  136. package/dist/chunk-GKDFIHM2.js +0 -45
  137. package/dist/chunk-J46BJQHT.js +0 -268
  138. package/dist/chunk-KOF4LGTS.js +0 -1817
  139. package/dist/chunk-YYPMC5FN.js +0 -1407
  140. package/dist/internals/src/get-generators/generatorResolvers/generatorResolvers.d.ts +0 -15
  141. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/findPrismaClientDir.d.ts +0 -6
  142. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd.d.ts +0 -9
  143. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/runPackageCmd.d.ts +0 -8
  144. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.d.ts +0 -6
  145. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/isYarnUsed.d.ts +0 -1
  146. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/resolve.d.ts +0 -20
  147. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.d.ts +0 -7
  148. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.d.ts +0 -20
  149. package/dist/internals/src/get-generators/utils/check-feature-flags/checkFeatureFlags.d.ts +0 -8
  150. package/dist/migrate/src/utils/getSchemaPathAndPrint.d.ts +0 -10
@@ -0,0 +1,883 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var chunk_ZLHWX5PJ_exports = {};
30
+ __export(chunk_ZLHWX5PJ_exports, {
31
+ Migrate: () => Migrate
32
+ });
33
+ module.exports = __toCommonJS(chunk_ZLHWX5PJ_exports);
34
+ var import_chunk_V6PVGSDJ = require("./chunk-V6PVGSDJ.js");
35
+ var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
36
+ var import_chunk_URKH6SE2 = require("./chunk-URKH6SE2.js");
37
+ var import_chunk_D2DGSPW6 = require("./chunk-D2DGSPW6.js");
38
+ var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
39
+ var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
40
+ var import_client_generator_registry = require("@prisma/client-generator-registry");
41
+ var import_engines_version = require("@prisma/engines-version");
42
+ var import_internals = require("@prisma/internals");
43
+ var import_node_process = __toESM(require("node:process"));
44
+ var import_node_process2 = __toESM(require("node:process"));
45
+ var base_exports = {};
46
+ (0, import_chunk_2ESYSVXG.__export)(base_exports, {
47
+ beep: () => beep,
48
+ clearScreen: () => clearScreen,
49
+ clearTerminal: () => clearTerminal,
50
+ cursorBackward: () => cursorBackward,
51
+ cursorDown: () => cursorDown,
52
+ cursorForward: () => cursorForward,
53
+ cursorGetPosition: () => cursorGetPosition,
54
+ cursorHide: () => cursorHide,
55
+ cursorLeft: () => cursorLeft,
56
+ cursorMove: () => cursorMove,
57
+ cursorNextLine: () => cursorNextLine,
58
+ cursorPrevLine: () => cursorPrevLine,
59
+ cursorRestorePosition: () => cursorRestorePosition,
60
+ cursorSavePosition: () => cursorSavePosition,
61
+ cursorShow: () => cursorShow,
62
+ cursorTo: () => cursorTo,
63
+ cursorUp: () => cursorUp,
64
+ enterAlternativeScreen: () => enterAlternativeScreen,
65
+ eraseDown: () => eraseDown,
66
+ eraseEndLine: () => eraseEndLine,
67
+ eraseLine: () => eraseLine,
68
+ eraseLines: () => eraseLines,
69
+ eraseScreen: () => eraseScreen,
70
+ eraseStartLine: () => eraseStartLine,
71
+ eraseUp: () => eraseUp,
72
+ exitAlternativeScreen: () => exitAlternativeScreen,
73
+ iTerm: () => iTerm,
74
+ image: () => image,
75
+ link: () => link,
76
+ scrollDown: () => scrollDown,
77
+ scrollUp: () => scrollUp
78
+ });
79
+ var isBrowser = globalThis.window?.document !== void 0;
80
+ var isNode = globalThis.process?.versions?.node !== void 0;
81
+ var isBun = globalThis.process?.versions?.bun !== void 0;
82
+ var isDeno = globalThis.Deno?.version?.deno !== void 0;
83
+ var isElectron = globalThis.process?.versions?.electron !== void 0;
84
+ var isJsDom = globalThis.navigator?.userAgent?.includes("jsdom") === true;
85
+ var isWebWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
86
+ var isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== "undefined" && globalThis instanceof DedicatedWorkerGlobalScope;
87
+ var isSharedWorker = typeof SharedWorkerGlobalScope !== "undefined" && globalThis instanceof SharedWorkerGlobalScope;
88
+ var isServiceWorker = typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope;
89
+ var platform = globalThis.navigator?.userAgentData?.platform;
90
+ var isMacOs = platform === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform === "darwin";
91
+ var isWindows = platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform === "win32";
92
+ var isLinux = platform === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform === "linux";
93
+ var isIos = platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
94
+ var isAndroid = platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform === "android";
95
+ var ESC = "\x1B[";
96
+ var OSC = "\x1B]";
97
+ var BEL = "\x07";
98
+ var SEP = ";";
99
+ var isTerminalApp = !isBrowser && import_node_process2.default.env.TERM_PROGRAM === "Apple_Terminal";
100
+ var isWindows2 = !isBrowser && import_node_process2.default.platform === "win32";
101
+ var cwdFunction = isBrowser ? () => {
102
+ throw new Error("`process.cwd()` only works in Node.js, not the browser.");
103
+ } : import_node_process2.default.cwd;
104
+ var cursorTo = (x, y) => {
105
+ if (typeof x !== "number") {
106
+ throw new TypeError("The `x` argument is required");
107
+ }
108
+ if (typeof y !== "number") {
109
+ return ESC + (x + 1) + "G";
110
+ }
111
+ return ESC + (y + 1) + SEP + (x + 1) + "H";
112
+ };
113
+ var cursorMove = (x, y) => {
114
+ if (typeof x !== "number") {
115
+ throw new TypeError("The `x` argument is required");
116
+ }
117
+ let returnValue = "";
118
+ if (x < 0) {
119
+ returnValue += ESC + -x + "D";
120
+ } else if (x > 0) {
121
+ returnValue += ESC + x + "C";
122
+ }
123
+ if (y < 0) {
124
+ returnValue += ESC + -y + "A";
125
+ } else if (y > 0) {
126
+ returnValue += ESC + y + "B";
127
+ }
128
+ return returnValue;
129
+ };
130
+ var cursorUp = (count = 1) => ESC + count + "A";
131
+ var cursorDown = (count = 1) => ESC + count + "B";
132
+ var cursorForward = (count = 1) => ESC + count + "C";
133
+ var cursorBackward = (count = 1) => ESC + count + "D";
134
+ var cursorLeft = ESC + "G";
135
+ var cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
136
+ var cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
137
+ var cursorGetPosition = ESC + "6n";
138
+ var cursorNextLine = ESC + "E";
139
+ var cursorPrevLine = ESC + "F";
140
+ var cursorHide = ESC + "?25l";
141
+ var cursorShow = ESC + "?25h";
142
+ var eraseLines = (count) => {
143
+ let clear = "";
144
+ for (let i = 0; i < count; i++) {
145
+ clear += eraseLine + (i < count - 1 ? cursorUp() : "");
146
+ }
147
+ if (count) {
148
+ clear += cursorLeft;
149
+ }
150
+ return clear;
151
+ };
152
+ var eraseEndLine = ESC + "K";
153
+ var eraseStartLine = ESC + "1K";
154
+ var eraseLine = ESC + "2K";
155
+ var eraseDown = ESC + "J";
156
+ var eraseUp = ESC + "1J";
157
+ var eraseScreen = ESC + "2J";
158
+ var scrollUp = ESC + "S";
159
+ var scrollDown = ESC + "T";
160
+ var clearScreen = "\x1Bc";
161
+ var clearTerminal = isWindows2 ? `${eraseScreen}${ESC}0f` : `${eraseScreen}${ESC}3J${ESC}H`;
162
+ var enterAlternativeScreen = ESC + "?1049h";
163
+ var exitAlternativeScreen = ESC + "?1049l";
164
+ var beep = BEL;
165
+ var link = (text, url) => [
166
+ OSC,
167
+ "8",
168
+ SEP,
169
+ SEP,
170
+ url,
171
+ BEL,
172
+ text,
173
+ OSC,
174
+ "8",
175
+ SEP,
176
+ SEP,
177
+ BEL
178
+ ].join("");
179
+ var image = (data, options = {}) => {
180
+ let returnValue = `${OSC}1337;File=inline=1`;
181
+ if (options.width) {
182
+ returnValue += `;width=${options.width}`;
183
+ }
184
+ if (options.height) {
185
+ returnValue += `;height=${options.height}`;
186
+ }
187
+ if (options.preserveAspectRatio === false) {
188
+ returnValue += ";preserveAspectRatio=0";
189
+ }
190
+ return returnValue + ":" + Buffer.from(data).toString("base64") + BEL;
191
+ };
192
+ var iTerm = {
193
+ setCwd: (cwd = cwdFunction()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
194
+ annotation(message, options = {}) {
195
+ let returnValue = `${OSC}1337;`;
196
+ const hasX = options.x !== void 0;
197
+ const hasY = options.y !== void 0;
198
+ if ((hasX || hasY) && !(hasX && hasY && options.length !== void 0)) {
199
+ throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
200
+ }
201
+ message = message.replaceAll("|", "");
202
+ returnValue += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
203
+ if (options.length > 0) {
204
+ returnValue += (hasX ? [message, options.length, options.x, options.y] : [options.length, message]).join("|");
205
+ } else {
206
+ returnValue += message;
207
+ }
208
+ return returnValue + BEL;
209
+ }
210
+ };
211
+ var ANSI_BACKGROUND_OFFSET = 10;
212
+ var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
213
+ var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
214
+ var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
215
+ var styles = {
216
+ modifier: {
217
+ reset: [0, 0],
218
+ // 21 isn't widely supported and 22 does the same thing
219
+ bold: [1, 22],
220
+ dim: [2, 22],
221
+ italic: [3, 23],
222
+ underline: [4, 24],
223
+ overline: [53, 55],
224
+ inverse: [7, 27],
225
+ hidden: [8, 28],
226
+ strikethrough: [9, 29]
227
+ },
228
+ color: {
229
+ black: [30, 39],
230
+ red: [31, 39],
231
+ green: [32, 39],
232
+ yellow: [33, 39],
233
+ blue: [34, 39],
234
+ magenta: [35, 39],
235
+ cyan: [36, 39],
236
+ white: [37, 39],
237
+ // Bright color
238
+ blackBright: [90, 39],
239
+ gray: [90, 39],
240
+ // Alias of `blackBright`
241
+ grey: [90, 39],
242
+ // Alias of `blackBright`
243
+ redBright: [91, 39],
244
+ greenBright: [92, 39],
245
+ yellowBright: [93, 39],
246
+ blueBright: [94, 39],
247
+ magentaBright: [95, 39],
248
+ cyanBright: [96, 39],
249
+ whiteBright: [97, 39]
250
+ },
251
+ bgColor: {
252
+ bgBlack: [40, 49],
253
+ bgRed: [41, 49],
254
+ bgGreen: [42, 49],
255
+ bgYellow: [43, 49],
256
+ bgBlue: [44, 49],
257
+ bgMagenta: [45, 49],
258
+ bgCyan: [46, 49],
259
+ bgWhite: [47, 49],
260
+ // Bright color
261
+ bgBlackBright: [100, 49],
262
+ bgGray: [100, 49],
263
+ // Alias of `bgBlackBright`
264
+ bgGrey: [100, 49],
265
+ // Alias of `bgBlackBright`
266
+ bgRedBright: [101, 49],
267
+ bgGreenBright: [102, 49],
268
+ bgYellowBright: [103, 49],
269
+ bgBlueBright: [104, 49],
270
+ bgMagentaBright: [105, 49],
271
+ bgCyanBright: [106, 49],
272
+ bgWhiteBright: [107, 49]
273
+ }
274
+ };
275
+ var modifierNames = Object.keys(styles.modifier);
276
+ var foregroundColorNames = Object.keys(styles.color);
277
+ var backgroundColorNames = Object.keys(styles.bgColor);
278
+ var colorNames = [...foregroundColorNames, ...backgroundColorNames];
279
+ function assembleStyles() {
280
+ const codes = /* @__PURE__ */ new Map();
281
+ for (const [groupName, group] of Object.entries(styles)) {
282
+ for (const [styleName, style] of Object.entries(group)) {
283
+ styles[styleName] = {
284
+ open: `\x1B[${style[0]}m`,
285
+ close: `\x1B[${style[1]}m`
286
+ };
287
+ group[styleName] = styles[styleName];
288
+ codes.set(style[0], style[1]);
289
+ }
290
+ Object.defineProperty(styles, groupName, {
291
+ value: group,
292
+ enumerable: false
293
+ });
294
+ }
295
+ Object.defineProperty(styles, "codes", {
296
+ value: codes,
297
+ enumerable: false
298
+ });
299
+ styles.color.close = "\x1B[39m";
300
+ styles.bgColor.close = "\x1B[49m";
301
+ styles.color.ansi = wrapAnsi16();
302
+ styles.color.ansi256 = wrapAnsi256();
303
+ styles.color.ansi16m = wrapAnsi16m();
304
+ styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
305
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
306
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
307
+ Object.defineProperties(styles, {
308
+ rgbToAnsi256: {
309
+ value: (red, green, blue) => {
310
+ if (red === green && green === blue) {
311
+ if (red < 8) {
312
+ return 16;
313
+ }
314
+ if (red > 248) {
315
+ return 231;
316
+ }
317
+ return Math.round((red - 8) / 247 * 24) + 232;
318
+ }
319
+ return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
320
+ },
321
+ enumerable: false
322
+ },
323
+ hexToRgb: {
324
+ value: (hex) => {
325
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
326
+ if (!matches) {
327
+ return [0, 0, 0];
328
+ }
329
+ let [colorString] = matches;
330
+ if (colorString.length === 3) {
331
+ colorString = [...colorString].map((character) => character + character).join("");
332
+ }
333
+ const integer = Number.parseInt(colorString, 16);
334
+ return [
335
+ /* eslint-disable no-bitwise */
336
+ integer >> 16 & 255,
337
+ integer >> 8 & 255,
338
+ integer & 255
339
+ /* eslint-enable no-bitwise */
340
+ ];
341
+ },
342
+ enumerable: false
343
+ },
344
+ hexToAnsi256: {
345
+ value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
346
+ enumerable: false
347
+ },
348
+ ansi256ToAnsi: {
349
+ value: (code) => {
350
+ if (code < 8) {
351
+ return 30 + code;
352
+ }
353
+ if (code < 16) {
354
+ return 90 + (code - 8);
355
+ }
356
+ let red;
357
+ let green;
358
+ let blue;
359
+ if (code >= 232) {
360
+ red = ((code - 232) * 10 + 8) / 255;
361
+ green = red;
362
+ blue = red;
363
+ } else {
364
+ code -= 16;
365
+ const remainder = code % 36;
366
+ red = Math.floor(code / 36) / 5;
367
+ green = Math.floor(remainder / 6) / 5;
368
+ blue = remainder % 6 / 5;
369
+ }
370
+ const value = Math.max(red, green, blue) * 2;
371
+ if (value === 0) {
372
+ return 30;
373
+ }
374
+ let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
375
+ if (value === 2) {
376
+ result += 60;
377
+ }
378
+ return result;
379
+ },
380
+ enumerable: false
381
+ },
382
+ rgbToAnsi: {
383
+ value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
384
+ enumerable: false
385
+ },
386
+ hexToAnsi: {
387
+ value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
388
+ enumerable: false
389
+ }
390
+ });
391
+ return styles;
392
+ }
393
+ var ansiStyles = assembleStyles();
394
+ var ansi_styles_default = ansiStyles;
395
+ var ESCAPES = /* @__PURE__ */ new Set([
396
+ "\x1B",
397
+ "\x9B"
398
+ ]);
399
+ var END_CODE = 39;
400
+ var ANSI_ESCAPE_BELL = "\x07";
401
+ var ANSI_CSI = "[";
402
+ var ANSI_OSC = "]";
403
+ var ANSI_SGR_TERMINATOR = "m";
404
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
405
+ var wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
406
+ var wrapAnsiHyperlink = (url) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
407
+ var wordLengths = (string) => string.split(" ").map((character) => (0, import_chunk_URKH6SE2.stringWidth)(character));
408
+ var wrapWord = (rows, word, columns) => {
409
+ const characters = [...word];
410
+ let isInsideEscape = false;
411
+ let isInsideLinkEscape = false;
412
+ let visible = (0, import_chunk_URKH6SE2.stringWidth)((0, import_chunk_URKH6SE2.stripAnsi)(rows.at(-1)));
413
+ for (const [index, character] of characters.entries()) {
414
+ const characterLength = (0, import_chunk_URKH6SE2.stringWidth)(character);
415
+ if (visible + characterLength <= columns) {
416
+ rows[rows.length - 1] += character;
417
+ } else {
418
+ rows.push(character);
419
+ visible = 0;
420
+ }
421
+ if (ESCAPES.has(character)) {
422
+ isInsideEscape = true;
423
+ const ansiEscapeLinkCandidate = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join("");
424
+ isInsideLinkEscape = ansiEscapeLinkCandidate === ANSI_ESCAPE_LINK;
425
+ }
426
+ if (isInsideEscape) {
427
+ if (isInsideLinkEscape) {
428
+ if (character === ANSI_ESCAPE_BELL) {
429
+ isInsideEscape = false;
430
+ isInsideLinkEscape = false;
431
+ }
432
+ } else if (character === ANSI_SGR_TERMINATOR) {
433
+ isInsideEscape = false;
434
+ }
435
+ continue;
436
+ }
437
+ visible += characterLength;
438
+ if (visible === columns && index < characters.length - 1) {
439
+ rows.push("");
440
+ visible = 0;
441
+ }
442
+ }
443
+ if (!visible && rows.at(-1).length > 0 && rows.length > 1) {
444
+ rows[rows.length - 2] += rows.pop();
445
+ }
446
+ };
447
+ var stringVisibleTrimSpacesRight = (string) => {
448
+ const words = string.split(" ");
449
+ let last = words.length;
450
+ while (last > 0) {
451
+ if ((0, import_chunk_URKH6SE2.stringWidth)(words[last - 1]) > 0) {
452
+ break;
453
+ }
454
+ last--;
455
+ }
456
+ if (last === words.length) {
457
+ return string;
458
+ }
459
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
460
+ };
461
+ var exec = (string, columns, options = {}) => {
462
+ if (options.trim !== false && string.trim() === "") {
463
+ return "";
464
+ }
465
+ let returnValue = "";
466
+ let escapeCode;
467
+ let escapeUrl;
468
+ const lengths = wordLengths(string);
469
+ let rows = [""];
470
+ for (const [index, word] of string.split(" ").entries()) {
471
+ if (options.trim !== false) {
472
+ rows[rows.length - 1] = rows.at(-1).trimStart();
473
+ }
474
+ let rowLength = (0, import_chunk_URKH6SE2.stringWidth)(rows.at(-1));
475
+ if (index !== 0) {
476
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
477
+ rows.push("");
478
+ rowLength = 0;
479
+ }
480
+ if (rowLength > 0 || options.trim === false) {
481
+ rows[rows.length - 1] += " ";
482
+ rowLength++;
483
+ }
484
+ }
485
+ if (options.hard && lengths[index] > columns) {
486
+ const remainingColumns = columns - rowLength;
487
+ const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
488
+ const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
489
+ if (breaksStartingNextLine < breaksStartingThisLine) {
490
+ rows.push("");
491
+ }
492
+ wrapWord(rows, word, columns);
493
+ continue;
494
+ }
495
+ if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
496
+ if (options.wordWrap === false && rowLength < columns) {
497
+ wrapWord(rows, word, columns);
498
+ continue;
499
+ }
500
+ rows.push("");
501
+ }
502
+ if (rowLength + lengths[index] > columns && options.wordWrap === false) {
503
+ wrapWord(rows, word, columns);
504
+ continue;
505
+ }
506
+ rows[rows.length - 1] += word;
507
+ }
508
+ if (options.trim !== false) {
509
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
510
+ }
511
+ const preString = rows.join("\n");
512
+ const pre = [...preString];
513
+ let preStringIndex = 0;
514
+ for (const [index, character] of pre.entries()) {
515
+ returnValue += character;
516
+ if (ESCAPES.has(character)) {
517
+ const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || { groups: {} };
518
+ if (groups.code !== void 0) {
519
+ const code2 = Number.parseFloat(groups.code);
520
+ escapeCode = code2 === END_CODE ? void 0 : code2;
521
+ } else if (groups.uri !== void 0) {
522
+ escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
523
+ }
524
+ }
525
+ const code = ansi_styles_default.codes.get(Number(escapeCode));
526
+ if (pre[index + 1] === "\n") {
527
+ if (escapeUrl) {
528
+ returnValue += wrapAnsiHyperlink("");
529
+ }
530
+ if (escapeCode && code) {
531
+ returnValue += wrapAnsiCode(code);
532
+ }
533
+ } else if (character === "\n") {
534
+ if (escapeCode && code) {
535
+ returnValue += wrapAnsiCode(escapeCode);
536
+ }
537
+ if (escapeUrl) {
538
+ returnValue += wrapAnsiHyperlink(escapeUrl);
539
+ }
540
+ }
541
+ preStringIndex += character.length;
542
+ }
543
+ return returnValue;
544
+ };
545
+ function wrapAnsi(string, columns, options) {
546
+ return String(string).normalize().replaceAll("\r\n", "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
547
+ }
548
+ function isFullwidthCodePoint(codePoint) {
549
+ if (!Number.isInteger(codePoint)) {
550
+ return false;
551
+ }
552
+ return (0, import_chunk_URKH6SE2.eastAsianWidth)(codePoint) === 2;
553
+ }
554
+ var ESCAPES2 = /* @__PURE__ */ new Set([27, 155]);
555
+ var CODE_POINT_0 = "0".codePointAt(0);
556
+ var CODE_POINT_9 = "9".codePointAt(0);
557
+ var endCodesSet = /* @__PURE__ */ new Set();
558
+ var endCodesMap = /* @__PURE__ */ new Map();
559
+ for (const [start, end] of ansi_styles_default.codes) {
560
+ endCodesSet.add(ansi_styles_default.color.ansi(end));
561
+ endCodesMap.set(ansi_styles_default.color.ansi(start), ansi_styles_default.color.ansi(end));
562
+ }
563
+ function getEndCode(code) {
564
+ if (endCodesSet.has(code)) {
565
+ return code;
566
+ }
567
+ if (endCodesMap.has(code)) {
568
+ return endCodesMap.get(code);
569
+ }
570
+ code = code.slice(2);
571
+ if (code.includes(";")) {
572
+ code = code[0] + "0";
573
+ }
574
+ const returnValue = ansi_styles_default.codes.get(Number.parseInt(code, 10));
575
+ if (returnValue) {
576
+ return ansi_styles_default.color.ansi(returnValue);
577
+ }
578
+ return ansi_styles_default.reset.open;
579
+ }
580
+ function findNumberIndex(string) {
581
+ for (let index = 0; index < string.length; index++) {
582
+ const codePoint = string.codePointAt(index);
583
+ if (codePoint >= CODE_POINT_0 && codePoint <= CODE_POINT_9) {
584
+ return index;
585
+ }
586
+ }
587
+ return -1;
588
+ }
589
+ function parseAnsiCode(string, offset) {
590
+ string = string.slice(offset, offset + 19);
591
+ const startIndex = findNumberIndex(string);
592
+ if (startIndex !== -1) {
593
+ let endIndex = string.indexOf("m", startIndex);
594
+ if (endIndex === -1) {
595
+ endIndex = string.length;
596
+ }
597
+ return string.slice(0, endIndex + 1);
598
+ }
599
+ }
600
+ function tokenize(string, endCharacter = Number.POSITIVE_INFINITY) {
601
+ const returnValue = [];
602
+ let index = 0;
603
+ let visibleCount = 0;
604
+ while (index < string.length) {
605
+ const codePoint = string.codePointAt(index);
606
+ if (ESCAPES2.has(codePoint)) {
607
+ const code = parseAnsiCode(string, index);
608
+ if (code) {
609
+ returnValue.push({
610
+ type: "ansi",
611
+ code,
612
+ endCode: getEndCode(code)
613
+ });
614
+ index += code.length;
615
+ continue;
616
+ }
617
+ }
618
+ const isFullWidth = isFullwidthCodePoint(codePoint);
619
+ const character = String.fromCodePoint(codePoint);
620
+ returnValue.push({
621
+ type: "character",
622
+ value: character,
623
+ isFullWidth
624
+ });
625
+ index += character.length;
626
+ visibleCount += isFullWidth ? 2 : character.length;
627
+ if (visibleCount >= endCharacter) {
628
+ break;
629
+ }
630
+ }
631
+ return returnValue;
632
+ }
633
+ function reduceAnsiCodes(codes) {
634
+ let returnValue = [];
635
+ for (const code of codes) {
636
+ if (code.code === ansi_styles_default.reset.open) {
637
+ returnValue = [];
638
+ } else if (endCodesSet.has(code.code)) {
639
+ returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.code);
640
+ } else {
641
+ returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.endCode);
642
+ returnValue.push(code);
643
+ }
644
+ }
645
+ return returnValue;
646
+ }
647
+ function undoAnsiCodes(codes) {
648
+ const reduced = reduceAnsiCodes(codes);
649
+ const endCodes = reduced.map(({ endCode }) => endCode);
650
+ return endCodes.reverse().join("");
651
+ }
652
+ function sliceAnsi(string, start, end) {
653
+ const tokens = tokenize(string, end);
654
+ let activeCodes = [];
655
+ let position = 0;
656
+ let returnValue = "";
657
+ let include = false;
658
+ for (const token of tokens) {
659
+ if (end !== void 0 && position >= end) {
660
+ break;
661
+ }
662
+ if (token.type === "ansi") {
663
+ activeCodes.push(token);
664
+ if (include) {
665
+ returnValue += token.code;
666
+ }
667
+ } else {
668
+ if (!include && position >= start) {
669
+ include = true;
670
+ activeCodes = reduceAnsiCodes(activeCodes);
671
+ returnValue = activeCodes.map(({ code }) => code).join("");
672
+ }
673
+ if (include) {
674
+ returnValue += token.value;
675
+ }
676
+ position += token.isFullWidth ? 2 : token.value.length;
677
+ }
678
+ }
679
+ returnValue += undoAnsiCodes(activeCodes);
680
+ return returnValue;
681
+ }
682
+ var defaultTerminalHeight = 24;
683
+ var getWidth = ({ columns = 80 }) => columns;
684
+ var fitToTerminalHeight = (stream, text) => {
685
+ const terminalHeight = stream.rows ?? defaultTerminalHeight;
686
+ const lines = text.split("\n");
687
+ const toRemove = Math.max(0, lines.length - terminalHeight);
688
+ return toRemove ? sliceAnsi(text, (0, import_chunk_URKH6SE2.stripAnsi)(lines.slice(0, toRemove).join("\n")).length + 1) : text;
689
+ };
690
+ function createLogUpdate(stream, { showCursor = false } = {}) {
691
+ let previousLineCount = 0;
692
+ let previousWidth = getWidth(stream);
693
+ let previousOutput = "";
694
+ const reset = () => {
695
+ previousOutput = "";
696
+ previousWidth = getWidth(stream);
697
+ previousLineCount = 0;
698
+ };
699
+ const render = (...arguments_) => {
700
+ if (!showCursor) {
701
+ import_chunk_URKH6SE2.cli_cursor_default.hide();
702
+ }
703
+ let output = fitToTerminalHeight(stream, arguments_.join(" ") + "\n");
704
+ const width = getWidth(stream);
705
+ if (output === previousOutput && previousWidth === width) {
706
+ return;
707
+ }
708
+ previousOutput = output;
709
+ previousWidth = width;
710
+ output = wrapAnsi(output, width, { trim: false, hard: true, wordWrap: false });
711
+ stream.write(base_exports.eraseLines(previousLineCount) + output);
712
+ previousLineCount = output.split("\n").length;
713
+ };
714
+ render.clear = () => {
715
+ stream.write(base_exports.eraseLines(previousLineCount));
716
+ reset();
717
+ };
718
+ render.done = () => {
719
+ reset();
720
+ if (!showCursor) {
721
+ import_chunk_URKH6SE2.cli_cursor_default.show();
722
+ }
723
+ };
724
+ return render;
725
+ }
726
+ var logUpdate = createLogUpdate(import_node_process.default.stdout);
727
+ var log_update_default = logUpdate;
728
+ var logUpdateStderr = createLogUpdate(import_node_process.default.stderr);
729
+ var Migrate = class {
730
+ engine;
731
+ schemaContext;
732
+ migrationsDirectoryPath;
733
+ constructor(schemaContext, migrationsDirPath, enabledPreviewFeatures) {
734
+ if (schemaContext) {
735
+ this.schemaContext = schemaContext;
736
+ this.migrationsDirectoryPath = migrationsDirPath;
737
+ this.engine = new import_chunk_D2DGSPW6.SchemaEngine({ schemaContext, enabledPreviewFeatures });
738
+ } else {
739
+ this.engine = new import_chunk_D2DGSPW6.SchemaEngine({ enabledPreviewFeatures });
740
+ }
741
+ }
742
+ stop() {
743
+ this.engine.stop();
744
+ }
745
+ getPrismaSchema() {
746
+ if (!this.schemaContext) throw new Error("this.schemaContext is undefined");
747
+ return (0, import_internals.toSchemasContainer)(this.schemaContext.schemaFiles);
748
+ }
749
+ reset() {
750
+ return this.engine.reset();
751
+ }
752
+ async createMigration(params) {
753
+ if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
754
+ const migrationsList = await (0, import_chunk_V6PVGSDJ.listMigrations)(this.migrationsDirectoryPath);
755
+ const { connectorType, generatedMigrationName, extension, migrationScript } = await this.engine.createMigration({
756
+ ...params,
757
+ migrationsList
758
+ });
759
+ const { baseDir, lockfile } = migrationsList;
760
+ if (migrationScript === null) {
761
+ return {
762
+ generatedMigrationName: void 0
763
+ };
764
+ }
765
+ const directoryPath = await (0, import_chunk_23DZXSTI.createMigration)({
766
+ baseDir,
767
+ generatedMigrationName
768
+ }).catch((e) => {
769
+ throw new Error(`Failed to create a new migration directory: ${e.message}`);
770
+ });
771
+ await (0, import_chunk_23DZXSTI.writeMigrationScript)({
772
+ baseDir,
773
+ extension,
774
+ migrationName: generatedMigrationName,
775
+ script: migrationScript
776
+ }).catch((e) => {
777
+ throw new Error(`Failed to write migration script to ${directoryPath}: ${e.message}`);
778
+ });
779
+ await (0, import_chunk_23DZXSTI.writeMigrationLockfile)({
780
+ baseDir,
781
+ connectorType,
782
+ lockfile
783
+ }).catch((e) => {
784
+ throw new Error(`Failed to write the migration lock file to ${baseDir}: ${e.message}`);
785
+ });
786
+ return {
787
+ generatedMigrationName
788
+ };
789
+ }
790
+ async diagnoseMigrationHistory({
791
+ optInToShadowDatabase
792
+ }) {
793
+ if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
794
+ const migrationsList = await (0, import_chunk_V6PVGSDJ.listMigrations)(this.migrationsDirectoryPath);
795
+ return this.engine.diagnoseMigrationHistory({
796
+ migrationsList,
797
+ optInToShadowDatabase
798
+ });
799
+ }
800
+ async listMigrationDirectories() {
801
+ if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
802
+ const migrationsList = await (0, import_chunk_V6PVGSDJ.listMigrations)(this.migrationsDirectoryPath);
803
+ return {
804
+ migrations: migrationsList.migrationDirectories.map((dir) => dir.path)
805
+ };
806
+ }
807
+ async devDiagnostic() {
808
+ if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
809
+ const migrationsList = await (0, import_chunk_V6PVGSDJ.listMigrations)(this.migrationsDirectoryPath);
810
+ return this.engine.devDiagnostic({
811
+ migrationsList
812
+ });
813
+ }
814
+ async markMigrationApplied({ migrationId }) {
815
+ if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
816
+ const migrationsList = await (0, import_chunk_V6PVGSDJ.listMigrations)(this.migrationsDirectoryPath);
817
+ return await this.engine.markMigrationApplied({
818
+ migrationsList,
819
+ migrationName: migrationId
820
+ });
821
+ }
822
+ markMigrationRolledBack({ migrationId }) {
823
+ return this.engine.markMigrationRolledBack({
824
+ migrationName: migrationId
825
+ });
826
+ }
827
+ async applyMigrations() {
828
+ if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
829
+ const migrationsList = await (0, import_chunk_V6PVGSDJ.listMigrations)(this.migrationsDirectoryPath);
830
+ return this.engine.applyMigrations({
831
+ migrationsList
832
+ });
833
+ }
834
+ async evaluateDataLoss() {
835
+ if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
836
+ const migrationsList = await (0, import_chunk_V6PVGSDJ.listMigrations)(this.migrationsDirectoryPath);
837
+ const schema = this.getPrismaSchema();
838
+ return this.engine.evaluateDataLoss({
839
+ migrationsList,
840
+ schema
841
+ });
842
+ }
843
+ async push({ force = false }) {
844
+ const schema = this.getPrismaSchema();
845
+ const { warnings, unexecutable, executedSteps } = await this.engine.schemaPush({
846
+ force,
847
+ schema
848
+ });
849
+ return {
850
+ executedSteps,
851
+ warnings,
852
+ unexecutable
853
+ };
854
+ }
855
+ async tryToRunGenerate(datasourceInfo) {
856
+ if (!this.schemaContext) throw new Error("this.schemaContext is undefined");
857
+ const skipEngines = (0, import_internals.isPrismaPostgres)(datasourceInfo.url);
858
+ const message = [];
859
+ process.stdout.write("\n");
860
+ log_update_default(`Running generate... ${(0, import_chunk_SKRR5WT4.dim)("(Use --skip-generate to skip the generators)")}`);
861
+ const generators = await (0, import_internals.getGenerators)({
862
+ schemaContext: this.schemaContext,
863
+ printDownloadProgress: true,
864
+ version: import_engines_version.enginesVersion,
865
+ noEngine: skipEngines,
866
+ registry: import_client_generator_registry.defaultRegistry.toInternal()
867
+ });
868
+ for (const generator of generators) {
869
+ log_update_default(`Running generate... - ${generator.getPrettyName()}`);
870
+ const before = Math.round(performance.now());
871
+ try {
872
+ await generator.generate();
873
+ const after = Math.round(performance.now());
874
+ message.push((0, import_internals.getGeneratorSuccessMessage)(generator, after - before));
875
+ generator.stop();
876
+ } catch (e) {
877
+ message.push(`${e.message}`);
878
+ generator.stop();
879
+ }
880
+ }
881
+ log_update_default(message.join("\n"));
882
+ }
883
+ };