@prisma/migrate 6.20.0-integration-merge-release-workflows2.1 → 6.20.0-integration-next.4
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 +5 -7
- package/dist/SchemaEngineCLI.js +4 -4
- package/dist/SchemaEngineWasm.js +4 -4
- package/dist/bin.js +59 -62
- package/dist/{chunk-TW22Y3AA.js → chunk-272GEALL.js} +19 -23
- package/dist/{chunk-NB4FRYRQ.js → chunk-3I675WMS.js} +6 -6
- package/dist/{chunk-R4IWP35Z.js → chunk-ANKMSTAX.js} +12 -15
- package/dist/{chunk-6ORQRJLP.js → chunk-D7TRYHBP.js} +30 -114
- package/dist/{chunk-F2XCBEZ4.js → chunk-EC6XGJS6.js} +16 -45
- package/dist/{chunk-7TVX3D4W.js → chunk-F6PHYOSL.js} +27 -65
- package/dist/{chunk-OP2BDF75.js → chunk-FRY7T46S.js} +10 -11
- package/dist/{chunk-22YP3RXZ.js → chunk-GH6IOZTT.js} +7 -7
- package/dist/{chunk-VU5BLQUI.js → chunk-HFRA2WBM.js} +223 -22
- package/dist/{chunk-J33EXHZB.js → chunk-HNEFGYLW.js} +15 -38
- package/dist/{chunk-74LUB4XX.js → chunk-K4HINZKE.js} +27 -37
- package/dist/{chunk-PHXLQVPT.js → chunk-L7EZFBB4.js} +40 -68
- package/dist/{chunk-AXR7LS2N.js → chunk-PEUHUCS4.js} +4 -5
- package/dist/{chunk-BHJMJSM4.js → chunk-PI5GR2QW.js} +20 -19
- package/dist/{chunk-ZTIS675B.js → chunk-PYDC3Q6V.js} +136 -205
- package/dist/{chunk-Z27SI4AV.js → chunk-R2N4YKAR.js} +9 -7
- package/dist/{chunk-GSX25HRL.js → chunk-SYWL5XS4.js} +5 -5
- package/dist/{chunk-D4TRX77Y.js → chunk-WF7UXKO5.js} +6 -9
- package/dist/chunk-WHMCFTZO.js +176 -0
- package/dist/{chunk-3AKRTEIK.js → chunk-WQKZ5H57.js} +15 -18
- package/dist/{chunk-QVMYNWAN.js → chunk-XA2JOJS2.js} +157 -70
- package/dist/{chunk-O35BTK6Y.js → chunk-YFUB52PK.js} +9 -13
- package/dist/commands/DbDrop.js +3 -3
- package/dist/commands/DbExecute.js +6 -8
- package/dist/commands/DbPull.js +9 -11
- package/dist/commands/DbPush.js +7 -9
- package/dist/commands/DbSeed.js +3 -3
- package/dist/commands/MigrateDeploy.js +7 -9
- package/dist/commands/MigrateDev.js +7 -10
- package/dist/commands/MigrateDiff.js +7 -8
- package/dist/commands/MigrateReset.js +7 -10
- package/dist/commands/MigrateResolve.js +7 -9
- package/dist/commands/MigrateStatus.js +7 -9
- package/dist/index.js +37 -39
- package/dist/internals/src/cli/getSchema.d.ts +1 -15
- package/dist/migrate/src/Migrate.d.ts +1 -3
- package/dist/migrate/src/commands/MigrateDiff.d.ts +1 -0
- package/dist/migrate/src/utils/ensureDatabaseExists.d.ts +9 -3
- package/dist/migrate/src/utils/getDatabaseVersionSafe.d.ts +2 -1
- package/dist/migrate/src/utils/introspectSql.d.ts +2 -1
- package/dist/migrate/src/utils/seed.d.ts +0 -6
- package/dist/open-GFNXULGD.js +593 -0
- package/dist/utils/ensureDatabaseExists.js +6 -6
- package/dist/utils/getDatabaseVersionSafe.js +6 -8
- package/dist/utils/introspectSql.js +6 -8
- package/dist/utils/seed.js +2 -3
- package/dist/utils/setupCockroach.js +2 -2
- package/dist/utils/setupMSSQL.js +30734 -30124
- package/dist/utils/setupMongo.js +2048 -768
- package/dist/utils/setupPostgres.js +2 -2
- package/dist/utils/spinner.js +2 -3
- package/dist/views/handleViewsIO.js +2 -2
- package/package.json +11 -11
- package/dist/chunk-D6LYHB65.js +0 -905
- package/dist/chunk-RR6BKMNO.js +0 -80
- package/dist/chunk-VV4M6AN7.js +0 -233
- package/dist/migrate/src/utils/replaceOrAddDatasource.d.ts +0 -2
- package/dist/migrate/src/utils/replaceOrAddDatasource.test.d.ts +0 -1
- package/dist/utils/replaceOrAddDatasource.js +0 -25
- package/dist/utils/replaceOrAddDatasource.test.js +0 -207
|
@@ -26,16 +26,16 @@ 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_R2N4YKAR_exports = {};
|
|
30
|
+
__export(chunk_R2N4YKAR_exports, {
|
|
31
31
|
DbDrop: () => DbDrop
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_R2N4YKAR_exports);
|
|
34
34
|
var import_chunk_IHDN3L3R = require("./chunk-IHDN3L3R.js");
|
|
35
35
|
var import_chunk_FBDQVK4W = require("./chunk-FBDQVK4W.js");
|
|
36
36
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
37
37
|
var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
|
|
38
|
-
var
|
|
38
|
+
var import_chunk_K4HINZKE = require("./chunk-K4HINZKE.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"));
|
|
@@ -94,14 +94,13 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
94
94
|
if (!args["--preview-feature"]) {
|
|
95
95
|
throw new import_chunk_IHDN3L3R.PreviewFlagError();
|
|
96
96
|
}
|
|
97
|
-
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
98
97
|
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
99
98
|
schemaPathFromArg: args["--schema"],
|
|
100
99
|
schemaPathFromConfig: config.schema,
|
|
101
100
|
schemaEngineConfig: config
|
|
102
101
|
});
|
|
103
|
-
(0, import_internals.checkUnsupportedDataProxy)({ cmd: "db drop",
|
|
104
|
-
const datasourceInfo = (0,
|
|
102
|
+
(0, import_internals.checkUnsupportedDataProxy)({ cmd: "db drop", config });
|
|
103
|
+
const datasourceInfo = (0, import_chunk_K4HINZKE.parseDatasourceInfo)(schemaContext.primaryDatasource, config);
|
|
105
104
|
(0, import_chunk_2FXU5NZQ.printDatasource)({ datasourceInfo });
|
|
106
105
|
process.stdout.write("\n");
|
|
107
106
|
if (!args["--force"]) {
|
|
@@ -124,6 +123,9 @@ ${(0, import_chunk_SKRR5WT4.red)("All data will be lost")}.`
|
|
|
124
123
|
}
|
|
125
124
|
}
|
|
126
125
|
(0, import_chunk_FBDQVK4W.aiAgentConfirmationCheckpoint)();
|
|
126
|
+
if (datasourceInfo.url === void 0) {
|
|
127
|
+
throw new Error("Datasource URL is undefined");
|
|
128
|
+
}
|
|
127
129
|
if (await (0, import_internals.dropDatabase)(datasourceInfo.url, datasourceInfo.configDir)) {
|
|
128
130
|
return `${process.platform === "win32" ? "" : "\u{1F680} "}The ${datasourceInfo.prettyProvider} database "${datasourceInfo.dbName}" from "${datasourceInfo.dbLocation}" was successfully dropped.
|
|
129
131
|
`;
|
|
@@ -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_SYWL5XS4_exports = {};
|
|
30
|
+
__export(chunk_SYWL5XS4_exports, {
|
|
31
31
|
EngineError: () => EngineError,
|
|
32
32
|
SchemaEngineCLI: () => SchemaEngineCLI
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
35
|
-
var
|
|
34
|
+
module.exports = __toCommonJS(chunk_SYWL5XS4_exports);
|
|
35
|
+
var import_chunk_PEUHUCS4 = require("./chunk-PEUHUCS4.js");
|
|
36
36
|
var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
|
|
37
37
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
38
38
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
@@ -188,7 +188,7 @@ var SchemaEngineCLI = class _SchemaEngineCLI {
|
|
|
188
188
|
);
|
|
189
189
|
const { views } = introspectResult;
|
|
190
190
|
if (views) {
|
|
191
|
-
await (0,
|
|
191
|
+
await (0, import_chunk_PEUHUCS4.handleViewsIO)({ views, viewsDirectoryPath });
|
|
192
192
|
}
|
|
193
193
|
return introspectResult;
|
|
194
194
|
} finally {
|
|
@@ -16,12 +16,12 @@ 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_WF7UXKO5_exports = {};
|
|
20
|
+
__export(chunk_WF7UXKO5_exports, {
|
|
21
21
|
DbSeed: () => DbSeed
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_WF7UXKO5_exports);
|
|
24
|
+
var import_chunk_L7EZFBB4 = require("./chunk-L7EZFBB4.js");
|
|
25
25
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
26
26
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
27
27
|
var import_internals = require("@prisma/internals");
|
|
@@ -213,13 +213,10 @@ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db seed -- --arg1 value1 --arg2 va
|
|
|
213
213
|
if (args["--help"]) {
|
|
214
214
|
return this.help();
|
|
215
215
|
}
|
|
216
|
-
|
|
217
|
-
const seedCommandFromPrismaConfig = config.migrations?.seed;
|
|
218
|
-
const seedCommandFromPkgJson = await (0, import_chunk_PHXLQVPT.getSeedCommandFromPackageJson)(process.cwd());
|
|
219
|
-
const seedCommand = seedCommandFromPrismaConfig ?? seedCommandFromPkgJson;
|
|
216
|
+
const seedCommand = config.migrations?.seed;
|
|
220
217
|
if (!seedCommand) return ``;
|
|
221
218
|
const extraArgs = args._.join(" ");
|
|
222
|
-
const successfulSeeding = await (0,
|
|
219
|
+
const successfulSeeding = await (0, import_chunk_L7EZFBB4.executeSeedCommand)({ commandFromConfig: seedCommand, extraArgs });
|
|
223
220
|
if (successfulSeeding) {
|
|
224
221
|
return `
|
|
225
222
|
${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.`;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var chunk_WHMCFTZO_exports = {};
|
|
20
|
+
__export(chunk_WHMCFTZO_exports, {
|
|
21
|
+
Migrate: () => Migrate
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(chunk_WHMCFTZO_exports);
|
|
24
|
+
var import_chunk_T64SUJ5L = require("./chunk-T64SUJ5L.js");
|
|
25
|
+
var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
|
|
26
|
+
var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
|
|
27
|
+
var import_chunk_GH6IOZTT = require("./chunk-GH6IOZTT.js");
|
|
28
|
+
var import_chunk_SYWL5XS4 = require("./chunk-SYWL5XS4.js");
|
|
29
|
+
var import_internals = require("@prisma/internals");
|
|
30
|
+
var Migrate = class _Migrate {
|
|
31
|
+
engine;
|
|
32
|
+
schemaContext;
|
|
33
|
+
schemaFilter;
|
|
34
|
+
shadowDbInitScript;
|
|
35
|
+
migrationsDirectoryPath;
|
|
36
|
+
constructor({ schemaContext, migrationsDirPath, engine, schemaFilter, shadowDbInitScript }) {
|
|
37
|
+
this.engine = engine;
|
|
38
|
+
this.schemaContext = schemaContext;
|
|
39
|
+
this.migrationsDirectoryPath = migrationsDirPath;
|
|
40
|
+
this.schemaFilter = schemaFilter ?? { externalTables: [], externalEnums: [] };
|
|
41
|
+
this.shadowDbInitScript = shadowDbInitScript ?? "";
|
|
42
|
+
}
|
|
43
|
+
static async setup({ schemaContext, schemaEngineConfig, ...rest }) {
|
|
44
|
+
const schemaEngine = await (async () => {
|
|
45
|
+
if (schemaEngineConfig.engine === "js") {
|
|
46
|
+
const adapter = await schemaEngineConfig.adapter();
|
|
47
|
+
(0, import_chunk_T64SUJ5L.warnDatasourceDriverAdapter)(schemaContext);
|
|
48
|
+
return await import_chunk_GH6IOZTT.SchemaEngineWasm.setup({ adapter, schemaContext, ...rest });
|
|
49
|
+
}
|
|
50
|
+
const datasource = schemaEngineConfig.engine === "classic" ? schemaEngineConfig.datasource : void 0;
|
|
51
|
+
return await import_chunk_SYWL5XS4.SchemaEngineCLI.setup({ datasource, schemaContext, ...rest });
|
|
52
|
+
})();
|
|
53
|
+
return new _Migrate({ engine: schemaEngine, schemaContext, ...rest });
|
|
54
|
+
}
|
|
55
|
+
async stop() {
|
|
56
|
+
await this.engine.stop();
|
|
57
|
+
}
|
|
58
|
+
getPrismaSchema() {
|
|
59
|
+
if (!this.schemaContext) throw new Error("this.schemaContext is undefined");
|
|
60
|
+
return (0, import_internals.toSchemasContainer)(this.schemaContext.schemaFiles);
|
|
61
|
+
}
|
|
62
|
+
reset() {
|
|
63
|
+
return this.engine.reset({
|
|
64
|
+
filter: this.schemaFilter
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
async createMigration(params) {
|
|
68
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
69
|
+
const migrationsList = await (0, import_chunk_GGA2F64G.listMigrations)(this.migrationsDirectoryPath, this.shadowDbInitScript);
|
|
70
|
+
const { connectorType, generatedMigrationName, extension, migrationScript } = await this.engine.createMigration({
|
|
71
|
+
...params,
|
|
72
|
+
migrationsList,
|
|
73
|
+
filters: this.schemaFilter
|
|
74
|
+
});
|
|
75
|
+
const { baseDir, lockfile } = migrationsList;
|
|
76
|
+
if (migrationScript === null) {
|
|
77
|
+
return {
|
|
78
|
+
generatedMigrationName: void 0
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const directoryPath = await (0, import_chunk_23DZXSTI.createMigration)({
|
|
82
|
+
baseDir,
|
|
83
|
+
generatedMigrationName
|
|
84
|
+
}).catch((e) => {
|
|
85
|
+
throw new Error(`Failed to create a new migration directory: ${e.message}`);
|
|
86
|
+
});
|
|
87
|
+
await (0, import_chunk_23DZXSTI.writeMigrationScript)({
|
|
88
|
+
baseDir,
|
|
89
|
+
extension,
|
|
90
|
+
migrationName: generatedMigrationName,
|
|
91
|
+
script: migrationScript
|
|
92
|
+
}).catch((e) => {
|
|
93
|
+
throw new Error(`Failed to write migration script to ${directoryPath}: ${e.message}`);
|
|
94
|
+
});
|
|
95
|
+
await (0, import_chunk_23DZXSTI.writeMigrationLockfile)({
|
|
96
|
+
baseDir,
|
|
97
|
+
connectorType,
|
|
98
|
+
lockfile
|
|
99
|
+
}).catch((e) => {
|
|
100
|
+
throw new Error(`Failed to write the migration lock file to ${baseDir}: ${e.message}`);
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
generatedMigrationName
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
async diagnoseMigrationHistory({
|
|
107
|
+
optInToShadowDatabase
|
|
108
|
+
}) {
|
|
109
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
110
|
+
const migrationsList = await (0, import_chunk_GGA2F64G.listMigrations)(this.migrationsDirectoryPath, this.shadowDbInitScript);
|
|
111
|
+
return this.engine.diagnoseMigrationHistory({
|
|
112
|
+
migrationsList,
|
|
113
|
+
optInToShadowDatabase,
|
|
114
|
+
filters: this.schemaFilter
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
async listMigrationDirectories() {
|
|
118
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
119
|
+
const migrationsList = await (0, import_chunk_GGA2F64G.listMigrations)(this.migrationsDirectoryPath, this.shadowDbInitScript);
|
|
120
|
+
return {
|
|
121
|
+
migrations: migrationsList.migrationDirectories.map((dir) => dir.path)
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
async devDiagnostic() {
|
|
125
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
126
|
+
const migrationsList = await (0, import_chunk_GGA2F64G.listMigrations)(this.migrationsDirectoryPath, this.shadowDbInitScript);
|
|
127
|
+
return this.engine.devDiagnostic({
|
|
128
|
+
migrationsList,
|
|
129
|
+
filters: this.schemaFilter
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
async markMigrationApplied({ migrationId }) {
|
|
133
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
134
|
+
const migrationsList = await (0, import_chunk_GGA2F64G.listMigrations)(this.migrationsDirectoryPath, this.shadowDbInitScript);
|
|
135
|
+
return await this.engine.markMigrationApplied({
|
|
136
|
+
migrationsList,
|
|
137
|
+
migrationName: migrationId
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
markMigrationRolledBack({ migrationId }) {
|
|
141
|
+
return this.engine.markMigrationRolledBack({
|
|
142
|
+
migrationName: migrationId
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
async applyMigrations() {
|
|
146
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
147
|
+
const migrationsList = await (0, import_chunk_GGA2F64G.listMigrations)(this.migrationsDirectoryPath, this.shadowDbInitScript);
|
|
148
|
+
return this.engine.applyMigrations({
|
|
149
|
+
migrationsList,
|
|
150
|
+
filters: this.schemaFilter
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
async evaluateDataLoss() {
|
|
154
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
155
|
+
const migrationsList = await (0, import_chunk_GGA2F64G.listMigrations)(this.migrationsDirectoryPath, this.shadowDbInitScript);
|
|
156
|
+
const schema = this.getPrismaSchema();
|
|
157
|
+
return this.engine.evaluateDataLoss({
|
|
158
|
+
migrationsList,
|
|
159
|
+
schema,
|
|
160
|
+
filters: this.schemaFilter
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
async push({ force = false }) {
|
|
164
|
+
const schema = this.getPrismaSchema();
|
|
165
|
+
const { warnings, unexecutable, executedSteps } = await this.engine.schemaPush({
|
|
166
|
+
force,
|
|
167
|
+
schema,
|
|
168
|
+
filters: this.schemaFilter
|
|
169
|
+
});
|
|
170
|
+
return {
|
|
171
|
+
executedSteps,
|
|
172
|
+
warnings,
|
|
173
|
+
unexecutable
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
};
|
|
@@ -16,14 +16,14 @@ 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_WQKZ5H57_exports = {};
|
|
20
|
+
__export(chunk_WQKZ5H57_exports, {
|
|
21
21
|
MigrateResolve: () => MigrateResolve
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(chunk_WQKZ5H57_exports);
|
|
24
24
|
var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
|
|
25
|
-
var
|
|
26
|
-
var
|
|
25
|
+
var import_chunk_K4HINZKE = require("./chunk-K4HINZKE.js");
|
|
26
|
+
var import_chunk_WHMCFTZO = require("./chunk-WHMCFTZO.js");
|
|
27
27
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
28
28
|
var import_internals = require("@prisma/internals");
|
|
29
29
|
var MigrateResolve = class _MigrateResolve {
|
|
@@ -31,7 +31,7 @@ var MigrateResolve = class _MigrateResolve {
|
|
|
31
31
|
return new _MigrateResolve();
|
|
32
32
|
}
|
|
33
33
|
static help = (0, import_internals.format)(`
|
|
34
|
-
Resolve issues with database migrations in deployment databases:
|
|
34
|
+
Resolve issues with database migrations in deployment databases:
|
|
35
35
|
- recover from failed migrations
|
|
36
36
|
- baseline databases when starting to use Prisma Migrate on existing databases
|
|
37
37
|
- reconcile hotfixes done manually on databases with your migration history
|
|
@@ -39,11 +39,11 @@ Resolve issues with database migrations in deployment databases:
|
|
|
39
39
|
Run "prisma migrate status" to identify if you need to use resolve.
|
|
40
40
|
|
|
41
41
|
Read more about resolving migration history issues: ${(0, import_internals.link)("https://pris.ly/d/migrate-resolve")}
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
44
44
|
|
|
45
45
|
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve [options]
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
48
48
|
|
|
49
49
|
-h, --help Display this help message
|
|
@@ -54,7 +54,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
|
54
54
|
|
|
55
55
|
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
56
56
|
|
|
57
|
-
Update migrations table, recording a specific migration as applied
|
|
57
|
+
Update migrations table, recording a specific migration as applied
|
|
58
58
|
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --applied 20201231000000_add_users_table
|
|
59
59
|
|
|
60
60
|
Update migrations table, recording a specific migration as rolled back
|
|
@@ -83,7 +83,6 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
83
83
|
if (args["--help"]) {
|
|
84
84
|
return this.help();
|
|
85
85
|
}
|
|
86
|
-
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
87
86
|
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
88
87
|
schemaPathFromArg: args["--schema"],
|
|
89
88
|
schemaPathFromConfig: config.schema,
|
|
@@ -91,8 +90,8 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
91
90
|
});
|
|
92
91
|
const { migrationsDirPath } = (0, import_internals.inferDirectoryConfig)(schemaContext, config);
|
|
93
92
|
const adapter = config.engine === "js" ? await config.adapter() : void 0;
|
|
94
|
-
(0, import_internals.checkUnsupportedDataProxy)({ cmd: "migrate resolve",
|
|
95
|
-
(0, import_chunk_2FXU5NZQ.printDatasource)({ datasourceInfo: (0,
|
|
93
|
+
(0, import_internals.checkUnsupportedDataProxy)({ cmd: "migrate resolve", config });
|
|
94
|
+
(0, import_chunk_2FXU5NZQ.printDatasource)({ datasourceInfo: (0, import_chunk_K4HINZKE.parseDatasourceInfo)(schemaContext.primaryDatasource, config), adapter });
|
|
96
95
|
if (!args["--applied"] && !args["--rolled-back"]) {
|
|
97
96
|
throw new Error(
|
|
98
97
|
`--applied or --rolled-back must be part of the command like:
|
|
@@ -110,10 +109,8 @@ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_in
|
|
|
110
109
|
)}`
|
|
111
110
|
);
|
|
112
111
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
const migrate = await import_chunk_D6LYHB65.Migrate.setup({
|
|
112
|
+
await (0, import_chunk_K4HINZKE.ensureCanConnectToDatabase)(schemaContext.primaryDatasourceDirectory, config);
|
|
113
|
+
const migrate = await import_chunk_WHMCFTZO.Migrate.setup({
|
|
117
114
|
schemaEngineConfig: config,
|
|
118
115
|
migrationsDirPath,
|
|
119
116
|
schemaContext,
|
|
@@ -138,8 +135,8 @@ Migration ${args["--applied"]} marked as applied.
|
|
|
138
135
|
)}`
|
|
139
136
|
);
|
|
140
137
|
}
|
|
141
|
-
await (0,
|
|
142
|
-
const migrate = await
|
|
138
|
+
await (0, import_chunk_K4HINZKE.ensureCanConnectToDatabase)(schemaContext.primaryDatasourceDirectory, config);
|
|
139
|
+
const migrate = await import_chunk_WHMCFTZO.Migrate.setup({
|
|
143
140
|
schemaEngineConfig: config,
|
|
144
141
|
migrationsDirPath,
|
|
145
142
|
schemaContext,
|