@prisma/migrate 7.10.0-dev.9 → 7.10.0-integration-prisma7-project-closeout.10
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 +41 -35
- package/dist/{chunk-FXSCTGN2.js → chunk-3C5DQOOW.js} +5 -5
- package/dist/{chunk-HWBQGGZH.js → chunk-3NKLI5KP.js} +9 -9
- package/dist/{chunk-6TSRRBNA.js → chunk-57S5K3DX.js} +7 -7
- package/dist/{chunk-UA3FFRRV.js → chunk-5YSI4XSU.js} +25 -19
- package/dist/{chunk-7CQBDP4H.js → chunk-6F7CAPL7.js} +9 -10
- 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-QCPYZUFF.js → chunk-BZ2JSF42.js} +31 -29
- 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-XTEEOIUV.js → chunk-HMVLLUKH.js} +18 -13
- package/dist/{chunk-WP5M3D4N.js → chunk-I3UQXXYF.js} +30 -27
- package/dist/{chunk-RM4WK3ML.js → chunk-I7UMFS37.js} +33 -26
- package/dist/{chunk-CQTYRADU.js → chunk-IKF6HBHH.js} +23 -18
- 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-AL3XYISJ.js → chunk-MQ76MQ53.js} +55 -50
- package/dist/{chunk-VEBRKA5H.js → chunk-OQKFK65J.js} +6 -6
- package/dist/{chunk-YNB3IN6Q.js → chunk-OXZFIZV6.js} +8 -8
- package/dist/{chunk-THJ7K72W.js → chunk-SFFTVLXC.js} +6 -6
- package/dist/{chunk-PEUHUCS4.js → chunk-T25WPL3D.js} +632 -625
- package/dist/{chunk-NHSJJSXU.js → chunk-TKQMAG6L.js} +5 -5
- package/dist/{chunk-6EQA63NM.js → chunk-UWVWZK5Z.js} +38 -32
- package/dist/{chunk-TW5MYPTK.js → chunk-VJKZQVKX.js} +26 -21
- package/dist/{chunk-DL2W77GY.js → chunk-W4WHE5HS.js} +33 -30
- package/dist/{chunk-TDN3QQTH.js → chunk-Y3QVFDLE.js} +29 -24
- 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,29 +26,26 @@ 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_IKF6HBHH_exports = {};
|
|
30
|
+
__export(chunk_IKF6HBHH_exports, {
|
|
31
31
|
MigrateDeploy: () => MigrateDeploy
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_IKF6HBHH_exports);
|
|
34
34
|
var import_chunk_G222ME3D = require("./chunk-G222ME3D.js");
|
|
35
35
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
36
36
|
var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
|
|
37
|
-
var
|
|
37
|
+
var import_chunk_ZOYXSZ2J = require("./chunk-ZOYXSZ2J.js");
|
|
38
38
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
39
39
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
40
40
|
var import_internals = require("@prisma/internals");
|
|
41
41
|
var debug = (0, import_debug.default)("prisma:migrate:deploy");
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return new _MigrateDeploy();
|
|
45
|
-
}
|
|
46
|
-
static help = (0, import_internals.format)(`
|
|
42
|
+
function renderHelp(cliCommand) {
|
|
43
|
+
return (0, import_internals.format)(`
|
|
47
44
|
Apply pending migrations to update the database schema in production/staging
|
|
48
45
|
|
|
49
46
|
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
50
47
|
|
|
51
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
48
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate deploy [options]
|
|
52
49
|
|
|
53
50
|
The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma.config.ts")}).
|
|
54
51
|
|
|
@@ -61,12 +58,20 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
|
61
58
|
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
62
59
|
|
|
63
60
|
Deploy your pending migrations to your production/staging database
|
|
64
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
61
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate deploy
|
|
65
62
|
|
|
66
63
|
Specify a schema
|
|
67
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
64
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate deploy --schema=./schema.prisma
|
|
68
65
|
|
|
69
66
|
`);
|
|
67
|
+
}
|
|
68
|
+
var MigrateDeploy = class _MigrateDeploy {
|
|
69
|
+
constructor(cliCommand) {
|
|
70
|
+
this.cliCommand = cliCommand;
|
|
71
|
+
}
|
|
72
|
+
static new(cliCommand) {
|
|
73
|
+
return new _MigrateDeploy(cliCommand);
|
|
74
|
+
}
|
|
70
75
|
async parse(argv, config, baseDir) {
|
|
71
76
|
const args = (0, import_internals.arg)(
|
|
72
77
|
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 deploy`;
|
|
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
|
const schemaFilter = {
|
|
101
106
|
externalTables: config.tables?.external ?? [],
|
|
102
107
|
externalEnums: config.enums?.external ?? []
|
|
103
108
|
};
|
|
104
|
-
const migrate = await
|
|
109
|
+
const migrate = await import_chunk_ZOYXSZ2J.Migrate.setup({
|
|
105
110
|
schemaEngineConfig: config,
|
|
106
111
|
baseDir,
|
|
107
112
|
migrationsDirPath,
|
|
@@ -164,8 +169,8 @@ ${(0, import_chunk_SKRR5WT4.green)("All migrations have been successfully applie
|
|
|
164
169
|
if (error) {
|
|
165
170
|
return new import_internals.HelpError(`
|
|
166
171
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
167
|
-
${
|
|
172
|
+
${renderHelp(this.cliCommand)}`);
|
|
168
173
|
}
|
|
169
|
-
return
|
|
174
|
+
return renderHelp(this.cliCommand);
|
|
170
175
|
}
|
|
171
176
|
};
|
|
@@ -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_J6BC6QDB_exports = {};
|
|
20
|
+
__export(chunk_J6BC6QDB_exports, {
|
|
21
21
|
migrateCompletion: () => migrateCompletion
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_J6BC6QDB_exports);
|
|
24
|
+
var import_internals = require("@prisma/internals");
|
|
25
25
|
var migrateCompletion = {
|
|
26
26
|
name: "migrate",
|
|
27
27
|
description: "Migrate your database",
|
|
28
28
|
options: [
|
|
29
29
|
{ name: "help", alias: "h", description: "Display this help message" },
|
|
30
|
-
{ name: "config", description: "Custom path to your Prisma config file", values:
|
|
31
|
-
{ name: "schema", description: "Custom path to your Prisma schema", values:
|
|
30
|
+
{ name: "config", description: "Custom path to your Prisma config file", values: import_internals.completionConfigPaths },
|
|
31
|
+
{ name: "schema", description: "Custom path to your Prisma schema", values: import_internals.completionSchemaPaths }
|
|
32
32
|
]
|
|
33
33
|
};
|
|
@@ -26,13 +26,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_KDAXJMEP_exports = {};
|
|
30
|
+
__export(chunk_KDAXJMEP_exports, {
|
|
31
31
|
EngineError: () => EngineError,
|
|
32
32
|
SchemaEngineCLI: () => SchemaEngineCLI
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
35
|
-
var
|
|
34
|
+
module.exports = __toCommonJS(chunk_KDAXJMEP_exports);
|
|
35
|
+
var import_chunk_T25WPL3D = require("./chunk-T25WPL3D.js");
|
|
36
36
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
37
37
|
var import_node_readline = __toESM(require("node:readline"));
|
|
38
38
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
@@ -187,7 +187,7 @@ var SchemaEngineCLI = class _SchemaEngineCLI {
|
|
|
187
187
|
);
|
|
188
188
|
const { views } = introspectResult;
|
|
189
189
|
if (views) {
|
|
190
|
-
await (0,
|
|
190
|
+
await (0, import_chunk_T25WPL3D.handleViewsIO)({ views, viewsDirectoryPath });
|
|
191
191
|
}
|
|
192
192
|
return introspectResult;
|
|
193
193
|
} finally {
|
|
@@ -16,8 +16,8 @@ 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_KYZDCMJW_exports = {};
|
|
20
|
+
__export(chunk_KYZDCMJW_exports, {
|
|
21
21
|
ConfigValidationError: () => ConfigValidationError,
|
|
22
22
|
DbDropNeedsForceError: () => DbDropNeedsForceError,
|
|
23
23
|
DbPushIgnoreWarningsWithFlagError: () => DbPushIgnoreWarningsWithFlagError,
|
|
@@ -26,7 +26,7 @@ __export(chunk_ZUHJASAP_exports, {
|
|
|
26
26
|
MigrateResetEnvNonInteractiveError: () => MigrateResetEnvNonInteractiveError,
|
|
27
27
|
NoSchemaFoundError: () => NoSchemaFoundError
|
|
28
28
|
});
|
|
29
|
-
module.exports = __toCommonJS(
|
|
29
|
+
module.exports = __toCommonJS(chunk_KYZDCMJW_exports);
|
|
30
30
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
31
31
|
var import_internals = require("@prisma/internals");
|
|
32
32
|
var ConfigValidationError = class extends Error {
|
|
@@ -51,20 +51,20 @@ You can either provide it with ${(0, import_chunk_SKRR5WT4.green)(
|
|
|
51
51
|
};
|
|
52
52
|
(0, import_internals.setClassName)(NoSchemaFoundError, "NoSchemaFoundError");
|
|
53
53
|
var DbPushIgnoreWarningsWithFlagError = class extends Error {
|
|
54
|
-
constructor() {
|
|
54
|
+
constructor(cliCommand) {
|
|
55
55
|
super(
|
|
56
56
|
`Use the --accept-data-loss flag to ignore the data loss warnings like ${(0, import_chunk_SKRR5WT4.bold)(
|
|
57
|
-
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
57
|
+
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${cliCommand} db push --accept-data-loss`))
|
|
58
58
|
)}`
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
(0, import_internals.setClassName)(DbPushIgnoreWarningsWithFlagError, "DbPushIgnoreWarningsWithFlagError");
|
|
63
63
|
var MigrateNeedsForceError = class extends Error {
|
|
64
|
-
constructor(subcommand) {
|
|
64
|
+
constructor(subcommand, cliCommand) {
|
|
65
65
|
super(
|
|
66
66
|
`Use the --force flag to use the ${subcommand} command in an unattended environment like ${(0, import_chunk_SKRR5WT4.bold)(
|
|
67
|
-
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
67
|
+
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${cliCommand} migrate ${subcommand} --force`))
|
|
68
68
|
)}`
|
|
69
69
|
);
|
|
70
70
|
}
|
|
@@ -82,22 +82,22 @@ See ${(0, import_internals.link)("https://pris.ly/d/migrate-reset")}`
|
|
|
82
82
|
};
|
|
83
83
|
(0, import_internals.setClassName)(MigrateResetEnvNonInteractiveError, "MigrateResetEnvNonInteractiveError");
|
|
84
84
|
var MigrateDevEnvNonInteractiveError = class extends Error {
|
|
85
|
-
constructor() {
|
|
85
|
+
constructor(cliCommand) {
|
|
86
86
|
super(
|
|
87
87
|
`Prisma Migrate has detected that the environment is non-interactive, which is not supported.
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
To apply existing migrations in deployments, use ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)(
|
|
89
|
+
\`${cliCommand} migrate dev\` is an interactive command designed to create new migrations and evolve the database in development.
|
|
90
|
+
To apply existing migrations in deployments, use ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${cliCommand} migrate deploy`)))}.
|
|
91
91
|
See ${(0, import_internals.link)("https://pris.ly/d/migrate-deploy")}`
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
(0, import_internals.setClassName)(MigrateDevEnvNonInteractiveError, "MigrateDevEnvNonInteractiveError");
|
|
96
96
|
var DbDropNeedsForceError = class extends Error {
|
|
97
|
-
constructor(subcommand) {
|
|
97
|
+
constructor(subcommand, cliCommand) {
|
|
98
98
|
super(
|
|
99
99
|
`Use the --force flag to use the ${subcommand} command in an unattended environment like ${(0, import_chunk_SKRR5WT4.bold)(
|
|
100
|
-
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
100
|
+
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${cliCommand} db ${subcommand} --force --preview-feature`))
|
|
101
101
|
)}`
|
|
102
102
|
);
|
|
103
103
|
}
|
|
@@ -16,33 +16,30 @@ 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_MQ76MQ53_exports = {};
|
|
20
|
+
__export(chunk_MQ76MQ53_exports, {
|
|
21
21
|
MigrateResolve: () => MigrateResolve
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(chunk_MQ76MQ53_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
44
|
The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma.config.ts")}).
|
|
48
45
|
|
|
@@ -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
|
};
|
|
@@ -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_OQKFK65J_exports = {};
|
|
20
|
+
__export(chunk_OQKFK65J_exports, {
|
|
21
21
|
migrateStatusCompletion: () => migrateStatusCompletion
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_OQKFK65J_exports);
|
|
24
|
+
var import_internals = require("@prisma/internals");
|
|
25
25
|
var migrateStatusCompletion = {
|
|
26
26
|
name: "migrate status",
|
|
27
27
|
description: "Check the status of your database migrations",
|
|
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,25 +16,25 @@ 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_OXZFIZV6_exports = {};
|
|
20
|
+
__export(chunk_OXZFIZV6_exports, {
|
|
21
21
|
migrateDevCompletion: () => migrateDevCompletion
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_OXZFIZV6_exports);
|
|
24
|
+
var import_internals = require("@prisma/internals");
|
|
25
25
|
var migrateDevCompletion = {
|
|
26
26
|
name: "migrate dev",
|
|
27
27
|
description: "Create and apply migrations in development",
|
|
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
|
name: "url",
|
|
34
34
|
description: "Override the datasource URL from the Prisma config file",
|
|
35
|
-
values:
|
|
35
|
+
values: import_internals.completionDatasourceUrls
|
|
36
36
|
},
|
|
37
|
-
{ name: "name", alias: "n", description: "Name the migration", values:
|
|
37
|
+
{ name: "name", alias: "n", description: "Name the migration", values: import_internals.completionMigrationNames },
|
|
38
38
|
{ name: "create-only", description: "Create a new migration but do not apply it" }
|
|
39
39
|
]
|
|
40
40
|
};
|
|
@@ -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
|
};
|