@prisma/migrate 6.6.0-dev.5 → 6.6.0-dev.52
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 +47 -46
- 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-GG54LOYV.js → chunk-3PIR4R46.js} +45 -44
- package/dist/{chunk-UG7FMNDT.js → chunk-3VPUKOUG.js} +365 -518
- package/dist/{chunk-A6PMXMMT.js → chunk-4RKCE4QB.js} +95 -13
- package/dist/{chunk-V3ZMNXZC.js → chunk-5LKIRKDL.js} +307 -382
- package/dist/{chunk-IR55GBON.js → chunk-5LTDMS3H.js} +18 -18
- package/dist/{chunk-LOGAFLCN.js → chunk-5R44VVVX.js} +29 -29
- package/dist/{chunk-DJMFXNR4.js → chunk-74LUB4XX.js} +56 -57
- package/dist/{chunk-RP2N6UXA.js → chunk-AI6DH66U.js} +6 -6
- package/dist/{chunk-G2XUUMKH.js → chunk-B4SUSDC2.js} +31 -39
- package/dist/{chunk-Q3ZLC44N.js → chunk-CKRN45WP.js} +57 -66
- package/dist/{chunk-ZOEKRXDP.js → chunk-D2DGSPW6.js} +29 -55
- package/dist/{chunk-XE57D2AO.js → chunk-DAPW4IMN.js} +366 -519
- package/dist/{chunk-W2SZNLK4.js → chunk-EJG7GKM7.js} +37 -39
- package/dist/{chunk-5PSO7BDO.js → chunk-EJUXYFV3.js} +15 -15
- package/dist/{chunk-N3KYWSX2.js → chunk-GAKKKF5T.js} +55 -49
- package/dist/{chunk-N4XTKFY6.js → chunk-GKHRL6AR.js} +39 -38
- package/dist/{chunk-CQZFVAXC.js → chunk-HHVLUI3H.js} +42 -41
- package/dist/{chunk-MCWCB2AX.js → chunk-IINN7QUV.js} +170 -643
- package/dist/{chunk-HCBZB4XC.js → chunk-KN2W5IP7.js} +53 -52
- package/dist/{chunk-255BRND3.js → chunk-KRQEFTDT.js} +6 -6
- package/dist/{chunk-VVKOFN3Y.js → chunk-LLO7YF56.js} +44 -46
- package/dist/{chunk-VZ23KD5C.js → chunk-NGQA5JTN.js} +8 -10
- package/dist/{chunk-MKK3GSDF.js → chunk-NIKXBMZL.js} +5 -5
- package/dist/{chunk-KS7IEA6Z.js → chunk-O723A5JE.js} +50 -52
- package/dist/{chunk-MATFO4ZW.js → chunk-OEWQACEH.js} +38 -39
- package/dist/chunk-PDCXVUV3.js +883 -0
- package/dist/{chunk-EGPJABTW.js → chunk-QVMYNWAN.js} +257 -103
- package/dist/{chunk-V5TUSOJX.js → chunk-SQKGZVG3.js} +45 -45
- 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-OCQGHQED.js → chunk-YBX7R3MT.js} +12 -12
- package/dist/{chunk-WI2A2TQE.js → chunk-ZJ4IDCRR.js} +90 -91
- 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 +11 -10
- 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 +50 -51
- package/dist/internals/src/Generator.d.ts +1 -1
- package/dist/internals/src/cli/checkUnsupportedDataProxy.d.ts +12 -17
- package/dist/internals/src/cli/directoryConfig.d.ts +7 -0
- package/dist/internals/src/cli/getSchema.d.ts +3 -28
- package/dist/internals/src/cli/hashes.d.ts +1 -2
- package/dist/internals/src/cli/schemaContext.d.ts +59 -0
- package/dist/internals/src/client/getClientEngineType.d.ts +1 -1
- package/dist/internals/src/convertCredentials.d.ts +1 -1
- package/dist/internals/src/engine-commands/getConfig.d.ts +1 -5
- package/dist/internals/src/engine-commands/getDmmf.d.ts +3 -6
- package/dist/internals/src/engine-commands/lintSchema.d.ts +1 -1
- package/dist/internals/src/errorReporting.d.ts +0 -1
- package/dist/internals/src/get-generators/getGenerators.d.ts +8 -4
- package/dist/internals/src/get-generators/utils/binaryTypeToEngineType.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/engineTypeToBinaryType.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/fixBinaryTargets.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/getBinaryPathsByVersion.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/getEngineVersionForGenerator.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/printGeneratorConfig.d.ts +1 -1
- package/dist/internals/src/index.d.ts +5 -3
- package/dist/internals/src/migrateTypes.d.ts +63 -0
- package/dist/internals/src/panic.d.ts +1 -4
- package/dist/internals/src/types.d.ts +1 -1
- package/dist/internals/src/utils/extractPreviewFeatures.d.ts +2 -2
- package/dist/internals/src/utils/getEnvPaths.d.ts +1 -1
- package/dist/internals/src/utils/parseEnvValue.d.ts +1 -1
- package/dist/internals/src/utils/schemaFileInput.d.ts +0 -4
- package/dist/internals/src/utils/toSchemasContainer.d.ts +2 -3
- package/dist/migrate/src/Migrate.d.ts +7 -5
- package/dist/migrate/src/SchemaEngine.d.ts +5 -9
- package/dist/migrate/src/index.d.ts +0 -1
- package/dist/migrate/src/types.d.ts +14 -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/introspectSql.d.ts +3 -2
- package/dist/migrate/src/utils/listMigrations.d.ts +9 -0
- package/dist/migrate/src/utils/printDatasources.d.ts +1 -1
- package/dist/migrate/src/utils/seed.d.ts +0 -2
- package/dist/migrate/src/views/handleViewsIO.d.ts +2 -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/{getSchemaPathAndPrint.js → createMigration.js} +8 -8
- 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/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 +1487 -707
- 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/test-handlePanic.js +1 -30
- package/dist/utils/unixSocket.js +1 -1
- package/dist/views/handleViewsIO.js +3 -3
- package/package.json +10 -11
- package/dist/chunk-GKDFIHM2.js +0 -45
- package/dist/chunk-J46BJQHT.js +0 -268
- package/dist/chunk-KOF4LGTS.js +0 -1817
- package/dist/chunk-YYPMC5FN.js +0 -1407
- package/dist/internals/src/get-generators/utils/check-feature-flags/checkFeatureFlags.d.ts +0 -8
- package/dist/migrate/src/utils/getSchemaPathAndPrint.d.ts +0 -10
|
@@ -16,22 +16,53 @@ 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_KN2W5IP7_exports = {};
|
|
20
|
+
__export(chunk_KN2W5IP7_exports, {
|
|
21
21
|
MigrateResolve: () => MigrateResolve
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
25
|
-
var import_chunk_GKDFIHM2 = require("./chunk-GKDFIHM2.js");
|
|
23
|
+
module.exports = __toCommonJS(chunk_KN2W5IP7_exports);
|
|
24
|
+
var import_chunk_PDCXVUV3 = require("./chunk-PDCXVUV3.js");
|
|
26
25
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
27
|
-
var
|
|
26
|
+
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
28
27
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
29
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
30
28
|
var import_internals = require("@prisma/internals");
|
|
31
|
-
var
|
|
29
|
+
var MigrateResolve = class _MigrateResolve {
|
|
32
30
|
static new() {
|
|
33
|
-
return new
|
|
31
|
+
return new _MigrateResolve();
|
|
34
32
|
}
|
|
33
|
+
static help = (0, import_internals.format)(`
|
|
34
|
+
Resolve issues with database migrations in deployment databases:
|
|
35
|
+
- recover from failed migrations
|
|
36
|
+
- baseline databases when starting to use Prisma Migrate on existing databases
|
|
37
|
+
- reconcile hotfixes done manually on databases with your migration history
|
|
38
|
+
|
|
39
|
+
Run "prisma migrate status" to identify if you need to use resolve.
|
|
40
|
+
|
|
41
|
+
Read more about resolving migration history issues: ${(0, import_internals.link)("https://pris.ly/d/migrate-resolve")}
|
|
42
|
+
|
|
43
|
+
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
44
|
+
|
|
45
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve [options]
|
|
46
|
+
|
|
47
|
+
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
48
|
+
|
|
49
|
+
-h, --help Display this help message
|
|
50
|
+
--config Custom path to your Prisma config file
|
|
51
|
+
--schema Custom path to your Prisma schema
|
|
52
|
+
--applied Record a specific migration as applied
|
|
53
|
+
--rolled-back Record a specific migration as rolled back
|
|
54
|
+
|
|
55
|
+
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
56
|
+
|
|
57
|
+
Update migrations table, recording a specific migration as applied
|
|
58
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --applied 20201231000000_add_users_table
|
|
59
|
+
|
|
60
|
+
Update migrations table, recording a specific migration as rolled back
|
|
61
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --rolled-back 20201231000000_add_users_table
|
|
62
|
+
|
|
63
|
+
Specify a schema
|
|
64
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --rolled-back 20201231000000_add_users_table --schema=./schema.prisma
|
|
65
|
+
`);
|
|
35
66
|
async parse(argv, config) {
|
|
36
67
|
const args = (0, import_internals.arg)(
|
|
37
68
|
argv,
|
|
@@ -49,13 +80,17 @@ var _MigrateResolve = class _MigrateResolve2 {
|
|
|
49
80
|
if ((0, import_internals.isError)(args)) {
|
|
50
81
|
return this.help(args.message);
|
|
51
82
|
}
|
|
52
|
-
await (0, import_internals.checkUnsupportedDataProxy)("migrate resolve", args, config.schema, true);
|
|
53
83
|
if (args["--help"]) {
|
|
54
84
|
return this.help();
|
|
55
85
|
}
|
|
56
86
|
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
57
|
-
const
|
|
58
|
-
|
|
87
|
+
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
88
|
+
schemaPathFromArg: args["--schema"],
|
|
89
|
+
schemaPathFromConfig: config.schema
|
|
90
|
+
});
|
|
91
|
+
const { migrationsDirPath } = (0, import_internals.inferDirectoryConfig)(schemaContext);
|
|
92
|
+
(0, import_internals.checkUnsupportedDataProxy)({ cmd: "migrate resolve", schemaContext });
|
|
93
|
+
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext.primaryDatasource) });
|
|
59
94
|
if (!args["--applied"] && !args["--rolled-back"]) {
|
|
60
95
|
throw new Error(
|
|
61
96
|
`--applied or --rolled-back must be part of the command like:
|
|
@@ -73,8 +108,8 @@ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_in
|
|
|
73
108
|
)}`
|
|
74
109
|
);
|
|
75
110
|
}
|
|
76
|
-
await (0,
|
|
77
|
-
const migrate = new
|
|
111
|
+
await (0, import_chunk_74LUB4XX.ensureCanConnectToDatabase)(schemaContext.primaryDatasource);
|
|
112
|
+
const migrate = new import_chunk_PDCXVUV3.Migrate(schemaContext, migrationsDirPath);
|
|
78
113
|
try {
|
|
79
114
|
await migrate.markMigrationApplied({
|
|
80
115
|
migrationId: args["--applied"]
|
|
@@ -94,8 +129,8 @@ Migration ${args["--applied"]} marked as applied.
|
|
|
94
129
|
)}`
|
|
95
130
|
);
|
|
96
131
|
}
|
|
97
|
-
await (0,
|
|
98
|
-
const migrate = new
|
|
132
|
+
await (0, import_chunk_74LUB4XX.ensureCanConnectToDatabase)(schemaContext.primaryDatasource);
|
|
133
|
+
const migrate = new import_chunk_PDCXVUV3.Migrate(schemaContext, migrationsDirPath);
|
|
99
134
|
try {
|
|
100
135
|
await migrate.markMigrationRolledBack({
|
|
101
136
|
migrationId: args["--rolled-back"]
|
|
@@ -113,42 +148,8 @@ Migration ${args["--rolled-back"]} marked as rolled back.
|
|
|
113
148
|
if (error) {
|
|
114
149
|
return new import_internals.HelpError(`
|
|
115
150
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
116
|
-
${
|
|
151
|
+
${_MigrateResolve.help}`);
|
|
117
152
|
}
|
|
118
|
-
return
|
|
153
|
+
return _MigrateResolve.help;
|
|
119
154
|
}
|
|
120
155
|
};
|
|
121
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(_MigrateResolve, "help", (0, import_internals.format)(`
|
|
122
|
-
Resolve issues with database migrations in deployment databases:
|
|
123
|
-
- recover from failed migrations
|
|
124
|
-
- baseline databases when starting to use Prisma Migrate on existing databases
|
|
125
|
-
- reconcile hotfixes done manually on databases with your migration history
|
|
126
|
-
|
|
127
|
-
Run "prisma migrate status" to identify if you need to use resolve.
|
|
128
|
-
|
|
129
|
-
Read more about resolving migration history issues: ${(0, import_internals.link)("https://pris.ly/d/migrate-resolve")}
|
|
130
|
-
|
|
131
|
-
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
132
|
-
|
|
133
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve [options]
|
|
134
|
-
|
|
135
|
-
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
136
|
-
|
|
137
|
-
-h, --help Display this help message
|
|
138
|
-
--config Custom path to your Prisma config file
|
|
139
|
-
--schema Custom path to your Prisma schema
|
|
140
|
-
--applied Record a specific migration as applied
|
|
141
|
-
--rolled-back Record a specific migration as rolled back
|
|
142
|
-
|
|
143
|
-
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
144
|
-
|
|
145
|
-
Update migrations table, recording a specific migration as applied
|
|
146
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --applied 20201231000000_add_users_table
|
|
147
|
-
|
|
148
|
-
Update migrations table, recording a specific migration as rolled back
|
|
149
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --rolled-back 20201231000000_add_users_table
|
|
150
|
-
|
|
151
|
-
Specify a schema
|
|
152
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --rolled-back 20201231000000_add_users_table --schema=./schema.prisma
|
|
153
|
-
`));
|
|
154
|
-
var MigrateResolve = _MigrateResolve;
|
|
@@ -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("/");
|
|
@@ -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
|
+
};
|
|
@@ -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;
|
|
@@ -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_NIKXBMZL_exports = {};
|
|
30
|
+
__export(chunk_NIKXBMZL_exports, {
|
|
31
31
|
getDatabaseVersionSafe: () => getDatabaseVersionSafe
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_NIKXBMZL_exports);
|
|
34
|
+
var import_chunk_D2DGSPW6 = require("./chunk-D2DGSPW6.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_D2DGSPW6.SchemaEngine({});
|
|
42
42
|
dbVersion = await engine.getDatabaseVersion(args);
|
|
43
43
|
} catch (e) {
|
|
44
44
|
debug(e);
|
|
@@ -26,26 +26,51 @@ 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_O723A5JE_exports = {};
|
|
30
|
+
__export(chunk_O723A5JE_exports, {
|
|
31
31
|
MigrateReset: () => MigrateReset
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_O723A5JE_exports);
|
|
34
|
+
var import_chunk_5LKIRKDL = require("./chunk-5LKIRKDL.js");
|
|
35
|
+
var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
|
|
36
|
+
var import_chunk_PDCXVUV3 = require("./chunk-PDCXVUV3.js");
|
|
37
37
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
38
|
-
var import_chunk_GKDFIHM2 = require("./chunk-GKDFIHM2.js");
|
|
39
38
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
40
|
-
var
|
|
39
|
+
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
41
40
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
42
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
43
41
|
var import_internals = require("@prisma/internals");
|
|
44
42
|
var import_prompts = __toESM(require("prompts"));
|
|
45
|
-
var
|
|
43
|
+
var MigrateReset = class _MigrateReset {
|
|
46
44
|
static new() {
|
|
47
|
-
return new
|
|
45
|
+
return new _MigrateReset();
|
|
48
46
|
}
|
|
47
|
+
static help = (0, import_internals.format)(`
|
|
48
|
+
Reset your database and apply all migrations, all data will be lost
|
|
49
|
+
|
|
50
|
+
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
51
|
+
|
|
52
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset [options]
|
|
53
|
+
|
|
54
|
+
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
55
|
+
|
|
56
|
+
-h, --help Display this help message
|
|
57
|
+
--config Custom path to your Prisma config file
|
|
58
|
+
--schema Custom path to your Prisma schema
|
|
59
|
+
--skip-generate Skip triggering generators (e.g. Prisma Client)
|
|
60
|
+
--skip-seed Skip triggering seed
|
|
61
|
+
-f, --force Skip the confirmation prompt
|
|
62
|
+
|
|
63
|
+
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
64
|
+
|
|
65
|
+
Reset your database and apply all migrations, all data will be lost
|
|
66
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset
|
|
67
|
+
|
|
68
|
+
Specify a schema
|
|
69
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset --schema=./schema.prisma
|
|
70
|
+
|
|
71
|
+
Use --force to skip the confirmation prompt
|
|
72
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset --force
|
|
73
|
+
`);
|
|
49
74
|
async parse(argv, config) {
|
|
50
75
|
const args = (0, import_internals.arg)(argv, {
|
|
51
76
|
"--help": Boolean,
|
|
@@ -61,15 +86,19 @@ var _MigrateReset = class _MigrateReset2 {
|
|
|
61
86
|
if ((0, import_internals.isError)(args)) {
|
|
62
87
|
return this.help(args.message);
|
|
63
88
|
}
|
|
64
|
-
await (0, import_internals.checkUnsupportedDataProxy)("migrate reset", args, config.schema, true);
|
|
65
89
|
if (args["--help"]) {
|
|
66
90
|
return this.help();
|
|
67
91
|
}
|
|
68
92
|
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
69
|
-
const
|
|
70
|
-
|
|
93
|
+
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
94
|
+
schemaPathFromArg: args["--schema"],
|
|
95
|
+
schemaPathFromConfig: config.schema
|
|
96
|
+
});
|
|
97
|
+
const { migrationsDirPath } = (0, import_internals.inferDirectoryConfig)(schemaContext);
|
|
98
|
+
const datasourceInfo = (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext.primaryDatasource);
|
|
71
99
|
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo });
|
|
72
|
-
|
|
100
|
+
(0, import_internals.checkUnsupportedDataProxy)({ cmd: "migrate reset", schemaContext });
|
|
101
|
+
const wasDbCreated = await (0, import_chunk_74LUB4XX.ensureDatabaseExists)(schemaContext.primaryDatasource);
|
|
73
102
|
if (wasDbCreated) {
|
|
74
103
|
process.stdout.write("\n" + wasDbCreated + "\n");
|
|
75
104
|
}
|
|
@@ -89,7 +118,7 @@ var _MigrateReset = class _MigrateReset2 {
|
|
|
89
118
|
process.exit(130);
|
|
90
119
|
}
|
|
91
120
|
}
|
|
92
|
-
const migrate = new
|
|
121
|
+
const migrate = new import_chunk_PDCXVUV3.Migrate(schemaContext, migrationsDirPath);
|
|
93
122
|
let migrationIds;
|
|
94
123
|
try {
|
|
95
124
|
await migrate.reset();
|
|
@@ -108,7 +137,7 @@ var _MigrateReset = class _MigrateReset2 {
|
|
|
108
137
|
|
|
109
138
|
The following migration(s) have been applied:
|
|
110
139
|
|
|
111
|
-
${(0,
|
|
140
|
+
${(0, import_chunk_KRQEFTDT.printFilesFromMigrationIds)("migrations", migrationIds, {
|
|
112
141
|
"migration.sql": ""
|
|
113
142
|
})}
|
|
114
143
|
`
|
|
@@ -118,10 +147,10 @@ ${(0, import_chunk_255BRND3.printFilesFromMigrationIds)("migrations", migrationI
|
|
|
118
147
|
await migrate.tryToRunGenerate(datasourceInfo);
|
|
119
148
|
}
|
|
120
149
|
if (!process.env.PRISMA_MIGRATE_SKIP_SEED && !args["--skip-seed"]) {
|
|
121
|
-
const seedCommandFromPkgJson = await (0,
|
|
150
|
+
const seedCommandFromPkgJson = await (0, import_chunk_5LKIRKDL.getSeedCommandFromPackageJson)(process.cwd());
|
|
122
151
|
if (seedCommandFromPkgJson) {
|
|
123
152
|
process.stdout.write("\n");
|
|
124
|
-
const successfulSeeding = await (0,
|
|
153
|
+
const successfulSeeding = await (0, import_chunk_5LKIRKDL.executeSeedCommand)({ commandFromConfig: seedCommandFromPkgJson });
|
|
125
154
|
if (successfulSeeding) {
|
|
126
155
|
process.stdout.write(`
|
|
127
156
|
${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.
|
|
@@ -129,9 +158,6 @@ ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been ex
|
|
|
129
158
|
} else {
|
|
130
159
|
process.exit(1);
|
|
131
160
|
}
|
|
132
|
-
} else {
|
|
133
|
-
const { schemaPath: schemaPath2 } = await (0, import_internals.getSchemaWithPath)(args["--schema"], config.schema);
|
|
134
|
-
await (0, import_chunk_V3ZMNXZC.verifySeedConfigAndReturnMessage)(schemaPath2);
|
|
135
161
|
}
|
|
136
162
|
}
|
|
137
163
|
return ``;
|
|
@@ -140,36 +166,8 @@ ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been ex
|
|
|
140
166
|
if (error) {
|
|
141
167
|
return new import_internals.HelpError(`
|
|
142
168
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
143
|
-
${
|
|
169
|
+
${_MigrateReset.help}`);
|
|
144
170
|
}
|
|
145
|
-
return
|
|
171
|
+
return _MigrateReset.help;
|
|
146
172
|
}
|
|
147
173
|
};
|
|
148
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(_MigrateReset, "help", (0, import_internals.format)(`
|
|
149
|
-
Reset your database and apply all migrations, all data will be lost
|
|
150
|
-
|
|
151
|
-
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
152
|
-
|
|
153
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset [options]
|
|
154
|
-
|
|
155
|
-
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
156
|
-
|
|
157
|
-
-h, --help Display this help message
|
|
158
|
-
--config Custom path to your Prisma config file
|
|
159
|
-
--schema Custom path to your Prisma schema
|
|
160
|
-
--skip-generate Skip triggering generators (e.g. Prisma Client)
|
|
161
|
-
--skip-seed Skip triggering seed
|
|
162
|
-
-f, --force Skip the confirmation prompt
|
|
163
|
-
|
|
164
|
-
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
165
|
-
|
|
166
|
-
Reset your database and apply all migrations, all data will be lost
|
|
167
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset
|
|
168
|
-
|
|
169
|
-
Specify a schema
|
|
170
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset --schema=./schema.prisma
|
|
171
|
-
|
|
172
|
-
Use --force to skip the confirmation prompt
|
|
173
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset --force
|
|
174
|
-
`));
|
|
175
|
-
var MigrateReset = _MigrateReset;
|