@prisma/migrate 6.6.0-dev.10 → 6.6.0-dev.100

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