@prisma/migrate 6.5.0-dev.1 → 6.5.0-dev.11
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.
- package/dist/CLI.js +3 -4
- package/dist/Migrate.js +6 -7
- package/dist/SchemaEngine.js +6 -7
- package/dist/bin.js +116 -146
- package/dist/{chunk-WOOPRG54.js → chunk-255BRND3.js} +7 -14
- package/dist/{chunk-V5LEZ5BX.js → chunk-2NJLJFGC.js} +634 -807
- package/dist/{chunk-75EIHNAH.js → chunk-2NMFKGXM.js} +5 -6
- package/dist/chunk-3WC4XD74.js +98 -0
- package/dist/chunk-4EV2RVXY.js +226 -0
- package/dist/{chunk-YWWOSXMY.js → chunk-4JQIX6O7.js} +7 -15
- package/dist/{chunk-J77IRNPE.js → chunk-5VDXAE53.js} +45 -31
- package/dist/{chunk-M5YNQ2NP.js → chunk-6DFJIBJX.js} +5 -12
- package/dist/{chunk-SGCF5OHF.js → chunk-7CQBDP4H.js} +6 -13
- package/dist/{chunk-7IT2ZO3D.js → chunk-AHJ2N6BJ.js} +3 -9
- package/dist/chunk-CTPONE6G.js +65 -0
- package/dist/{chunk-DUCG3NRP.js → chunk-D74DU52C.js} +633 -806
- package/dist/{chunk-UVNSK22K.js → chunk-DDHPSYC4.js} +122 -130
- package/dist/{chunk-CUDKD32S.js → chunk-DIAO4W7O.js} +11 -17
- package/dist/{chunk-XJQP3B4W.js → chunk-DJMFXNR4.js} +7 -15
- package/dist/{chunk-YD7GG4WS.js → chunk-FRTPDRF2.js} +66 -74
- package/dist/chunk-HIFVDK2U.js +96 -0
- package/dist/chunk-I4EY55DC.js +195 -0
- package/dist/{chunk-WLJHGKMK.js → chunk-IHDN3L3R.js} +7 -8
- package/dist/chunk-J5FHVALZ.js +230 -0
- package/dist/{chunk-INC2OACE.js → chunk-JFKDSUIE.js} +3 -9
- package/dist/{chunk-V7DE6JTG.js → chunk-JZ75RIMZ.js} +3 -9
- package/dist/{chunk-AAATUOV6.js → chunk-L6KOIJJ5.js} +53 -59
- package/dist/{chunk-GN5BY5N2.js → chunk-LGYRZ6CV.js} +4 -10
- package/dist/chunk-LVLRGTYH.js +148 -0
- package/dist/{chunk-CQQQ436N.js → chunk-MATFO4ZW.js} +186 -200
- package/dist/{chunk-IFCV5MY4.js → chunk-OCQGHQED.js} +5 -11
- package/dist/chunk-ORL3LJOT.js +470 -0
- package/dist/chunk-PSYS5XVH.js +335 -0
- package/dist/{chunk-Q7ACZDDT.js → chunk-QOPTDDIH.js} +5 -12
- package/dist/chunk-QTAIWPLH.js +78 -0
- package/dist/{chunk-35LAJN5S.js → chunk-RP2N6UXA.js} +23 -29
- package/dist/chunk-RQFGRXJI.js +174 -0
- package/dist/{chunk-QBK5XTJE.js → chunk-RR6BKMNO.js} +3 -9
- package/dist/{chunk-ILJRJJ3S.js → chunk-RTGQXNX6.js} +3 -9
- package/dist/chunk-SKRR5WT4.js +76 -0
- package/dist/chunk-TM3ETZES.js +153 -0
- package/dist/{chunk-KPUNMK5W.js → chunk-TWPTG4XS.js} +5 -12
- package/dist/{chunk-6QFE3AWR.js → chunk-UP6FVCDK.js} +6 -13
- package/dist/{chunk-YKUZUAXA.js → chunk-V3ZMNXZC.js} +16 -23
- package/dist/chunk-WLPX3672.js +365 -0
- package/dist/chunk-WNH2ACJS.js +122 -0
- package/dist/{chunk-X6XGFLEF.js → chunk-YZVZCC3I.js} +25 -30
- package/dist/commands/DbCommand.js +3 -4
- package/dist/commands/DbDrop.js +9 -9
- package/dist/commands/DbExecute.js +7 -8
- package/dist/commands/DbPull.js +18 -19
- package/dist/commands/DbPush.js +12 -13
- package/dist/commands/DbSeed.js +4 -5
- package/dist/commands/MigrateCommand.js +3 -4
- package/dist/commands/MigrateDeploy.js +13 -14
- package/dist/commands/MigrateDev.js +17 -18
- package/dist/commands/MigrateDiff.js +8 -9
- package/dist/commands/MigrateReset.js +15 -16
- package/dist/commands/MigrateResolve.js +11 -12
- package/dist/commands/MigrateStatus.js +11 -12
- package/dist/index.js +60 -77
- package/dist/internals/src/index.d.ts +3 -0
- package/dist/internals/src/utils/isInContainer.d.ts +5 -0
- package/dist/internals/src/utils/isInNpmLifecycleHook.d.ts +4 -0
- package/dist/internals/src/utils/maybeInGitHook.d.ts +9 -0
- package/dist/migrate/src/commands/MigrateDev.d.ts +1 -1
- package/dist/{multipart-parser-73VM3J4A.js → multipart-parser-NDLECNMN.js} +527 -561
- package/dist/utils/byline.js +5 -6
- package/dist/utils/captureStdout.js +2 -3
- package/dist/utils/countModelsAndTypes.js +2 -3
- package/dist/utils/ensureDatabaseExists.js +8 -9
- package/dist/utils/errors.js +8 -9
- package/dist/utils/flagErrors.js +5 -5
- package/dist/utils/getDatabaseVersionSafe.js +6 -7
- package/dist/utils/getSchemaPathAndPrint.js +4 -5
- package/dist/utils/handleEvaluateDataloss.js +3 -4
- package/dist/utils/introspectSql.js +6 -6
- package/dist/utils/isSchemaEmpty.js +2 -3
- package/dist/utils/printDatasource.js +3 -4
- package/dist/utils/printDatasources.js +3 -4
- package/dist/utils/printFiles.js +5 -6
- package/dist/utils/printIntrospectedSchema.js +2 -3
- package/dist/utils/printMigrationId.js +4 -5
- package/dist/utils/promptForMigrationName.js +2 -3
- package/dist/utils/removeSchemaFiles.js +2 -3
- package/dist/utils/replaceOrAddDatasource.js +2 -3
- package/dist/utils/replaceOrAddDatasource.test.js +7 -8
- package/dist/utils/saveSchemaFiles.js +2 -3
- package/dist/utils/seed.js +6 -7
- package/dist/utils/setupMSSQL.js +13 -13
- package/dist/utils/setupMongo.js +3 -3
- package/dist/utils/spinner.js +2 -3
- package/dist/utils/unixSocket.js +2 -3
- package/dist/views/handleViewsIO.js +2 -3
- package/package.json +7 -7
- package/dist/chunk-26XQQ4AG.js +0 -386
- package/dist/chunk-2RSEPJFX.js +0 -165
- package/dist/chunk-4B2LXK4R.js +0 -207
- package/dist/chunk-4UJBOCZJ.js +0 -130
- package/dist/chunk-5HZLCY6X.js +0 -161
- package/dist/chunk-6TE2RIPN.js +0 -80
- package/dist/chunk-7S3Q4MCN.js +0 -480
- package/dist/chunk-AOX7CJAS.js +0 -234
- package/dist/chunk-FF3526PX.js +0 -279
- package/dist/chunk-FUSFURVP.js +0 -86
- package/dist/chunk-GCTCQLOF.js +0 -365
- package/dist/chunk-K44VNAFW.js +0 -189
- package/dist/chunk-O4BT6W33.js +0 -104
- package/dist/chunk-TKAGMA5K.js +0 -72
- package/dist/chunk-U374EXYQ.js +0 -106
|
@@ -16,13 +16,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
init_replaceOrAddDatasource: () => init_replaceOrAddDatasource,
|
|
19
|
+
var chunk_RR6BKMNO_exports = {};
|
|
20
|
+
__export(chunk_RR6BKMNO_exports, {
|
|
22
21
|
replaceOrAddDatasource: () => replaceOrAddDatasource
|
|
23
22
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
25
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
23
|
+
module.exports = __toCommonJS(chunk_RR6BKMNO_exports);
|
|
26
24
|
var import_internals = require("@prisma/internals");
|
|
27
25
|
function replaceOrAddDatasource(newDatasource, files) {
|
|
28
26
|
let replaced = false;
|
|
@@ -80,7 +78,3 @@ function findDatasource(lines) {
|
|
|
80
78
|
}
|
|
81
79
|
return { startLine, endLine };
|
|
82
80
|
}
|
|
83
|
-
var init_replaceOrAddDatasource = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
84
|
-
"src/utils/replaceOrAddDatasource.ts"() {
|
|
85
|
-
}
|
|
86
|
-
});
|
|
@@ -26,18 +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
|
|
30
|
-
__export(
|
|
31
|
-
init_saveSchemaFiles: () => init_saveSchemaFiles,
|
|
29
|
+
var chunk_RTGQXNX6_exports = {};
|
|
30
|
+
__export(chunk_RTGQXNX6_exports, {
|
|
32
31
|
saveSchemaFiles: () => saveSchemaFiles
|
|
33
32
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
35
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
33
|
+
module.exports = __toCommonJS(chunk_RTGQXNX6_exports);
|
|
36
34
|
var import_promises = __toESM(require("node:fs/promises"));
|
|
37
35
|
async function saveSchemaFiles(schemas) {
|
|
38
36
|
await Promise.all(schemas.files.map((file) => import_promises.default.writeFile(file.path, file.content, "utf8")));
|
|
39
37
|
}
|
|
40
|
-
var init_saveSchemaFiles = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
41
|
-
"src/utils/saveSchemaFiles.ts"() {
|
|
42
|
-
}
|
|
43
|
-
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var chunk_SKRR5WT4_exports = {};
|
|
20
|
+
__export(chunk_SKRR5WT4_exports, {
|
|
21
|
+
bold: () => bold,
|
|
22
|
+
cyan: () => cyan,
|
|
23
|
+
dim: () => dim,
|
|
24
|
+
green: () => green,
|
|
25
|
+
italic: () => italic,
|
|
26
|
+
red: () => red,
|
|
27
|
+
underline: () => underline,
|
|
28
|
+
yellow: () => yellow
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(chunk_SKRR5WT4_exports);
|
|
31
|
+
var FORCE_COLOR;
|
|
32
|
+
var NODE_DISABLE_COLORS;
|
|
33
|
+
var NO_COLOR;
|
|
34
|
+
var TERM;
|
|
35
|
+
var isTTY = true;
|
|
36
|
+
if (typeof process !== "undefined") {
|
|
37
|
+
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
|
38
|
+
isTTY = process.stdout && process.stdout.isTTY;
|
|
39
|
+
}
|
|
40
|
+
var $ = {
|
|
41
|
+
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
|
|
42
|
+
};
|
|
43
|
+
function init(x, y) {
|
|
44
|
+
let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
|
|
45
|
+
let open = `\x1B[${x}m`, close = `\x1B[${y}m`;
|
|
46
|
+
return function(txt) {
|
|
47
|
+
if (!$.enabled || txt == null) return txt;
|
|
48
|
+
return open + (!!~("" + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
var reset = init(0, 0);
|
|
52
|
+
var bold = init(1, 22);
|
|
53
|
+
var dim = init(2, 22);
|
|
54
|
+
var italic = init(3, 23);
|
|
55
|
+
var underline = init(4, 24);
|
|
56
|
+
var inverse = init(7, 27);
|
|
57
|
+
var hidden = init(8, 28);
|
|
58
|
+
var strikethrough = init(9, 29);
|
|
59
|
+
var black = init(30, 39);
|
|
60
|
+
var red = init(31, 39);
|
|
61
|
+
var green = init(32, 39);
|
|
62
|
+
var yellow = init(33, 39);
|
|
63
|
+
var blue = init(34, 39);
|
|
64
|
+
var magenta = init(35, 39);
|
|
65
|
+
var cyan = init(36, 39);
|
|
66
|
+
var white = init(37, 39);
|
|
67
|
+
var gray = init(90, 39);
|
|
68
|
+
var grey = init(90, 39);
|
|
69
|
+
var bgBlack = init(40, 49);
|
|
70
|
+
var bgRed = init(41, 49);
|
|
71
|
+
var bgGreen = init(42, 49);
|
|
72
|
+
var bgYellow = init(43, 49);
|
|
73
|
+
var bgBlue = init(44, 49);
|
|
74
|
+
var bgMagenta = init(45, 49);
|
|
75
|
+
var bgCyan = init(46, 49);
|
|
76
|
+
var bgWhite = init(47, 49);
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var chunk_TM3ETZES_exports = {};
|
|
20
|
+
__export(chunk_TM3ETZES_exports, {
|
|
21
|
+
MigrateResolve: () => MigrateResolve
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(chunk_TM3ETZES_exports);
|
|
24
|
+
var import_chunk_DDHPSYC4 = require("./chunk-DDHPSYC4.js");
|
|
25
|
+
var import_chunk_6DFJIBJX = require("./chunk-6DFJIBJX.js");
|
|
26
|
+
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
27
|
+
var import_chunk_DJMFXNR4 = require("./chunk-DJMFXNR4.js");
|
|
28
|
+
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
29
|
+
var import_internals = require("@prisma/internals");
|
|
30
|
+
var _MigrateResolve = class _MigrateResolve2 {
|
|
31
|
+
static new() {
|
|
32
|
+
return new _MigrateResolve2();
|
|
33
|
+
}
|
|
34
|
+
async parse(argv, config) {
|
|
35
|
+
const args = (0, import_internals.arg)(
|
|
36
|
+
argv,
|
|
37
|
+
{
|
|
38
|
+
"--help": Boolean,
|
|
39
|
+
"-h": "--help",
|
|
40
|
+
"--applied": String,
|
|
41
|
+
"--rolled-back": String,
|
|
42
|
+
"--schema": String,
|
|
43
|
+
"--config": String,
|
|
44
|
+
"--telemetry-information": String
|
|
45
|
+
},
|
|
46
|
+
false
|
|
47
|
+
);
|
|
48
|
+
if ((0, import_internals.isError)(args)) {
|
|
49
|
+
return this.help(args.message);
|
|
50
|
+
}
|
|
51
|
+
await (0, import_internals.checkUnsupportedDataProxy)("migrate resolve", args, config.schema, true);
|
|
52
|
+
if (args["--help"]) {
|
|
53
|
+
return this.help();
|
|
54
|
+
}
|
|
55
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
56
|
+
const { schemaPath } = await (0, import_chunk_6DFJIBJX.getSchemaPathAndPrint)(args["--schema"], config.schema);
|
|
57
|
+
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: await (0, import_chunk_DJMFXNR4.getDatasourceInfo)({ schemaPath }) });
|
|
58
|
+
if (!args["--applied"] && !args["--rolled-back"]) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
`--applied or --rolled-back must be part of the command like:
|
|
61
|
+
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma migrate resolve --applied 20201231000000_example")))}
|
|
62
|
+
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma migrate resolve --rolled-back 20201231000000_example")))}`
|
|
63
|
+
);
|
|
64
|
+
} else if (args["--applied"] && args["--rolled-back"]) {
|
|
65
|
+
throw new Error("Pass either --applied or --rolled-back, not both.");
|
|
66
|
+
}
|
|
67
|
+
if (args["--applied"]) {
|
|
68
|
+
if (typeof args["--applied"] !== "string" || args["--applied"].length === 0) {
|
|
69
|
+
throw new Error(
|
|
70
|
+
`--applied value must be a string like ${(0, import_chunk_SKRR5WT4.bold)(
|
|
71
|
+
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma migrate resolve --applied 20201231000000_example"))
|
|
72
|
+
)}`
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
await (0, import_chunk_DJMFXNR4.ensureCanConnectToDatabase)(schemaPath);
|
|
76
|
+
const migrate = new import_chunk_DDHPSYC4.Migrate(schemaPath);
|
|
77
|
+
try {
|
|
78
|
+
await migrate.markMigrationApplied({
|
|
79
|
+
migrationId: args["--applied"]
|
|
80
|
+
});
|
|
81
|
+
} finally {
|
|
82
|
+
migrate.stop();
|
|
83
|
+
}
|
|
84
|
+
process.stdout.write(`
|
|
85
|
+
Migration ${args["--applied"]} marked as applied.
|
|
86
|
+
`);
|
|
87
|
+
return ``;
|
|
88
|
+
} else {
|
|
89
|
+
if (typeof args["--rolled-back"] !== "string" || args["--rolled-back"].length === 0) {
|
|
90
|
+
throw new Error(
|
|
91
|
+
`--rolled-back value must be a string like ${(0, import_chunk_SKRR5WT4.bold)(
|
|
92
|
+
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma migrate resolve --rolled-back 20201231000000_example"))
|
|
93
|
+
)}`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
await (0, import_chunk_DJMFXNR4.ensureCanConnectToDatabase)(schemaPath);
|
|
97
|
+
const migrate = new import_chunk_DDHPSYC4.Migrate(schemaPath);
|
|
98
|
+
try {
|
|
99
|
+
await migrate.markMigrationRolledBack({
|
|
100
|
+
migrationId: args["--rolled-back"]
|
|
101
|
+
});
|
|
102
|
+
} finally {
|
|
103
|
+
migrate.stop();
|
|
104
|
+
}
|
|
105
|
+
process.stdout.write(`
|
|
106
|
+
Migration ${args["--rolled-back"]} marked as rolled back.
|
|
107
|
+
`);
|
|
108
|
+
return ``;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
help(error) {
|
|
112
|
+
if (error) {
|
|
113
|
+
return new import_internals.HelpError(`
|
|
114
|
+
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
115
|
+
${_MigrateResolve2.help}`);
|
|
116
|
+
}
|
|
117
|
+
return _MigrateResolve2.help;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
_MigrateResolve.help = (0, import_internals.format)(`
|
|
121
|
+
Resolve issues with database migrations in deployment databases:
|
|
122
|
+
- recover from failed migrations
|
|
123
|
+
- baseline databases when starting to use Prisma Migrate on existing databases
|
|
124
|
+
- reconcile hotfixes done manually on databases with your migration history
|
|
125
|
+
|
|
126
|
+
Run "prisma migrate status" to identify if you need to use resolve.
|
|
127
|
+
|
|
128
|
+
Read more about resolving migration history issues: ${(0, import_internals.link)("https://pris.ly/d/migrate-resolve")}
|
|
129
|
+
|
|
130
|
+
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
131
|
+
|
|
132
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve [options]
|
|
133
|
+
|
|
134
|
+
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
135
|
+
|
|
136
|
+
-h, --help Display this help message
|
|
137
|
+
--config Custom path to your Prisma config file
|
|
138
|
+
--schema Custom path to your Prisma schema
|
|
139
|
+
--applied Record a specific migration as applied
|
|
140
|
+
--rolled-back Record a specific migration as rolled back
|
|
141
|
+
|
|
142
|
+
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
143
|
+
|
|
144
|
+
Update migrations table, recording a specific migration as applied
|
|
145
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --applied 20201231000000_add_users_table
|
|
146
|
+
|
|
147
|
+
Update migrations table, recording a specific migration as rolled back
|
|
148
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --rolled-back 20201231000000_add_users_table
|
|
149
|
+
|
|
150
|
+
Specify a schema
|
|
151
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --rolled-back 20201231000000_add_users_table --schema=./schema.prisma
|
|
152
|
+
`);
|
|
153
|
+
var MigrateResolve = _MigrateResolve;
|
|
@@ -16,13 +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
|
|
20
|
-
__export(
|
|
21
|
-
getSocketFromDatabaseCredentials: () => getSocketFromDatabaseCredentials
|
|
22
|
-
init_unixSocket: () => init_unixSocket
|
|
19
|
+
var chunk_TWPTG4XS_exports = {};
|
|
20
|
+
__export(chunk_TWPTG4XS_exports, {
|
|
21
|
+
getSocketFromDatabaseCredentials: () => getSocketFromDatabaseCredentials
|
|
23
22
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
25
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_TWPTG4XS_exports);
|
|
24
|
+
var simpleUnixPathPattern = /^\.{0,2}\//;
|
|
26
25
|
function getSocketFromDatabaseCredentials(credentials) {
|
|
27
26
|
if (["postgres", "postgresql", "cockroachdb"].includes(credentials.type)) {
|
|
28
27
|
const host = credentials.host;
|
|
@@ -33,9 +32,3 @@ function getSocketFromDatabaseCredentials(credentials) {
|
|
|
33
32
|
}
|
|
34
33
|
return credentials.socket ?? null;
|
|
35
34
|
}
|
|
36
|
-
var simpleUnixPathPattern;
|
|
37
|
-
var init_unixSocket = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
38
|
-
"src/utils/unixSocket.ts"() {
|
|
39
|
-
simpleUnixPathPattern = /^\.{0,2}\//;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
@@ -16,29 +16,22 @@ 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
|
|
20
|
-
__export(
|
|
21
|
-
init_printMigrationId: () => init_printMigrationId,
|
|
19
|
+
var chunk_UP6FVCDK_exports = {};
|
|
20
|
+
__export(chunk_UP6FVCDK_exports, {
|
|
22
21
|
printMigrationId: () => printMigrationId,
|
|
23
22
|
printMigrationIds: () => printMigrationIds
|
|
24
23
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
26
|
-
var
|
|
27
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
24
|
+
module.exports = __toCommonJS(chunk_UP6FVCDK_exports);
|
|
25
|
+
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
28
26
|
function printMigrationId(migrationId) {
|
|
29
27
|
const words = migrationId.split("_");
|
|
30
28
|
if (words.length === 1) {
|
|
31
|
-
return (0,
|
|
29
|
+
return (0, import_chunk_SKRR5WT4.cyan)((0, import_chunk_SKRR5WT4.bold)(migrationId));
|
|
32
30
|
}
|
|
33
|
-
return `${words[0]}_${(0,
|
|
31
|
+
return `${words[0]}_${(0, import_chunk_SKRR5WT4.cyan)((0, import_chunk_SKRR5WT4.bold)(words.slice(1).join("_")))}`;
|
|
34
32
|
}
|
|
35
33
|
function printMigrationIds(migrationIds) {
|
|
36
34
|
return migrationIds.reduce((acc, migrationId) => {
|
|
37
35
|
return acc + "- " + printMigrationId(migrationId) + "\n";
|
|
38
36
|
}, "");
|
|
39
37
|
}
|
|
40
|
-
var init_printMigrationId = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
41
|
-
"src/utils/printMigrationId.ts"() {
|
|
42
|
-
(0, import_chunk_6TE2RIPN.init_colors)();
|
|
43
|
-
}
|
|
44
|
-
});
|
|
@@ -26,17 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_V3ZMNXZC_exports = {};
|
|
30
|
+
__export(chunk_V3ZMNXZC_exports, {
|
|
31
31
|
executeSeedCommand: () => executeSeedCommand,
|
|
32
32
|
getSeedCommandFromPackageJson: () => getSeedCommandFromPackageJson,
|
|
33
|
-
init_seed: () => init_seed,
|
|
34
33
|
legacyTsNodeScriptWarning: () => legacyTsNodeScriptWarning,
|
|
35
34
|
verifySeedConfigAndReturnMessage: () => verifySeedConfigAndReturnMessage
|
|
36
35
|
});
|
|
37
|
-
module.exports = __toCommonJS(
|
|
36
|
+
module.exports = __toCommonJS(chunk_V3ZMNXZC_exports);
|
|
38
37
|
var import_chunk_J46BJQHT = require("./chunk-J46BJQHT.js");
|
|
39
|
-
var
|
|
38
|
+
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
40
39
|
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
41
40
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
42
41
|
var import_internals = require("@prisma/internals");
|
|
@@ -1868,6 +1867,9 @@ var require_pkg_up = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
1868
1867
|
module2.exports.sync = ({ cwd } = {}) => findUp.sync("package.json", { cwd });
|
|
1869
1868
|
}
|
|
1870
1869
|
});
|
|
1870
|
+
var import_execa = (0, import_chunk_WWAWV7DQ.__toESM)(require_execa());
|
|
1871
|
+
var import_pkg_up = (0, import_chunk_WWAWV7DQ.__toESM)(require_pkg_up());
|
|
1872
|
+
var debug = (0, import_debug.default)("prisma:migrate:seed");
|
|
1871
1873
|
async function verifySeedConfigAndReturnMessage(schemaPath) {
|
|
1872
1874
|
const cwd = process.cwd();
|
|
1873
1875
|
const detected = detectSeedFiles(cwd, schemaPath);
|
|
@@ -1876,7 +1878,7 @@ async function verifySeedConfigAndReturnMessage(schemaPath) {
|
|
|
1876
1878
|
return void 0;
|
|
1877
1879
|
}
|
|
1878
1880
|
const packageManager = "npm i -D";
|
|
1879
|
-
let message = `${(0,
|
|
1881
|
+
let message = `${(0, import_chunk_SKRR5WT4.red)(
|
|
1880
1882
|
'To configure seeding in your project you need to add a "prisma.seed" property in your package.json with the command to execute it:'
|
|
1881
1883
|
)}
|
|
1882
1884
|
|
|
@@ -1908,7 +1910,7 @@ If you are using ESM (ECMAScript modules):
|
|
|
1908
1910
|
\`\`\`
|
|
1909
1911
|
|
|
1910
1912
|
3. Install the required dependencies by running:
|
|
1911
|
-
${(0,
|
|
1913
|
+
${(0, import_chunk_SKRR5WT4.green)(`${packageManager} ts-node typescript @types/node`)}
|
|
1912
1914
|
`;
|
|
1913
1915
|
} else if (detected.sh) {
|
|
1914
1916
|
message += `
|
|
@@ -1922,7 +1924,7 @@ And run \`chmod +x ${detected.sh}\` to make it executable.`;
|
|
|
1922
1924
|
} else {
|
|
1923
1925
|
message += `2. Add one of the following examples to your package.json:
|
|
1924
1926
|
|
|
1925
|
-
${(0,
|
|
1927
|
+
${(0, import_chunk_SKRR5WT4.bold)("TypeScript:")}
|
|
1926
1928
|
\`\`\`
|
|
1927
1929
|
"prisma": {
|
|
1928
1930
|
"seed": "ts-node ./prisma/seed.ts"
|
|
@@ -1938,14 +1940,14 @@ If you are using ESM (ECMAScript modules):
|
|
|
1938
1940
|
And install the required dependencies by running:
|
|
1939
1941
|
${packageManager} ts-node typescript @types/node
|
|
1940
1942
|
|
|
1941
|
-
${(0,
|
|
1943
|
+
${(0, import_chunk_SKRR5WT4.bold)("JavaScript:")}
|
|
1942
1944
|
\`\`\`
|
|
1943
1945
|
"prisma": {
|
|
1944
1946
|
"seed": "node ./prisma/seed.js"
|
|
1945
1947
|
}
|
|
1946
1948
|
\`\`\`
|
|
1947
1949
|
|
|
1948
|
-
${(0,
|
|
1950
|
+
${(0, import_chunk_SKRR5WT4.bold)("Bash:")}
|
|
1949
1951
|
\`\`\`
|
|
1950
1952
|
"prisma": {
|
|
1951
1953
|
"seed": "./prisma/seed.sh"
|
|
@@ -1988,7 +1990,7 @@ async function executeSeedCommand({
|
|
|
1988
1990
|
extraArgs
|
|
1989
1991
|
}) {
|
|
1990
1992
|
const command = extraArgs ? `${commandFromConfig} ${extraArgs}` : commandFromConfig;
|
|
1991
|
-
process.stdout.write(`Running seed command \`${(0,
|
|
1993
|
+
process.stdout.write(`Running seed command \`${(0, import_chunk_SKRR5WT4.italic)(command)}\` ...
|
|
1992
1994
|
`);
|
|
1993
1995
|
try {
|
|
1994
1996
|
await import_execa.default.command(command, {
|
|
@@ -1998,9 +2000,9 @@ async function executeSeedCommand({
|
|
|
1998
2000
|
} catch (_e) {
|
|
1999
2001
|
const e = _e;
|
|
2000
2002
|
debug({ e });
|
|
2001
|
-
console.error((0,
|
|
2003
|
+
console.error((0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`
|
|
2002
2004
|
An error occurred while running the seed command:`)));
|
|
2003
|
-
console.error((0,
|
|
2005
|
+
console.error((0, import_chunk_SKRR5WT4.red)(e.stderr || String(e)));
|
|
2004
2006
|
return false;
|
|
2005
2007
|
}
|
|
2006
2008
|
return true;
|
|
@@ -2034,7 +2036,7 @@ async function legacyTsNodeScriptWarning() {
|
|
|
2034
2036
|
const scripts = await getScriptsFromPackageJson();
|
|
2035
2037
|
if (scripts?.["ts-node"]) {
|
|
2036
2038
|
import_internals.logger.warn(
|
|
2037
|
-
(0,
|
|
2039
|
+
(0, import_chunk_SKRR5WT4.yellow)(`The "ts-node" script in the package.json is not used anymore since version 3.0 and can now be removed.`)
|
|
2038
2040
|
);
|
|
2039
2041
|
}
|
|
2040
2042
|
return void 0;
|
|
@@ -2053,12 +2055,3 @@ async function getScriptsFromPackageJson(cwd = process.cwd()) {
|
|
|
2053
2055
|
return null;
|
|
2054
2056
|
}
|
|
2055
2057
|
}
|
|
2056
|
-
var import_execa, import_pkg_up, debug;
|
|
2057
|
-
var init_seed = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
2058
|
-
"src/utils/seed.ts"() {
|
|
2059
|
-
import_execa = (0, import_chunk_WWAWV7DQ.__toESM)(require_execa());
|
|
2060
|
-
(0, import_chunk_6TE2RIPN.init_colors)();
|
|
2061
|
-
import_pkg_up = (0, import_chunk_WWAWV7DQ.__toESM)(require_pkg_up());
|
|
2062
|
-
debug = (0, import_debug.default)("prisma:migrate:seed");
|
|
2063
|
-
}
|
|
2064
|
-
});
|