@prisma/migrate 7.10.0-dev.49 → 7.10.0-dev.58
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/bin.js +37 -31
- package/dist/{chunk-DP52MO7V.js → chunk-2WAUT755.js} +22 -17
- 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-P5L7E4AA.js → chunk-6V2VYU3A.js} +28 -23
- package/dist/{chunk-ZICOD27L.js → chunk-6W7GTZYX.js} +25 -20
- package/dist/{chunk-GBUW4I6U.js → chunk-7KCEXIB2.js} +6 -6
- package/dist/{chunk-TEOIOJ7P.js → chunk-A6PUWLVN.js} +6 -6
- package/dist/{chunk-2MKUVRMY.js → chunk-D7N4YVZS.js} +36 -31
- 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-DIBAT4TU.js → chunk-I7UMFS37.js} +31 -24
- package/dist/{chunk-NGEWTXY6.js → chunk-J6BC6QDB.js} +6 -6
- 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-ESJU6GOY.js → chunk-PCCMNZGX.js} +26 -21
- package/dist/{chunk-U5ENWTWF.js → chunk-RRKGNIXU.js} +32 -30
- package/dist/{chunk-THJ7K72W.js → chunk-SFFTVLXC.js} +6 -6
- package/dist/{chunk-2H5YFAVM.js → chunk-SUVNEDA5.js} +55 -50
- package/dist/{chunk-LMZTFDJN.js → chunk-TY3ROQOX.js} +30 -24
- 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 +2 -2
- package/dist/commands/DbPull.js +3 -3
- package/dist/commands/DbPush.js +3 -3
- package/dist/commands/DbSeed.js +2 -2
- package/dist/commands/MigrateCommand.js +2 -2
- package/dist/commands/MigrateDeploy.js +2 -2
- package/dist/commands/MigrateDev.js +4 -4
- package/dist/commands/MigrateDiff.js +3 -3
- package/dist/commands/MigrateReset.js +3 -3
- package/dist/commands/MigrateResolve.js +2 -2
- package/dist/commands/MigrateStatus.js +2 -2
- 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 +52 -52
- 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/handleEvaluateDataloss.js +2 -2
- package/package.json +9 -9
|
@@ -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
|
}
|
|
@@ -26,24 +26,21 @@ 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_NSQ3NTDD_exports = {};
|
|
30
|
+
__export(chunk_NSQ3NTDD_exports, {
|
|
31
31
|
DbDrop: () => DbDrop
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_NSQ3NTDD_exports);
|
|
34
34
|
var import_chunk_IHDN3L3R = require("./chunk-IHDN3L3R.js");
|
|
35
35
|
var import_chunk_PHX6STZ3 = require("./chunk-PHX6STZ3.js");
|
|
36
|
-
var
|
|
36
|
+
var import_chunk_KYZDCMJW = require("./chunk-KYZDCMJW.js");
|
|
37
37
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
38
38
|
var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
|
|
39
39
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
40
40
|
var import_internals = require("@prisma/internals");
|
|
41
41
|
var import_prompts = __toESM(require("prompts"));
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return new _DbDrop();
|
|
45
|
-
}
|
|
46
|
-
static help = (0, import_internals.format)(`
|
|
42
|
+
function renderHelp(cliCommand) {
|
|
43
|
+
return (0, import_internals.format)(`
|
|
47
44
|
${process.platform === "win32" ? "" : "\u{1F4A3} "}Drop the database
|
|
48
45
|
|
|
49
46
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.yellow)("WARNING"))} ${(0, import_chunk_SKRR5WT4.bold)(
|
|
@@ -54,9 +51,9 @@ ${(0, import_chunk_SKRR5WT4.dim)("When using any of the subcommands below you ne
|
|
|
54
51
|
|
|
55
52
|
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
56
53
|
|
|
57
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
54
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db drop [options] --preview-feature
|
|
58
55
|
|
|
59
|
-
The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("
|
|
56
|
+
The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma7.config.ts")}).
|
|
60
57
|
|
|
61
58
|
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
62
59
|
|
|
@@ -68,14 +65,22 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
|
68
65
|
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
69
66
|
|
|
70
67
|
Drop the database
|
|
71
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
68
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db drop --preview-feature
|
|
72
69
|
|
|
73
70
|
Specify a schema
|
|
74
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
71
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db drop --preview-feature --schema=./schema.prisma
|
|
75
72
|
|
|
76
73
|
Use --force to skip the confirmation prompt
|
|
77
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
74
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db drop --preview-feature --force
|
|
78
75
|
`);
|
|
76
|
+
}
|
|
77
|
+
var DbDrop = class _DbDrop {
|
|
78
|
+
constructor(cliCommand) {
|
|
79
|
+
this.cliCommand = cliCommand;
|
|
80
|
+
}
|
|
81
|
+
static new(cliCommand) {
|
|
82
|
+
return new _DbDrop(cliCommand);
|
|
83
|
+
}
|
|
79
84
|
async parse(argv, config, baseDir) {
|
|
80
85
|
const args = (0, import_internals.arg)(argv, {
|
|
81
86
|
"--help": Boolean,
|
|
@@ -103,15 +108,15 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
103
108
|
baseDir
|
|
104
109
|
})
|
|
105
110
|
});
|
|
106
|
-
const cmd =
|
|
107
|
-
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config, cmd });
|
|
108
|
-
(0, import_internals.checkUnsupportedDataProxy)({ cmd, validatedConfig });
|
|
111
|
+
const cmd = `${this.cliCommand} db drop`;
|
|
112
|
+
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config, command: cmd });
|
|
113
|
+
(0, import_internals.checkUnsupportedDataProxy)({ command: cmd, validatedConfig });
|
|
109
114
|
const datasourceInfo = (0, import_chunk_BRPS327A.parseDatasourceInfo)(schemaContext.primaryDatasource, validatedConfig);
|
|
110
115
|
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo });
|
|
111
116
|
process.stdout.write("\n");
|
|
112
117
|
if (!args["--force"]) {
|
|
113
118
|
if (!(0, import_internals.canPrompt)()) {
|
|
114
|
-
throw new
|
|
119
|
+
throw new import_chunk_KYZDCMJW.DbDropNeedsForceError("drop", this.cliCommand);
|
|
115
120
|
}
|
|
116
121
|
const confirmation = await (0, import_prompts.default)({
|
|
117
122
|
type: "text",
|
|
@@ -140,11 +145,12 @@ ${(0, import_chunk_SKRR5WT4.red)("All data will be lost")}.`
|
|
|
140
145
|
}
|
|
141
146
|
}
|
|
142
147
|
help(error) {
|
|
148
|
+
const help = renderHelp(this.cliCommand);
|
|
143
149
|
if (error) {
|
|
144
150
|
return new import_internals.HelpError(`
|
|
145
151
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
146
|
-
${
|
|
152
|
+
${help}`);
|
|
147
153
|
}
|
|
148
|
-
return
|
|
154
|
+
return help;
|
|
149
155
|
}
|
|
150
156
|
};
|
|
@@ -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
|
};
|
|
@@ -26,31 +26,28 @@ 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_PCCMNZGX_exports = {};
|
|
30
|
+
__export(chunk_PCCMNZGX_exports, {
|
|
31
31
|
DbPush: () => DbPush
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_PCCMNZGX_exports);
|
|
34
34
|
var import_chunk_PHX6STZ3 = require("./chunk-PHX6STZ3.js");
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_KYZDCMJW = require("./chunk-KYZDCMJW.js");
|
|
36
36
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
37
37
|
var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
|
|
38
38
|
var import_chunk_ZOYXSZ2J = require("./chunk-ZOYXSZ2J.js");
|
|
39
39
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
40
40
|
var import_internals = require("@prisma/internals");
|
|
41
41
|
var import_prompts = __toESM(require("prompts"));
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return new _DbPush();
|
|
45
|
-
}
|
|
46
|
-
static help = (0, import_internals.format)(`
|
|
42
|
+
function renderHelp(cliCommand) {
|
|
43
|
+
return (0, import_internals.format)(`
|
|
47
44
|
${process.platform === "win32" ? "" : "\u{1F64C} "}Push the state from your Prisma schema to your database
|
|
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} db push [options]
|
|
52
49
|
|
|
53
|
-
The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("
|
|
50
|
+
The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma7.config.ts")}).
|
|
54
51
|
|
|
55
52
|
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
56
53
|
|
|
@@ -64,14 +61,22 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
|
64
61
|
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
65
62
|
|
|
66
63
|
Push the Prisma schema state to the database
|
|
67
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
64
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db push
|
|
68
65
|
|
|
69
66
|
Specify a schema
|
|
70
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
67
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db push --schema=./schema.prisma
|
|
71
68
|
|
|
72
69
|
Ignore data loss warnings
|
|
73
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
70
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db push --accept-data-loss
|
|
74
71
|
`);
|
|
72
|
+
}
|
|
73
|
+
var DbPush = class _DbPush {
|
|
74
|
+
constructor(cliCommand) {
|
|
75
|
+
this.cliCommand = cliCommand;
|
|
76
|
+
}
|
|
77
|
+
static new(cliCommand) {
|
|
78
|
+
return new _DbPush(cliCommand);
|
|
79
|
+
}
|
|
75
80
|
async parse(argv, config, baseDir) {
|
|
76
81
|
const args = (0, import_internals.arg)(
|
|
77
82
|
argv,
|
|
@@ -111,9 +116,9 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
111
116
|
}
|
|
112
117
|
};
|
|
113
118
|
}
|
|
114
|
-
const cmd =
|
|
115
|
-
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config: cmdSpecificConfig, cmd });
|
|
116
|
-
(0, import_internals.checkUnsupportedDataProxy)({ cmd, validatedConfig });
|
|
119
|
+
const cmd = `${this.cliCommand} db push`;
|
|
120
|
+
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config: cmdSpecificConfig, command: cmd });
|
|
121
|
+
(0, import_internals.checkUnsupportedDataProxy)({ command: cmd, validatedConfig });
|
|
117
122
|
const datasourceProvider = (0, import_internals.getSchemaDatasourceProvider)(schemaContext);
|
|
118
123
|
const datasourceInfo = (0, import_chunk_BRPS327A.parseDatasourceInfo)(schemaContext.primaryDatasource, validatedConfig);
|
|
119
124
|
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo });
|
|
@@ -190,7 +195,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
190
195
|
throw new Error(`${messages.join("\n")}
|
|
191
196
|
|
|
192
197
|
You may use the --force-reset flag to drop the database before push like ${(0, import_chunk_SKRR5WT4.bold)(
|
|
193
|
-
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
198
|
+
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} db push --force-reset`))
|
|
194
199
|
)}
|
|
195
200
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)("All data will be lost."))}
|
|
196
201
|
`);
|
|
@@ -209,7 +214,7 @@ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)("All data will
|
|
|
209
214
|
if (!args["--accept-data-loss"]) {
|
|
210
215
|
if (!(0, import_internals.canPrompt)()) {
|
|
211
216
|
await migrate.stop();
|
|
212
|
-
throw new
|
|
217
|
+
throw new import_chunk_KYZDCMJW.DbPushIgnoreWarningsWithFlagError(this.cliCommand);
|
|
213
218
|
}
|
|
214
219
|
process.stdout.write("\n");
|
|
215
220
|
const confirmation = await (0, import_prompts.default)({
|
|
@@ -256,8 +261,8 @@ ${rocketEmoji}${provider === "mongodb" ? migrationSuccessMongoMessage : migratio
|
|
|
256
261
|
if (error) {
|
|
257
262
|
return new import_internals.HelpError(`
|
|
258
263
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
259
|
-
${
|
|
264
|
+
${renderHelp(this.cliCommand)}`);
|
|
260
265
|
}
|
|
261
|
-
return
|
|
266
|
+
return renderHelp(this.cliCommand);
|
|
262
267
|
}
|
|
263
268
|
};
|
|
@@ -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(
|
|
33
|
+
module.exports = __toCommonJS(chunk_RRKGNIXU_exports);
|
|
34
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,7 +139,7 @@ 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
|
|
@@ -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
|
};
|