@prisma/migrate 6.6.0-dev.3 → 6.6.0-dev.30
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 -3
- package/dist/Migrate.js +8 -6
- package/dist/SchemaEngine.js +5 -5
- package/dist/bin.js +48 -47
- package/dist/chunk-23DZXSTI.js +62 -0
- package/dist/{chunk-WWAWV7DQ.js → chunk-2ESYSVXG.js} +3 -27
- package/dist/{chunk-LKTTJWFT.js → chunk-2R6DII47.js} +5 -5
- package/dist/chunk-33LPBNDX.js +1399 -0
- package/dist/{chunk-V3ZMNXZC.js → chunk-5LKIRKDL.js} +307 -382
- package/dist/chunk-5Q5BJS5B.js +889 -0
- package/dist/{chunk-LOGAFLCN.js → chunk-5R44VVVX.js} +29 -29
- package/dist/{chunk-GG54LOYV.js → chunk-63ZT25OL.js} +43 -43
- package/dist/{chunk-DJMFXNR4.js → chunk-74LUB4XX.js} +56 -57
- package/dist/{chunk-IR55GBON.js → chunk-ABQZ5J74.js} +5 -5
- package/dist/{chunk-RP2N6UXA.js → chunk-AI6DH66U.js} +6 -6
- package/dist/{chunk-KS7IEA6Z.js → chunk-AM7BRZFD.js} +48 -51
- package/dist/{chunk-G2XUUMKH.js → chunk-B4SUSDC2.js} +31 -39
- package/dist/{chunk-N4XTKFY6.js → chunk-BUAYZ4KA.js} +37 -37
- package/dist/{chunk-W2SZNLK4.js → chunk-EJG7GKM7.js} +37 -39
- package/dist/{chunk-5PSO7BDO.js → chunk-EJUXYFV3.js} +15 -15
- package/dist/{chunk-MATFO4ZW.js → chunk-G7PJKEOV.js} +33 -33
- package/dist/{chunk-ZOEKRXDP.js → chunk-GHZAN2PG.js} +21 -24
- package/dist/{chunk-V5TUSOJX.js → chunk-HPT54KSO.js} +44 -44
- package/dist/{chunk-HCBZB4XC.js → chunk-HQJ7FIWN.js} +51 -51
- package/dist/{chunk-MCWCB2AX.js → chunk-IINN7QUV.js} +170 -643
- package/dist/{chunk-CQZFVAXC.js → chunk-IRYXRMQC.js} +40 -40
- package/dist/{chunk-255BRND3.js → chunk-KRQEFTDT.js} +6 -6
- package/dist/{chunk-N3KYWSX2.js → chunk-LAEOX7QH.js} +53 -48
- package/dist/{chunk-VVKOFN3Y.js → chunk-LLO7YF56.js} +44 -46
- package/dist/{chunk-MKK3GSDF.js → chunk-MTJFLQI4.js} +5 -5
- package/dist/{chunk-VZ23KD5C.js → chunk-NGQA5JTN.js} +8 -10
- package/dist/{chunk-WI2A2TQE.js → chunk-SCH55BRJ.js} +84 -87
- package/dist/{chunk-EGPJABTW.js → chunk-TGV6QGEF.js} +69 -69
- package/dist/chunk-URKH6SE2.js +479 -0
- package/dist/chunk-V6PVGSDJ.js +76 -0
- package/dist/{chunk-DLLXDCI2.js → chunk-VAJ4VX67.js} +5 -6
- package/dist/{chunk-4RDVKU5F.js → chunk-VZVF5FOX.js} +331 -344
- package/dist/{chunk-OWIFBVPC.js → chunk-WJ6HO7L7.js} +330 -343
- package/dist/{chunk-OCQGHQED.js → chunk-YBX7R3MT.js} +12 -12
- package/dist/{chunk-A6PMXMMT.js → chunk-ZB5NPOJW.js} +13 -13
- package/dist/{chunk-Q3ZLC44N.js → chunk-ZCR4PTT3.js} +54 -64
- package/dist/commands/DbCommand.js +3 -3
- package/dist/commands/DbDrop.js +4 -5
- package/dist/commands/DbExecute.js +9 -7
- package/dist/commands/DbPull.js +12 -11
- package/dist/commands/DbPush.js +10 -9
- package/dist/commands/DbSeed.js +4 -5
- package/dist/commands/MigrateCommand.js +3 -3
- package/dist/commands/MigrateDeploy.js +12 -11
- package/dist/commands/MigrateDev.js +14 -13
- package/dist/commands/MigrateDiff.js +12 -10
- package/dist/commands/MigrateReset.js +13 -12
- package/dist/commands/MigrateResolve.js +10 -9
- package/dist/commands/MigrateStatus.js +10 -9
- package/dist/index.js +52 -50
- package/dist/internals/src/cli/schemaContext.d.ts +43 -0
- package/dist/internals/src/index.d.ts +1 -0
- package/dist/internals/src/migrateTypes.d.ts +63 -0
- package/dist/migrate/src/Migrate.d.ts +3 -1
- package/dist/migrate/src/SchemaEngine.d.ts +0 -4
- package/dist/migrate/src/types.d.ts +13 -10
- package/dist/migrate/src/utils/createMigration.d.ts +21 -0
- package/dist/migrate/src/utils/ensureDatabaseExists.d.ts +4 -6
- package/dist/migrate/src/utils/listMigrations.d.ts +9 -0
- package/dist/migrate/src/utils/seed.d.ts +0 -2
- package/dist/{multipart-parser-54WEFGGN-NLZG56KM.js → multipart-parser-ASKQAOL4-WZ47HU6G.js} +92 -125
- package/dist/{multipart-parser-NDLECNMN.js → multipart-parser-QCI3Y5IB.js} +66 -68
- package/dist/types.js +1 -1
- package/dist/{typescript-WN4QH2CP.js → typescript-2LKASCMC.js} +33 -33
- package/dist/{typescript-AILDXN3I.js → typescript-H3AVJ6KX.js} +32 -32
- package/dist/utils/byline.js +1 -1
- package/dist/utils/captureStdout.js +3 -3
- package/dist/utils/countModelsAndTypes.js +1 -1
- package/dist/utils/createMigration.js +27 -0
- package/dist/utils/customColors.js +1 -1
- package/dist/utils/ensureDatabaseExists.js +7 -7
- package/dist/utils/errors.js +1 -1
- package/dist/utils/flagErrors.js +1 -1
- package/dist/utils/getDatabaseVersionSafe.js +5 -5
- package/dist/utils/getSchemaPathAndPrint.js +1 -1
- package/dist/utils/handleEvaluateDataloss.js +1 -1
- package/dist/utils/introspectSql.js +5 -5
- package/dist/utils/isSchemaEmpty.js +1 -1
- package/dist/utils/listMigrations.js +25 -0
- package/dist/utils/now.js +1 -1
- package/dist/utils/printDatasource.js +1 -1
- package/dist/utils/printDatasources.js +5 -5
- package/dist/utils/printFiles.js +5 -5
- package/dist/utils/printIntrospectedSchema.js +1 -1
- package/dist/utils/printMigrationId.js +1 -1
- package/dist/utils/promptForMigrationName.js +3 -3
- package/dist/utils/removeSchemaFiles.js +1 -1
- package/dist/utils/replaceOrAddDatasource.js +1 -1
- package/dist/utils/replaceOrAddDatasource.test.js +1 -1
- package/dist/utils/saveSchemaFiles.js +1 -1
- package/dist/utils/seed.js +4 -7
- package/dist/utils/setupCockroach.js +3 -3
- package/dist/utils/setupMSSQL.js +759 -675
- package/dist/utils/setupMongo.js +552 -552
- package/dist/utils/setupMysql.js +508 -563
- package/dist/utils/setupPostgres.js +3 -3
- package/dist/utils/spinner.js +4 -3
- package/dist/utils/unixSocket.js +1 -1
- package/dist/views/handleViewsIO.js +3 -3
- package/package.json +9 -9
- package/dist/chunk-J46BJQHT.js +0 -268
- package/dist/chunk-KOF4LGTS.js +0 -1817
- package/dist/chunk-YYPMC5FN.js +0 -1407
|
@@ -26,25 +26,45 @@ 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_IRYXRMQC_exports = {};
|
|
30
|
+
__export(chunk_IRYXRMQC_exports, {
|
|
31
31
|
MigrateDeploy: () => MigrateDeploy
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var import_chunk_GKDFIHM2 = require("./chunk-GKDFIHM2.js");
|
|
33
|
+
module.exports = __toCommonJS(chunk_IRYXRMQC_exports);
|
|
34
|
+
var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
|
|
35
|
+
var import_chunk_5Q5BJS5B = require("./chunk-5Q5BJS5B.js");
|
|
37
36
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
38
|
-
var
|
|
37
|
+
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
39
38
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
40
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
41
39
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
42
40
|
var import_internals = require("@prisma/internals");
|
|
43
41
|
var debug = (0, import_debug.default)("prisma:migrate:deploy");
|
|
44
|
-
var
|
|
42
|
+
var MigrateDeploy = class _MigrateDeploy {
|
|
45
43
|
static new() {
|
|
46
|
-
return new
|
|
44
|
+
return new _MigrateDeploy();
|
|
47
45
|
}
|
|
46
|
+
static help = (0, import_internals.format)(`
|
|
47
|
+
Apply pending migrations to update the database schema in production/staging
|
|
48
|
+
|
|
49
|
+
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
50
|
+
|
|
51
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy [options]
|
|
52
|
+
|
|
53
|
+
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
54
|
+
|
|
55
|
+
-h, --help Display this help message
|
|
56
|
+
--config Custom path to your Prisma config file
|
|
57
|
+
--schema Custom path to your Prisma schema
|
|
58
|
+
|
|
59
|
+
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
60
|
+
|
|
61
|
+
Deploy your pending migrations to your production/staging database
|
|
62
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy
|
|
63
|
+
|
|
64
|
+
Specify a schema
|
|
65
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy --schema=./schema.prisma
|
|
66
|
+
|
|
67
|
+
`);
|
|
48
68
|
async parse(argv, config) {
|
|
49
69
|
const args = (0, import_internals.arg)(
|
|
50
70
|
argv,
|
|
@@ -65,11 +85,14 @@ var _MigrateDeploy = class _MigrateDeploy2 {
|
|
|
65
85
|
return this.help();
|
|
66
86
|
}
|
|
67
87
|
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
88
|
+
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
89
|
+
schemaPathFromArg: args["--schema"],
|
|
90
|
+
schemaPathFromConfig: config.schema
|
|
91
|
+
});
|
|
92
|
+
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext.primaryDatasource) });
|
|
93
|
+
const migrate = new import_chunk_5Q5BJS5B.Migrate(schemaContext.schemaPath);
|
|
71
94
|
try {
|
|
72
|
-
const wasDbCreated = await (0,
|
|
95
|
+
const wasDbCreated = await (0, import_chunk_74LUB4XX.ensureDatabaseExists)(schemaContext.primaryDatasource);
|
|
73
96
|
if (wasDbCreated) {
|
|
74
97
|
process.stdout.write("\n" + wasDbCreated + "\n");
|
|
75
98
|
}
|
|
@@ -104,7 +127,7 @@ var _MigrateDeploy = class _MigrateDeploy2 {
|
|
|
104
127
|
} else {
|
|
105
128
|
return `The following migration(s) have been applied:
|
|
106
129
|
|
|
107
|
-
${(0,
|
|
130
|
+
${(0, import_chunk_KRQEFTDT.printFilesFromMigrationIds)(
|
|
108
131
|
"migrations",
|
|
109
132
|
migrationIds,
|
|
110
133
|
{
|
|
@@ -119,31 +142,8 @@ ${(0, import_chunk_SKRR5WT4.green)("All migrations have been successfully applie
|
|
|
119
142
|
if (error) {
|
|
120
143
|
return new import_internals.HelpError(`
|
|
121
144
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
122
|
-
${
|
|
145
|
+
${_MigrateDeploy.help}`);
|
|
123
146
|
}
|
|
124
|
-
return
|
|
147
|
+
return _MigrateDeploy.help;
|
|
125
148
|
}
|
|
126
149
|
};
|
|
127
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(_MigrateDeploy, "help", (0, import_internals.format)(`
|
|
128
|
-
Apply pending migrations to update the database schema in production/staging
|
|
129
|
-
|
|
130
|
-
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
131
|
-
|
|
132
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy [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
|
-
|
|
140
|
-
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
141
|
-
|
|
142
|
-
Deploy your pending migrations to your production/staging database
|
|
143
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy
|
|
144
|
-
|
|
145
|
-
Specify a schema
|
|
146
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy --schema=./schema.prisma
|
|
147
|
-
|
|
148
|
-
`));
|
|
149
|
-
var MigrateDeploy = _MigrateDeploy;
|
|
@@ -16,16 +16,16 @@ 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_KRQEFTDT_exports = {};
|
|
20
|
+
__export(chunk_KRQEFTDT_exports, {
|
|
21
21
|
printFiles: () => printFiles,
|
|
22
22
|
printFilesFromMigrationIds: () => printFilesFromMigrationIds
|
|
23
23
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
24
|
+
module.exports = __toCommonJS(chunk_KRQEFTDT_exports);
|
|
25
25
|
var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var import_indent_string = (0,
|
|
26
|
+
var import_chunk_2R6DII47 = require("./chunk-2R6DII47.js");
|
|
27
|
+
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
28
|
+
var import_indent_string = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_2R6DII47.require_indent_string)());
|
|
29
29
|
function printFiles(printPath, files) {
|
|
30
30
|
const fileNames = Object.keys(files);
|
|
31
31
|
const folders = printPath.split("/");
|
|
@@ -26,14 +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_LAEOX7QH_exports = {};
|
|
30
|
+
__export(chunk_LAEOX7QH_exports, {
|
|
31
31
|
DbExecute: () => DbExecute
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_LAEOX7QH_exports);
|
|
34
|
+
var import_chunk_5Q5BJS5B = require("./chunk-5Q5BJS5B.js");
|
|
35
35
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
36
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
37
36
|
var import_internals = require("@prisma/internals");
|
|
38
37
|
var import_fs = __toESM(require("fs"));
|
|
39
38
|
var import_path = __toESM(require("path"));
|
|
@@ -82,10 +81,48 @@ ${(0, import_chunk_SKRR5WT4.bold)("Flags")}
|
|
|
82
81
|
|
|
83
82
|
--stdin Use the terminal standard input as the script to be executed`
|
|
84
83
|
);
|
|
85
|
-
var
|
|
84
|
+
var DbExecute = class _DbExecute {
|
|
86
85
|
static new() {
|
|
87
|
-
return new
|
|
86
|
+
return new _DbExecute();
|
|
88
87
|
}
|
|
88
|
+
// TODO: This command needs to get proper support for `prisma.config.ts` eventually. Not just taking the schema path
|
|
89
|
+
// from prisma.config.ts but likely to support driver adapters, too?
|
|
90
|
+
// See https://linear.app/prisma-company/issue/ORM-639/prisma-db-execute-support-prismaconfigts-and-driver-adapters
|
|
91
|
+
static help = (0, import_internals.format)(`
|
|
92
|
+
${process.platform === "win32" ? "" : "\u{1F4DD} "}Execute native commands to your database
|
|
93
|
+
|
|
94
|
+
This command takes as input a datasource, using ${(0, import_chunk_SKRR5WT4.green)(`--url`)} or ${(0, import_chunk_SKRR5WT4.green)(`--schema`)} and a script, using ${(0, import_chunk_SKRR5WT4.green)(
|
|
95
|
+
`--stdin`
|
|
96
|
+
)} or ${(0, import_chunk_SKRR5WT4.green)(`--file`)}.
|
|
97
|
+
The input parameters are mutually exclusive, only 1 of each (datasource & script) must be provided.
|
|
98
|
+
|
|
99
|
+
The output of the command is connector-specific, and is not meant for returning data, but only to report success or failure.
|
|
100
|
+
|
|
101
|
+
On SQL databases, this command takes as input a SQL script.
|
|
102
|
+
The whole script will be sent as a single command to the database.
|
|
103
|
+
|
|
104
|
+
${(0, import_chunk_SKRR5WT4.italic)(`This command is currently not supported on MongoDB.`)}
|
|
105
|
+
|
|
106
|
+
${helpOptions}
|
|
107
|
+
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
108
|
+
|
|
109
|
+
Execute the content of a SQL script file to the datasource URL taken from the schema
|
|
110
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute
|
|
111
|
+
--file ./script.sql \\
|
|
112
|
+
--schema schema.prisma
|
|
113
|
+
|
|
114
|
+
Execute the SQL script from stdin to the datasource URL specified via the \`DATABASE_URL\` environment variable
|
|
115
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
|
|
116
|
+
prisma db execute \\
|
|
117
|
+
--stdin \\
|
|
118
|
+
--url="$DATABASE_URL"
|
|
119
|
+
|
|
120
|
+
Like previous example, but exposing the datasource url credentials to your terminal history
|
|
121
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
|
|
122
|
+
prisma db execute \\
|
|
123
|
+
--stdin \\
|
|
124
|
+
--url="mysql://root:root@localhost/mydb"
|
|
125
|
+
`);
|
|
89
126
|
async parse(argv, config) {
|
|
90
127
|
const args = (0, import_internals.arg)(
|
|
91
128
|
argv,
|
|
@@ -154,14 +191,18 @@ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExec
|
|
|
154
191
|
url: args["--url"]
|
|
155
192
|
};
|
|
156
193
|
} else {
|
|
157
|
-
const
|
|
158
|
-
|
|
194
|
+
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
195
|
+
schemaPathFromArg: args["--schema"],
|
|
196
|
+
schemaPathFromConfig: config.schema,
|
|
197
|
+
printLoadMessage: false
|
|
198
|
+
});
|
|
159
199
|
datasourceType = {
|
|
160
200
|
tag: "schema",
|
|
161
|
-
...(0, import_internals.
|
|
201
|
+
...(0, import_internals.toSchemasContainer)(schemaContext.schemaFiles),
|
|
202
|
+
configDir: schemaContext.primaryDatasourceDirectory
|
|
162
203
|
};
|
|
163
204
|
}
|
|
164
|
-
const migrate = new
|
|
205
|
+
const migrate = new import_chunk_5Q5BJS5B.Migrate();
|
|
165
206
|
try {
|
|
166
207
|
await migrate.engine.dbExecute({
|
|
167
208
|
script,
|
|
@@ -179,42 +220,6 @@ ${error}
|
|
|
179
220
|
|
|
180
221
|
${helpOptions}`);
|
|
181
222
|
}
|
|
182
|
-
return
|
|
223
|
+
return _DbExecute.help;
|
|
183
224
|
}
|
|
184
225
|
};
|
|
185
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(_DbExecute, "help", (0, import_internals.format)(`
|
|
186
|
-
${process.platform === "win32" ? "" : "\u{1F4DD} "}Execute native commands to your database
|
|
187
|
-
|
|
188
|
-
This command takes as input a datasource, using ${(0, import_chunk_SKRR5WT4.green)(`--url`)} or ${(0, import_chunk_SKRR5WT4.green)(`--schema`)} and a script, using ${(0, import_chunk_SKRR5WT4.green)(
|
|
189
|
-
`--stdin`
|
|
190
|
-
)} or ${(0, import_chunk_SKRR5WT4.green)(`--file`)}.
|
|
191
|
-
The input parameters are mutually exclusive, only 1 of each (datasource & script) must be provided.
|
|
192
|
-
|
|
193
|
-
The output of the command is connector-specific, and is not meant for returning data, but only to report success or failure.
|
|
194
|
-
|
|
195
|
-
On SQL databases, this command takes as input a SQL script.
|
|
196
|
-
The whole script will be sent as a single command to the database.
|
|
197
|
-
|
|
198
|
-
${(0, import_chunk_SKRR5WT4.italic)(`This command is currently not supported on MongoDB.`)}
|
|
199
|
-
|
|
200
|
-
${helpOptions}
|
|
201
|
-
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
202
|
-
|
|
203
|
-
Execute the content of a SQL script file to the datasource URL taken from the schema
|
|
204
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute
|
|
205
|
-
--file ./script.sql \\
|
|
206
|
-
--schema schema.prisma
|
|
207
|
-
|
|
208
|
-
Execute the SQL script from stdin to the datasource URL specified via the \`DATABASE_URL\` environment variable
|
|
209
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
|
|
210
|
-
prisma db execute \\
|
|
211
|
-
--stdin \\
|
|
212
|
-
--url="$DATABASE_URL"
|
|
213
|
-
|
|
214
|
-
Like previous example, but exposing the datasource url credentials to your terminal history
|
|
215
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
|
|
216
|
-
prisma db execute \\
|
|
217
|
-
--stdin \\
|
|
218
|
-
--url="mysql://root:root@localhost/mydb"
|
|
219
|
-
`));
|
|
220
|
-
var DbExecute = _DbExecute;
|
|
@@ -16,59 +16,21 @@ 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_LLO7YF56_exports = {};
|
|
20
|
+
__export(chunk_LLO7YF56_exports, {
|
|
21
21
|
MigrateCommand: () => MigrateCommand
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(chunk_LLO7YF56_exports);
|
|
24
24
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
25
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
26
25
|
var import_internals = require("@prisma/internals");
|
|
27
|
-
var
|
|
26
|
+
var MigrateCommand = class _MigrateCommand {
|
|
28
27
|
constructor(cmds) {
|
|
29
28
|
this.cmds = cmds;
|
|
30
29
|
}
|
|
31
30
|
static new(cmds) {
|
|
32
|
-
return new
|
|
31
|
+
return new _MigrateCommand(cmds);
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
const args = (0, import_internals.arg)(argv, {
|
|
36
|
-
"--help": Boolean,
|
|
37
|
-
"-h": "--help",
|
|
38
|
-
"--config": String,
|
|
39
|
-
"--preview-feature": Boolean,
|
|
40
|
-
"--telemetry-information": String
|
|
41
|
-
});
|
|
42
|
-
if ((0, import_internals.isError)(args)) {
|
|
43
|
-
return this.help(args.message);
|
|
44
|
-
}
|
|
45
|
-
if (args._.length === 0 || args["--help"]) {
|
|
46
|
-
return this.help();
|
|
47
|
-
}
|
|
48
|
-
const commandName = args._[0];
|
|
49
|
-
const cmd = this.cmds[commandName];
|
|
50
|
-
if (cmd) {
|
|
51
|
-
let argsForCmd;
|
|
52
|
-
if (commandName === "diff") {
|
|
53
|
-
argsForCmd = args["--preview-feature"] ? [...args._.slice(1), `--preview-feature`] : args._.slice(1);
|
|
54
|
-
} else {
|
|
55
|
-
const filteredArgs = args._.filter((item) => item !== "--preview-feature");
|
|
56
|
-
argsForCmd = filteredArgs.slice(1);
|
|
57
|
-
}
|
|
58
|
-
return cmd.parse(argsForCmd, config);
|
|
59
|
-
}
|
|
60
|
-
return (0, import_internals.unknownCommand)(_MigrateCommand2.help, commandName);
|
|
61
|
-
}
|
|
62
|
-
help(error) {
|
|
63
|
-
if (error) {
|
|
64
|
-
return new import_internals.HelpError(`
|
|
65
|
-
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
66
|
-
${_MigrateCommand2.help}`);
|
|
67
|
-
}
|
|
68
|
-
return _MigrateCommand2.help;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(_MigrateCommand, "help", (0, import_internals.format)(`
|
|
33
|
+
static help = (0, import_internals.format)(`
|
|
72
34
|
Update the database schema with migrations
|
|
73
35
|
|
|
74
36
|
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
@@ -119,5 +81,41 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
119
81
|
--from-url "$DATABASE_URL" \\
|
|
120
82
|
--to-url "postgresql://login:password@localhost:5432/db" \\
|
|
121
83
|
--script
|
|
122
|
-
`)
|
|
123
|
-
|
|
84
|
+
`);
|
|
85
|
+
async parse(argv, config) {
|
|
86
|
+
const args = (0, import_internals.arg)(argv, {
|
|
87
|
+
"--help": Boolean,
|
|
88
|
+
"-h": "--help",
|
|
89
|
+
"--config": String,
|
|
90
|
+
"--preview-feature": Boolean,
|
|
91
|
+
"--telemetry-information": String
|
|
92
|
+
});
|
|
93
|
+
if ((0, import_internals.isError)(args)) {
|
|
94
|
+
return this.help(args.message);
|
|
95
|
+
}
|
|
96
|
+
if (args._.length === 0 || args["--help"]) {
|
|
97
|
+
return this.help();
|
|
98
|
+
}
|
|
99
|
+
const commandName = args._[0];
|
|
100
|
+
const cmd = this.cmds[commandName];
|
|
101
|
+
if (cmd) {
|
|
102
|
+
let argsForCmd;
|
|
103
|
+
if (commandName === "diff") {
|
|
104
|
+
argsForCmd = args["--preview-feature"] ? [...args._.slice(1), `--preview-feature`] : args._.slice(1);
|
|
105
|
+
} else {
|
|
106
|
+
const filteredArgs = args._.filter((item) => item !== "--preview-feature");
|
|
107
|
+
argsForCmd = filteredArgs.slice(1);
|
|
108
|
+
}
|
|
109
|
+
return cmd.parse(argsForCmd, config);
|
|
110
|
+
}
|
|
111
|
+
return (0, import_internals.unknownCommand)(_MigrateCommand.help, commandName);
|
|
112
|
+
}
|
|
113
|
+
help(error) {
|
|
114
|
+
if (error) {
|
|
115
|
+
return new import_internals.HelpError(`
|
|
116
|
+
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
117
|
+
${_MigrateCommand.help}`);
|
|
118
|
+
}
|
|
119
|
+
return _MigrateCommand.help;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
@@ -26,19 +26,19 @@ 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_MTJFLQI4_exports = {};
|
|
30
|
+
__export(chunk_MTJFLQI4_exports, {
|
|
31
31
|
getDatabaseVersionSafe: () => getDatabaseVersionSafe
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_MTJFLQI4_exports);
|
|
34
|
+
var import_chunk_GHZAN2PG = require("./chunk-GHZAN2PG.js");
|
|
35
35
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
36
36
|
var debug = (0, import_debug.default)("prisma:cli");
|
|
37
37
|
async function getDatabaseVersionSafe(args) {
|
|
38
38
|
let engine;
|
|
39
39
|
let dbVersion;
|
|
40
40
|
try {
|
|
41
|
-
engine = new
|
|
41
|
+
engine = new import_chunk_GHZAN2PG.SchemaEngine({});
|
|
42
42
|
dbVersion = await engine.getDatabaseVersion(args);
|
|
43
43
|
} catch (e) {
|
|
44
44
|
debug(e);
|
|
@@ -16,20 +16,19 @@ 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_NGQA5JTN_exports = {};
|
|
20
|
+
__export(chunk_NGQA5JTN_exports, {
|
|
21
21
|
CLI: () => CLI
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(chunk_NGQA5JTN_exports);
|
|
24
24
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
25
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
26
25
|
var import_internals = require("@prisma/internals");
|
|
27
|
-
var
|
|
26
|
+
var CLI = class _CLI {
|
|
28
27
|
constructor(cmds) {
|
|
29
28
|
this.cmds = cmds;
|
|
30
29
|
}
|
|
31
30
|
static new(cmds) {
|
|
32
|
-
return new
|
|
31
|
+
return new _CLI(cmds);
|
|
33
32
|
}
|
|
34
33
|
async parse(argv, config) {
|
|
35
34
|
const args = (0, import_internals.arg)(argv, {
|
|
@@ -70,10 +69,9 @@ var _CLI = class _CLI2 {
|
|
|
70
69
|
if (error) {
|
|
71
70
|
return new import_internals.HelpError(`
|
|
72
71
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
73
|
-
${
|
|
72
|
+
${_CLI.help}`);
|
|
74
73
|
}
|
|
75
|
-
return
|
|
74
|
+
return _CLI.help;
|
|
76
75
|
}
|
|
76
|
+
static help = (0, import_internals.format)(`This is the internal CLI for @prisma/migrate`);
|
|
77
77
|
};
|
|
78
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(_CLI, "help", (0, import_internals.format)(`This is the internal CLI for @prisma/migrate`));
|
|
79
|
-
var CLI = _CLI;
|