@prisma/migrate 7.10.0-dev.9 → 7.10.0-integration-fix-prisma-publish-token.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Migrate.js +4 -4
- package/dist/SchemaEngineCLI.js +4 -4
- package/dist/SchemaEngineWasm.js +4 -4
- package/dist/bin.js +42 -36
- package/dist/{chunk-CQTYRADU.js → chunk-2WAUT755.js} +24 -19
- package/dist/{chunk-FXSCTGN2.js → chunk-3C5DQOOW.js} +5 -5
- package/dist/{chunk-XTEEOIUV.js → chunk-3DR7R72S.js} +19 -14
- package/dist/{chunk-HWBQGGZH.js → chunk-3NKLI5KP.js} +9 -9
- package/dist/{chunk-6TSRRBNA.js → chunk-57S5K3DX.js} +7 -7
- package/dist/{chunk-7CQBDP4H.js → chunk-6F7CAPL7.js} +9 -10
- package/dist/{chunk-TDN3QQTH.js → chunk-6V2VYU3A.js} +30 -25
- package/dist/{chunk-TW5MYPTK.js → chunk-6W7GTZYX.js} +27 -22
- package/dist/{chunk-GBUW4I6U.js → chunk-7KCEXIB2.js} +6 -6
- package/dist/{chunk-TEOIOJ7P.js → chunk-A6PUWLVN.js} +6 -6
- package/dist/{chunk-LZ2DWYUY.js → chunk-BWFPKWBD.js} +7 -7
- package/dist/{chunk-6EQA63NM.js → chunk-D7N4YVZS.js} +39 -33
- package/dist/{chunk-DPRQXN36.js → chunk-DTSU3YZP.js} +6 -6
- package/dist/{chunk-WA2SOLDQ.js → chunk-EGNBSKBG.js} +8 -8
- package/dist/{chunk-DNNMOG7A.js → chunk-F2LZOLZK.js} +25 -24
- package/dist/{chunk-PPE4XDUL.js → chunk-GD52HTMX.js} +10 -10
- package/dist/{chunk-2HCAA4GX.js → chunk-GHPP2B5T.js} +27 -23
- package/dist/{chunk-RM4WK3ML.js → chunk-I7UMFS37.js} +33 -26
- package/dist/{chunk-NGEWTXY6.js → chunk-J6BC6QDB.js} +6 -6
- package/dist/{chunk-6DDIA3ZD.js → chunk-KDAXJMEP.js} +5 -5
- package/dist/{chunk-ZUHJASAP.js → chunk-KYZDCMJW.js} +12 -12
- package/dist/{chunk-UA3FFRRV.js → chunk-NSQ3NTDD.js} +26 -20
- package/dist/{chunk-VEBRKA5H.js → chunk-OQKFK65J.js} +6 -6
- package/dist/{chunk-YNB3IN6Q.js → chunk-OXZFIZV6.js} +8 -8
- package/dist/{chunk-WP5M3D4N.js → chunk-PCCMNZGX.js} +31 -28
- package/dist/{chunk-QCPYZUFF.js → chunk-RRKGNIXU.js} +34 -32
- package/dist/{chunk-THJ7K72W.js → chunk-SFFTVLXC.js} +6 -6
- package/dist/{chunk-AL3XYISJ.js → chunk-SUVNEDA5.js} +56 -51
- package/dist/{chunk-PEUHUCS4.js → chunk-T25WPL3D.js} +632 -625
- package/dist/{chunk-NHSJJSXU.js → chunk-TKQMAG6L.js} +5 -5
- package/dist/{chunk-DL2W77GY.js → chunk-TY3ROQOX.js} +34 -31
- package/dist/{chunk-RGXJYLMD.js → chunk-ZOYXSZ2J.js} +5 -5
- package/dist/{chunk-INC5VUX4.js → chunk-ZVRF2A5M.js} +6 -6
- package/dist/commands/DbCommand.js +2 -2
- package/dist/commands/DbDrop.js +3 -3
- package/dist/commands/DbExecute.js +5 -5
- package/dist/commands/DbPull.js +6 -6
- package/dist/commands/DbPush.js +6 -6
- package/dist/commands/DbSeed.js +2 -2
- package/dist/commands/MigrateCommand.js +2 -2
- package/dist/commands/MigrateDeploy.js +5 -5
- package/dist/commands/MigrateDev.js +7 -7
- package/dist/commands/MigrateDiff.js +6 -6
- package/dist/commands/MigrateReset.js +6 -6
- package/dist/commands/MigrateResolve.js +5 -5
- package/dist/commands/MigrateStatus.js +5 -5
- package/dist/commands/db-command-completion.js +2 -2
- package/dist/commands/db-execute-completion.js +2 -2
- package/dist/commands/db-pull-completion.js +2 -2
- package/dist/commands/db-push-completion.js +2 -2
- package/dist/commands/db-seed-completion.js +2 -2
- package/dist/commands/migrate-command-completion.js +2 -2
- package/dist/commands/migrate-deploy-completion.js +2 -2
- package/dist/commands/migrate-dev-completion.js +2 -2
- package/dist/commands/migrate-diff-completion.js +2 -2
- package/dist/commands/migrate-reset-completion.js +2 -2
- package/dist/commands/migrate-resolve-completion.js +2 -2
- package/dist/commands/migrate-status-completion.js +2 -2
- package/dist/index.js +63 -63
- package/dist/src/commands/DbCommand.d.ts +2 -2
- package/dist/src/commands/DbDrop.d.ts +3 -2
- package/dist/src/commands/DbExecute.d.ts +3 -2
- package/dist/src/commands/DbPull.d.ts +3 -2
- package/dist/src/commands/DbPush.d.ts +3 -2
- package/dist/src/commands/DbSeed.d.ts +3 -2
- package/dist/src/commands/MigrateCommand.d.ts +2 -2
- package/dist/src/commands/MigrateDeploy.d.ts +3 -2
- package/dist/src/commands/MigrateDev.d.ts +3 -2
- package/dist/src/commands/MigrateDiff.d.ts +3 -2
- package/dist/src/commands/MigrateReset.d.ts +3 -2
- package/dist/src/commands/MigrateResolve.d.ts +3 -2
- package/dist/src/commands/MigrateStatus.d.ts +3 -2
- package/dist/src/commands/db-command-completion.d.ts +1 -1
- package/dist/src/commands/db-execute-completion.d.ts +1 -1
- package/dist/src/commands/db-pull-completion.d.ts +1 -1
- package/dist/src/commands/db-push-completion.d.ts +1 -1
- package/dist/src/commands/db-seed-completion.d.ts +1 -1
- package/dist/src/commands/migrate-command-completion.d.ts +1 -1
- package/dist/src/commands/migrate-deploy-completion.d.ts +1 -1
- package/dist/src/commands/migrate-dev-completion.d.ts +1 -1
- package/dist/src/commands/migrate-diff-completion.d.ts +1 -1
- package/dist/src/commands/migrate-reset-completion.d.ts +1 -1
- package/dist/src/commands/migrate-resolve-completion.d.ts +1 -1
- package/dist/src/commands/migrate-status-completion.d.ts +1 -1
- package/dist/src/utils/errors.d.ts +4 -4
- package/dist/src/utils/handleEvaluateDataloss.d.ts +1 -1
- package/dist/utils/errors.js +8 -8
- package/dist/utils/getDatabaseVersionSafe.js +5 -5
- package/dist/utils/handleEvaluateDataloss.js +2 -2
- package/dist/utils/introspectSql.js +5 -5
- package/dist/utils/setupMSSQL.js +142 -56
- package/dist/views/handleViewsIO.js +2 -2
- package/package.json +12 -12
|
@@ -26,23 +26,24 @@ 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_RRKGNIXU_exports = {};
|
|
30
|
+
__export(chunk_RRKGNIXU_exports, {
|
|
31
31
|
DbExecute: () => DbExecute
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_RRKGNIXU_exports);
|
|
34
|
+
var import_chunk_ZOYXSZ2J = require("./chunk-ZOYXSZ2J.js");
|
|
35
35
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
36
36
|
var import_consumers = __toESM(require("node:stream/consumers"));
|
|
37
37
|
var import_internals = require("@prisma/internals");
|
|
38
38
|
var import_fs = __toESM(require("fs"));
|
|
39
39
|
var import_path = __toESM(require("path"));
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
function renderHelpOptions(cliCommand) {
|
|
41
|
+
return (0, import_internals.format)(
|
|
42
|
+
`${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
42
43
|
|
|
43
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
44
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db execute [options]
|
|
44
45
|
|
|
45
|
-
The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("
|
|
46
|
+
The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma7.config.ts")}).
|
|
46
47
|
|
|
47
48
|
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
48
49
|
|
|
@@ -55,18 +56,13 @@ ${(0, import_chunk_SKRR5WT4.italic)("Script input, only 1 must be provided:")}
|
|
|
55
56
|
${(0, import_chunk_SKRR5WT4.bold)("Flags")}
|
|
56
57
|
|
|
57
58
|
--stdin Use the terminal standard input as the script to be executed`
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
// TODO: This command needs to get proper support for `prisma.config.ts` eventually. Not just taking the schema path
|
|
64
|
-
// from prisma.config.ts but likely to support driver adapters, too?
|
|
65
|
-
// See https://linear.app/prisma-company/issue/ORM-639/prisma-db-execute-support-prismaconfigts-and-driver-adapters
|
|
66
|
-
static help = (0, import_internals.format)(`
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
function renderHelp(cliCommand) {
|
|
62
|
+
return (0, import_internals.format)(`
|
|
67
63
|
${process.platform === "win32" ? "" : "\u{1F4DD} "}Execute native commands to your database
|
|
68
64
|
|
|
69
|
-
This command takes as input a datasource defined in ${(0, import_chunk_SKRR5WT4.italic)("
|
|
65
|
+
This command takes as input a datasource defined in ${(0, import_chunk_SKRR5WT4.italic)("prisma7.config.ts")} and a script, using ${(0, import_chunk_SKRR5WT4.green)(
|
|
70
66
|
`--stdin`
|
|
71
67
|
)} or ${(0, import_chunk_SKRR5WT4.green)(`--file`)}.
|
|
72
68
|
The script input parameters are mutually exclusive, only 1 must be provided.
|
|
@@ -78,17 +74,23 @@ The whole script will be sent as a single command to the database.
|
|
|
78
74
|
|
|
79
75
|
${(0, import_chunk_SKRR5WT4.italic)(`This command is currently not supported on MongoDB.`)}
|
|
80
76
|
|
|
81
|
-
${
|
|
77
|
+
${renderHelpOptions(cliCommand)}
|
|
82
78
|
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
83
79
|
|
|
84
|
-
Execute the content of a SQL script file using the datasource configured in
|
|
85
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
80
|
+
Execute the content of a SQL script file using the datasource configured in prisma7.config.ts
|
|
81
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db execute --file ./script.sql
|
|
86
82
|
|
|
87
83
|
Execute the SQL script from stdin using the configured datasource
|
|
88
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' |
|
|
89
|
-
prisma db execute \\
|
|
90
|
-
--stdin
|
|
84
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | ${cliCommand} db execute --stdin
|
|
91
85
|
`);
|
|
86
|
+
}
|
|
87
|
+
var DbExecute = class _DbExecute {
|
|
88
|
+
constructor(cliCommand) {
|
|
89
|
+
this.cliCommand = cliCommand;
|
|
90
|
+
}
|
|
91
|
+
static new(cliCommand) {
|
|
92
|
+
return new _DbExecute(cliCommand);
|
|
93
|
+
}
|
|
92
94
|
async parse(argv, config, baseDir) {
|
|
93
95
|
const args = (0, import_internals.arg)(
|
|
94
96
|
argv,
|
|
@@ -108,17 +110,17 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
108
110
|
if (args["--help"]) {
|
|
109
111
|
return this.help();
|
|
110
112
|
}
|
|
111
|
-
const cmd =
|
|
112
|
-
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config, cmd });
|
|
113
|
+
const cmd = `${this.cliCommand} db execute`;
|
|
114
|
+
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config, command: cmd });
|
|
113
115
|
if (args["--stdin"] && args["--file"]) {
|
|
114
116
|
throw new Error(
|
|
115
117
|
`--stdin and --file cannot be used at the same time. Only 1 must be provided.
|
|
116
|
-
See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
118
|
+
See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} db execute -h`))}\``
|
|
117
119
|
);
|
|
118
120
|
} else if (!args["--stdin"] && !args["--file"]) {
|
|
119
121
|
throw new Error(
|
|
120
122
|
`Either --stdin or --file must be provided.
|
|
121
|
-
See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
123
|
+
See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} db execute -h`))}\``
|
|
122
124
|
);
|
|
123
125
|
}
|
|
124
126
|
let script = "";
|
|
@@ -137,12 +139,12 @@ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExec
|
|
|
137
139
|
if (args["--stdin"]) {
|
|
138
140
|
script = await import_consumers.default.text(process.stdin);
|
|
139
141
|
}
|
|
140
|
-
(0, import_internals.checkUnsupportedDataProxy)({ cmd, validatedConfig });
|
|
142
|
+
(0, import_internals.checkUnsupportedDataProxy)({ command: cmd, validatedConfig });
|
|
141
143
|
const datasourceType = {
|
|
142
144
|
tag: "url",
|
|
143
145
|
url: validatedConfig.datasource.url
|
|
144
146
|
};
|
|
145
|
-
const migrate = await
|
|
147
|
+
const migrate = await import_chunk_ZOYXSZ2J.Migrate.setup({
|
|
146
148
|
schemaEngineConfig: config,
|
|
147
149
|
extensions: config["extensions"],
|
|
148
150
|
baseDir
|
|
@@ -162,8 +164,8 @@ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExec
|
|
|
162
164
|
throw new import_internals.HelpError(`
|
|
163
165
|
${error}
|
|
164
166
|
|
|
165
|
-
${
|
|
167
|
+
${renderHelpOptions(this.cliCommand)}`);
|
|
166
168
|
}
|
|
167
|
-
return
|
|
169
|
+
return renderHelp(this.cliCommand);
|
|
168
170
|
}
|
|
169
171
|
};
|
|
@@ -16,18 +16,18 @@ 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(
|
|
19
|
+
var chunk_SFFTVLXC_exports = {};
|
|
20
|
+
__export(chunk_SFFTVLXC_exports, {
|
|
21
21
|
dbSeedCompletion: () => dbSeedCompletion
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_SFFTVLXC_exports);
|
|
24
|
+
var import_internals = require("@prisma/internals");
|
|
25
25
|
var dbSeedCompletion = {
|
|
26
26
|
name: "db seed",
|
|
27
27
|
description: "Seed your database",
|
|
28
28
|
options: [
|
|
29
29
|
{ name: "help", alias: "h", description: "Display this help message" },
|
|
30
|
-
{ name: "schema", description: "Custom path to your Prisma schema", values:
|
|
31
|
-
{ name: "config", description: "Custom path to your Prisma config file", values:
|
|
30
|
+
{ name: "schema", description: "Custom path to your Prisma schema", values: import_internals.completionSchemaPaths },
|
|
31
|
+
{ name: "config", description: "Custom path to your Prisma config file", values: import_internals.completionConfigPaths }
|
|
32
32
|
]
|
|
33
33
|
};
|
|
@@ -16,35 +16,32 @@ 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(
|
|
19
|
+
var chunk_SUVNEDA5_exports = {};
|
|
20
|
+
__export(chunk_SUVNEDA5_exports, {
|
|
21
21
|
MigrateResolve: () => MigrateResolve
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(chunk_SUVNEDA5_exports);
|
|
24
24
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
25
25
|
var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
|
|
26
|
-
var
|
|
26
|
+
var import_chunk_ZOYXSZ2J = require("./chunk-ZOYXSZ2J.js");
|
|
27
27
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
28
28
|
var import_internals = require("@prisma/internals");
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return new _MigrateResolve();
|
|
32
|
-
}
|
|
33
|
-
static help = (0, import_internals.format)(`
|
|
29
|
+
function renderHelp(cliCommand) {
|
|
30
|
+
return (0, import_internals.format)(`
|
|
34
31
|
Resolve issues with database migrations in deployment databases:
|
|
35
32
|
- recover from failed migrations
|
|
36
33
|
- baseline databases when starting to use Prisma Migrate on existing databases
|
|
37
34
|
- reconcile hotfixes done manually on databases with your migration history
|
|
38
35
|
|
|
39
|
-
Run "
|
|
36
|
+
Run "${cliCommand} migrate status" to identify if you need to use resolve.
|
|
40
37
|
|
|
41
38
|
Read more about resolving migration history issues: ${(0, import_internals.link)("https://pris.ly/d/migrate-resolve")}
|
|
42
39
|
|
|
43
40
|
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
44
41
|
|
|
45
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
42
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate resolve [options]
|
|
46
43
|
|
|
47
|
-
The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("
|
|
44
|
+
The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma7.config.ts")}).
|
|
48
45
|
|
|
49
46
|
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
50
47
|
|
|
@@ -57,14 +54,22 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
|
57
54
|
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
58
55
|
|
|
59
56
|
Update migrations table, recording a specific migration as applied
|
|
60
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
57
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate resolve --applied 20201231000000_add_users_table
|
|
61
58
|
|
|
62
59
|
Update migrations table, recording a specific migration as rolled back
|
|
63
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
60
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate resolve --rolled-back 20201231000000_add_users_table
|
|
64
61
|
|
|
65
62
|
Specify a schema
|
|
66
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
63
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate resolve --rolled-back 20201231000000_add_users_table --schema=./schema.prisma
|
|
67
64
|
`);
|
|
65
|
+
}
|
|
66
|
+
var MigrateResolve = class _MigrateResolve {
|
|
67
|
+
constructor(cliCommand) {
|
|
68
|
+
this.cliCommand = cliCommand;
|
|
69
|
+
}
|
|
70
|
+
static new(cliCommand) {
|
|
71
|
+
return new _MigrateResolve(cliCommand);
|
|
72
|
+
}
|
|
68
73
|
async parse(argv, config, baseDir) {
|
|
69
74
|
const args = (0, import_internals.arg)(
|
|
70
75
|
argv,
|
|
@@ -93,15 +98,15 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
93
98
|
})
|
|
94
99
|
});
|
|
95
100
|
const { migrationsDirPath } = (0, import_internals.inferDirectoryConfig)(schemaContext, config);
|
|
96
|
-
const cmd =
|
|
97
|
-
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config, cmd });
|
|
98
|
-
(0, import_internals.checkUnsupportedDataProxy)({ cmd, validatedConfig });
|
|
101
|
+
const cmd = `${this.cliCommand} migrate resolve`;
|
|
102
|
+
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config, command: cmd });
|
|
103
|
+
(0, import_internals.checkUnsupportedDataProxy)({ command: cmd, validatedConfig });
|
|
99
104
|
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: (0, import_chunk_BRPS327A.parseDatasourceInfo)(schemaContext.primaryDatasource, validatedConfig) });
|
|
100
105
|
if (!args["--applied"] && !args["--rolled-back"]) {
|
|
101
106
|
throw new Error(
|
|
102
107
|
`--applied or --rolled-back must be part of the command like:
|
|
103
|
-
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
104
|
-
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
108
|
+
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} migrate resolve --applied 20201231000000_example`)))}
|
|
109
|
+
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} migrate resolve --rolled-back 20201231000000_example`)))}`
|
|
105
110
|
);
|
|
106
111
|
} else if (args["--applied"] && args["--rolled-back"]) {
|
|
107
112
|
throw new Error("Pass either --applied or --rolled-back, not both.");
|
|
@@ -110,12 +115,12 @@ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_in
|
|
|
110
115
|
if (typeof args["--applied"] !== "string" || args["--applied"].length === 0) {
|
|
111
116
|
throw new Error(
|
|
112
117
|
`--applied value must be a string like ${(0, import_chunk_SKRR5WT4.bold)(
|
|
113
|
-
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
118
|
+
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} migrate resolve --applied 20201231000000_example`))
|
|
114
119
|
)}`
|
|
115
120
|
);
|
|
116
121
|
}
|
|
117
122
|
await (0, import_chunk_BRPS327A.ensureCanConnectToDatabase)(baseDir, validatedConfig);
|
|
118
|
-
const
|
|
123
|
+
const migrate2 = await import_chunk_ZOYXSZ2J.Migrate.setup({
|
|
119
124
|
schemaEngineConfig: config,
|
|
120
125
|
baseDir,
|
|
121
126
|
migrationsDirPath,
|
|
@@ -123,51 +128,51 @@ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_in
|
|
|
123
128
|
extensions: config["extensions"]
|
|
124
129
|
});
|
|
125
130
|
try {
|
|
126
|
-
await
|
|
131
|
+
await migrate2.markMigrationApplied({
|
|
127
132
|
migrationId: args["--applied"]
|
|
128
133
|
});
|
|
129
134
|
} finally {
|
|
130
|
-
await
|
|
135
|
+
await migrate2.stop();
|
|
131
136
|
}
|
|
132
137
|
process.stdout.write(`
|
|
133
138
|
Migration ${args["--applied"]} marked as applied.
|
|
134
139
|
`);
|
|
135
140
|
return ``;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
141
|
+
}
|
|
142
|
+
if (typeof args["--rolled-back"] !== "string" || args["--rolled-back"].length === 0) {
|
|
143
|
+
throw new Error(
|
|
144
|
+
`--rolled-back value must be a string like ${(0, import_chunk_SKRR5WT4.bold)(
|
|
145
|
+
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} migrate resolve --rolled-back 20201231000000_example`))
|
|
146
|
+
)}`
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
await (0, import_chunk_BRPS327A.ensureCanConnectToDatabase)(baseDir, validatedConfig);
|
|
150
|
+
const migrate = await import_chunk_ZOYXSZ2J.Migrate.setup({
|
|
151
|
+
schemaEngineConfig: config,
|
|
152
|
+
baseDir,
|
|
153
|
+
migrationsDirPath,
|
|
154
|
+
schemaContext,
|
|
155
|
+
extensions: config["extensions"]
|
|
156
|
+
});
|
|
157
|
+
try {
|
|
158
|
+
await migrate.markMigrationRolledBack({
|
|
159
|
+
migrationId: args["--rolled-back"]
|
|
151
160
|
});
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
} finally {
|
|
157
|
-
await migrate.stop();
|
|
158
|
-
}
|
|
159
|
-
process.stdout.write(`
|
|
161
|
+
} finally {
|
|
162
|
+
await migrate.stop();
|
|
163
|
+
}
|
|
164
|
+
process.stdout.write(`
|
|
160
165
|
Migration ${args["--rolled-back"]} marked as rolled back.
|
|
161
166
|
`);
|
|
162
|
-
|
|
163
|
-
}
|
|
167
|
+
return ``;
|
|
164
168
|
}
|
|
165
169
|
help(error) {
|
|
170
|
+
const help = renderHelp(this.cliCommand);
|
|
166
171
|
if (error) {
|
|
167
172
|
return new import_internals.HelpError(`
|
|
168
173
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
169
|
-
${
|
|
174
|
+
${help}`);
|
|
170
175
|
}
|
|
171
|
-
return
|
|
176
|
+
return help;
|
|
172
177
|
}
|
|
173
178
|
};
|