@prisma/migrate 6.6.0-dev.28 → 6.6.0-dev.29
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 -3
- package/dist/SchemaEngine.js +3 -3
- package/dist/bin.js +28 -26
- package/dist/chunk-23DZXSTI.js +62 -0
- package/dist/{chunk-VVP3QZ7Q.js → chunk-5Q5BJS5B.js} +63 -20
- package/dist/{chunk-47RUC4JR.js → chunk-63ZT25OL.js} +5 -5
- package/dist/{chunk-IWC5MH4R.js → chunk-ABQZ5J74.js} +5 -5
- package/dist/{chunk-WR2C56DM.js → chunk-AM7BRZFD.js} +5 -5
- package/dist/{chunk-Y4DAOJ7D.js → chunk-BUAYZ4KA.js} +5 -5
- package/dist/{chunk-K43RXWQY.js → chunk-GHZAN2PG.js} +3 -9
- package/dist/{chunk-YQBUDHMZ.js → chunk-HQJ7FIWN.js} +6 -6
- package/dist/{chunk-QDOXBF4N.js → chunk-IRYXRMQC.js} +5 -5
- package/dist/{chunk-E4LVVJWG.js → chunk-LAEOX7QH.js} +5 -5
- package/dist/{chunk-MKS2ZJJ5.js → chunk-MTJFLQI4.js} +5 -5
- package/dist/{chunk-DTHO2IRV.js → chunk-SCH55BRJ.js} +7 -7
- package/dist/{chunk-DQMYH4YE.js → chunk-U6ZL4ORM.js} +10 -9
- package/dist/chunk-V6PVGSDJ.js +76 -0
- package/dist/{chunk-YVMQRD65.js → chunk-WX6S3QMO.js} +11 -10
- package/dist/{chunk-EJ6HP3SA.js → chunk-ZCR4PTT3.js} +5 -6
- package/dist/commands/DbExecute.js +6 -4
- package/dist/commands/DbPull.js +5 -5
- package/dist/commands/DbPush.js +6 -4
- package/dist/commands/MigrateDeploy.js +6 -4
- package/dist/commands/MigrateDev.js +6 -4
- package/dist/commands/MigrateDiff.js +7 -5
- package/dist/commands/MigrateReset.js +6 -4
- package/dist/commands/MigrateResolve.js +6 -4
- package/dist/commands/MigrateStatus.js +6 -4
- package/dist/index.js +31 -29
- 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/listMigrations.d.ts +9 -0
- package/dist/utils/createMigration.js +27 -0
- package/dist/utils/getDatabaseVersionSafe.js +3 -3
- package/dist/utils/introspectSql.js +3 -3
- package/dist/utils/listMigrations.js +25 -0
- package/dist/utils/setupMSSQL.js +1 -1
- package/package.json +7 -7
package/dist/Migrate.js
CHANGED
|
@@ -18,12 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var Migrate_exports = {};
|
|
20
20
|
__export(Migrate_exports, {
|
|
21
|
-
Migrate: () =>
|
|
21
|
+
Migrate: () => import_chunk_5Q5BJS5B.Migrate
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(Migrate_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_chunk_5Q5BJS5B = require("./chunk-5Q5BJS5B.js");
|
|
25
|
+
var import_chunk_V6PVGSDJ = require("./chunk-V6PVGSDJ.js");
|
|
26
|
+
var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
|
|
25
27
|
var import_chunk_URKH6SE2 = require("./chunk-URKH6SE2.js");
|
|
26
|
-
var
|
|
28
|
+
var import_chunk_GHZAN2PG = require("./chunk-GHZAN2PG.js");
|
|
27
29
|
var import_chunk_G7PJKEOV = require("./chunk-G7PJKEOV.js");
|
|
28
30
|
var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
|
|
29
31
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
package/dist/SchemaEngine.js
CHANGED
|
@@ -18,11 +18,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var SchemaEngine_exports = {};
|
|
20
20
|
__export(SchemaEngine_exports, {
|
|
21
|
-
EngineError: () =>
|
|
22
|
-
SchemaEngine: () =>
|
|
21
|
+
EngineError: () => import_chunk_GHZAN2PG.EngineError,
|
|
22
|
+
SchemaEngine: () => import_chunk_GHZAN2PG.SchemaEngine
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(SchemaEngine_exports);
|
|
25
|
-
var
|
|
25
|
+
var import_chunk_GHZAN2PG = require("./chunk-GHZAN2PG.js");
|
|
26
26
|
var import_chunk_G7PJKEOV = require("./chunk-G7PJKEOV.js");
|
|
27
27
|
var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
|
|
28
28
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
package/dist/bin.js
CHANGED
|
@@ -23,38 +23,40 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
mod
|
|
24
24
|
));
|
|
25
25
|
var import_chunk_NGQA5JTN = require("./chunk-NGQA5JTN.js");
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
26
|
+
var import_chunk_MTJFLQI4 = require("./chunk-MTJFLQI4.js");
|
|
27
|
+
var import_chunk_AM7BRZFD = require("./chunk-AM7BRZFD.js");
|
|
28
|
+
var import_chunk_HQJ7FIWN = require("./chunk-HQJ7FIWN.js");
|
|
29
|
+
var import_chunk_BUAYZ4KA = require("./chunk-BUAYZ4KA.js");
|
|
30
|
+
var import_chunk_LAEOX7QH = require("./chunk-LAEOX7QH.js");
|
|
31
|
+
var import_chunk_SCH55BRJ = require("./chunk-SCH55BRJ.js");
|
|
32
32
|
var import_chunk_IINN7QUV = require("./chunk-IINN7QUV.js");
|
|
33
|
+
var import_chunk_JZ75RIMZ = require("./chunk-JZ75RIMZ.js");
|
|
34
|
+
var import_chunk_RR6BKMNO = require("./chunk-RR6BKMNO.js");
|
|
33
35
|
var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
|
|
34
36
|
var import_chunk_AI6DH66U = require("./chunk-AI6DH66U.js");
|
|
35
37
|
var import_chunk_AHJ2N6BJ = require("./chunk-AHJ2N6BJ.js");
|
|
36
|
-
var import_chunk_JZ75RIMZ = require("./chunk-JZ75RIMZ.js");
|
|
37
|
-
var import_chunk_RR6BKMNO = require("./chunk-RR6BKMNO.js");
|
|
38
38
|
var import_chunk_JFKDSUIE = require("./chunk-JFKDSUIE.js");
|
|
39
39
|
var import_chunk_LGYRZ6CV = require("./chunk-LGYRZ6CV.js");
|
|
40
|
-
var
|
|
40
|
+
var import_chunk_63ZT25OL = require("./chunk-63ZT25OL.js");
|
|
41
41
|
var import_chunk_B4SUSDC2 = require("./chunk-B4SUSDC2.js");
|
|
42
42
|
var import_chunk_LLO7YF56 = require("./chunk-LLO7YF56.js");
|
|
43
|
-
var
|
|
44
|
-
var
|
|
43
|
+
var import_chunk_IRYXRMQC = require("./chunk-IRYXRMQC.js");
|
|
44
|
+
var import_chunk_ZCR4PTT3 = require("./chunk-ZCR4PTT3.js");
|
|
45
45
|
var import_chunk_YBX7R3MT = require("./chunk-YBX7R3MT.js");
|
|
46
46
|
var import_chunk_7CQBDP4H = require("./chunk-7CQBDP4H.js");
|
|
47
47
|
var import_chunk_5LKIRKDL = require("./chunk-5LKIRKDL.js");
|
|
48
48
|
var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
|
|
49
49
|
var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
|
|
50
50
|
var import_chunk_2R6DII47 = require("./chunk-2R6DII47.js");
|
|
51
|
-
var
|
|
52
|
-
var import_chunk_ZB5NPOJW = require("./chunk-ZB5NPOJW.js");
|
|
51
|
+
var import_chunk_WX6S3QMO = require("./chunk-WX6S3QMO.js");
|
|
53
52
|
var import_chunk_33LPBNDX = require("./chunk-33LPBNDX.js");
|
|
53
|
+
var import_chunk_ZB5NPOJW = require("./chunk-ZB5NPOJW.js");
|
|
54
54
|
var import_chunk_VAJ4VX67 = require("./chunk-VAJ4VX67.js");
|
|
55
|
-
var
|
|
55
|
+
var import_chunk_5Q5BJS5B = require("./chunk-5Q5BJS5B.js");
|
|
56
|
+
var import_chunk_V6PVGSDJ = require("./chunk-V6PVGSDJ.js");
|
|
57
|
+
var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
|
|
56
58
|
var import_chunk_URKH6SE2 = require("./chunk-URKH6SE2.js");
|
|
57
|
-
var
|
|
59
|
+
var import_chunk_GHZAN2PG = require("./chunk-GHZAN2PG.js");
|
|
58
60
|
var import_chunk_G7PJKEOV = require("./chunk-G7PJKEOV.js");
|
|
59
61
|
var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
|
|
60
62
|
var import_chunk_EJG7GKM7 = require("./chunk-EJG7GKM7.js");
|
|
@@ -68,7 +70,7 @@ var import_config = require("@prisma/config");
|
|
|
68
70
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
69
71
|
var import_engines_version = require("@prisma/engines-version");
|
|
70
72
|
var import_internals = require("@prisma/internals");
|
|
71
|
-
var version = "6.6.0-dev.
|
|
73
|
+
var version = "6.6.0-dev.29";
|
|
72
74
|
process.on("uncaughtException", (e) => {
|
|
73
75
|
console.log(e);
|
|
74
76
|
});
|
|
@@ -90,17 +92,17 @@ var args = (0, import_internals.arg)(
|
|
|
90
92
|
async function main() {
|
|
91
93
|
const cli = import_chunk_NGQA5JTN.CLI.new({
|
|
92
94
|
migrate: import_chunk_LLO7YF56.MigrateCommand.new({
|
|
93
|
-
dev:
|
|
94
|
-
status:
|
|
95
|
-
resolve:
|
|
96
|
-
reset:
|
|
97
|
-
deploy:
|
|
98
|
-
diff:
|
|
95
|
+
dev: import_chunk_ZCR4PTT3.MigrateDev.new(),
|
|
96
|
+
status: import_chunk_BUAYZ4KA.MigrateStatus.new(),
|
|
97
|
+
resolve: import_chunk_HQJ7FIWN.MigrateResolve.new(),
|
|
98
|
+
reset: import_chunk_AM7BRZFD.MigrateReset.new(),
|
|
99
|
+
deploy: import_chunk_IRYXRMQC.MigrateDeploy.new(),
|
|
100
|
+
diff: import_chunk_WX6S3QMO.MigrateDiff.new()
|
|
99
101
|
}),
|
|
100
102
|
db: import_chunk_EJG7GKM7.DbCommand.new({
|
|
101
|
-
execute:
|
|
102
|
-
pull:
|
|
103
|
-
push:
|
|
103
|
+
execute: import_chunk_LAEOX7QH.DbExecute.new(),
|
|
104
|
+
pull: import_chunk_SCH55BRJ.DbPull.new(),
|
|
105
|
+
push: import_chunk_63ZT25OL.DbPush.new(),
|
|
104
106
|
// drop: DbDrop.new(),
|
|
105
107
|
seed: import_chunk_B4SUSDC2.DbSeed.new()
|
|
106
108
|
})
|
|
@@ -132,7 +134,7 @@ main().then((code) => {
|
|
|
132
134
|
cliVersion: version,
|
|
133
135
|
enginesVersion: import_engines_version.enginesVersion,
|
|
134
136
|
command: commandArray.join(" "),
|
|
135
|
-
getDatabaseVersionSafe:
|
|
137
|
+
getDatabaseVersionSafe: import_chunk_MTJFLQI4.getDatabaseVersionSafe
|
|
136
138
|
}).catch((e) => {
|
|
137
139
|
if (import_debug.default.enabled("migrate")) {
|
|
138
140
|
console.error((0, import_chunk_SKRR5WT4.red)((0, import_chunk_SKRR5WT4.bold)("Error: ")) + e.stack);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var chunk_23DZXSTI_exports = {};
|
|
30
|
+
__export(chunk_23DZXSTI_exports, {
|
|
31
|
+
createMigration: () => createMigration,
|
|
32
|
+
writeMigrationLockfile: () => writeMigrationLockfile,
|
|
33
|
+
writeMigrationScript: () => writeMigrationScript
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(chunk_23DZXSTI_exports);
|
|
36
|
+
var import_node_fs = __toESM(require("node:fs"));
|
|
37
|
+
var import_node_path = __toESM(require("node:path"));
|
|
38
|
+
async function createMigration({ baseDir, generatedMigrationName }) {
|
|
39
|
+
const directoryPath = import_node_path.default.join(baseDir, generatedMigrationName);
|
|
40
|
+
if (import_node_fs.default.existsSync(directoryPath)) {
|
|
41
|
+
throw new Error(`The migration directory already exists at ${directoryPath}`);
|
|
42
|
+
}
|
|
43
|
+
await import_node_fs.default.promises.mkdir(directoryPath, { recursive: true, mode: 511 });
|
|
44
|
+
return directoryPath;
|
|
45
|
+
}
|
|
46
|
+
async function writeMigrationScript({
|
|
47
|
+
baseDir,
|
|
48
|
+
extension,
|
|
49
|
+
migrationName,
|
|
50
|
+
script
|
|
51
|
+
}) {
|
|
52
|
+
await import_node_fs.default.promises.writeFile(import_node_path.default.join(baseDir, migrationName, `migration.${extension}`), script, {
|
|
53
|
+
encoding: "utf-8"
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async function writeMigrationLockfile({ baseDir, connectorType, lockfile }) {
|
|
57
|
+
const lockfileContent = `# Please do not edit this file manually
|
|
58
|
+
# It should be added in your version-control system (e.g., Git)
|
|
59
|
+
provider = "${connectorType}"
|
|
60
|
+
`;
|
|
61
|
+
await import_node_fs.default.promises.writeFile(import_node_path.default.join(baseDir, lockfile.path), lockfileContent, { encoding: "utf-8" });
|
|
62
|
+
}
|
|
@@ -26,13 +26,15 @@ 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
|
-
__export2(
|
|
29
|
+
var chunk_5Q5BJS5B_exports = {};
|
|
30
|
+
__export2(chunk_5Q5BJS5B_exports, {
|
|
31
31
|
Migrate: () => Migrate
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_5Q5BJS5B_exports);
|
|
34
|
+
var import_chunk_V6PVGSDJ = require("./chunk-V6PVGSDJ.js");
|
|
35
|
+
var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
|
|
34
36
|
var import_chunk_URKH6SE2 = require("./chunk-URKH6SE2.js");
|
|
35
|
-
var
|
|
37
|
+
var import_chunk_GHZAN2PG = require("./chunk-GHZAN2PG.js");
|
|
36
38
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
37
39
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
38
40
|
var import_engines_version = require("@prisma/engines-version");
|
|
@@ -733,12 +735,12 @@ var Migrate = class {
|
|
|
733
735
|
if (schemaPath) {
|
|
734
736
|
this.schemaPath = import_path.default.resolve(process.cwd(), schemaPath);
|
|
735
737
|
this.migrationsDirectoryPath = import_path.default.join(import_path.default.dirname(this.schemaPath), "migrations");
|
|
736
|
-
this.engine = new
|
|
738
|
+
this.engine = new import_chunk_GHZAN2PG.SchemaEngine({
|
|
737
739
|
schemaPath: this.schemaPath,
|
|
738
740
|
enabledPreviewFeatures
|
|
739
741
|
});
|
|
740
742
|
} else {
|
|
741
|
-
this.engine = new
|
|
743
|
+
this.engine = new import_chunk_GHZAN2PG.SchemaEngine({
|
|
742
744
|
enabledPreviewFeatures
|
|
743
745
|
});
|
|
744
746
|
}
|
|
@@ -753,34 +755,73 @@ var Migrate = class {
|
|
|
753
755
|
reset() {
|
|
754
756
|
return this.engine.reset();
|
|
755
757
|
}
|
|
756
|
-
createMigration(params) {
|
|
757
|
-
|
|
758
|
+
async createMigration(params) {
|
|
759
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
760
|
+
const migrationsList = await (0, import_chunk_V6PVGSDJ.listMigrations)(this.migrationsDirectoryPath);
|
|
761
|
+
const { connectorType, generatedMigrationName, extension, migrationScript } = await this.engine.createMigration({
|
|
762
|
+
...params,
|
|
763
|
+
migrationsList
|
|
764
|
+
});
|
|
765
|
+
const { baseDir, lockfile } = migrationsList;
|
|
766
|
+
if (migrationScript === null) {
|
|
767
|
+
return {
|
|
768
|
+
generatedMigrationName: void 0
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
const directoryPath = await (0, import_chunk_23DZXSTI.createMigration)({
|
|
772
|
+
baseDir,
|
|
773
|
+
generatedMigrationName
|
|
774
|
+
}).catch((e) => {
|
|
775
|
+
throw new Error(`Failed to create a new migration directory: ${e.message}`);
|
|
776
|
+
});
|
|
777
|
+
await (0, import_chunk_23DZXSTI.writeMigrationScript)({
|
|
778
|
+
baseDir,
|
|
779
|
+
extension,
|
|
780
|
+
migrationName: generatedMigrationName,
|
|
781
|
+
script: migrationScript
|
|
782
|
+
}).catch((e) => {
|
|
783
|
+
throw new Error(`Failed to write migration script to ${directoryPath}: ${e.message}`);
|
|
784
|
+
});
|
|
785
|
+
await (0, import_chunk_23DZXSTI.writeMigrationLockfile)({
|
|
786
|
+
baseDir,
|
|
787
|
+
connectorType,
|
|
788
|
+
lockfile
|
|
789
|
+
}).catch((e) => {
|
|
790
|
+
throw new Error(`Failed to write the migration lock file to ${baseDir}: ${e.message}`);
|
|
791
|
+
});
|
|
792
|
+
return {
|
|
793
|
+
generatedMigrationName
|
|
794
|
+
};
|
|
758
795
|
}
|
|
759
|
-
diagnoseMigrationHistory({
|
|
796
|
+
async diagnoseMigrationHistory({
|
|
760
797
|
optInToShadowDatabase
|
|
761
798
|
}) {
|
|
762
799
|
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
800
|
+
const migrationsList = await (0, import_chunk_V6PVGSDJ.listMigrations)(this.migrationsDirectoryPath);
|
|
763
801
|
return this.engine.diagnoseMigrationHistory({
|
|
764
|
-
|
|
802
|
+
migrationsList,
|
|
765
803
|
optInToShadowDatabase
|
|
766
804
|
});
|
|
767
805
|
}
|
|
768
|
-
listMigrationDirectories() {
|
|
806
|
+
async listMigrationDirectories() {
|
|
769
807
|
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
808
|
+
const migrationsList = await (0, import_chunk_V6PVGSDJ.listMigrations)(this.migrationsDirectoryPath);
|
|
809
|
+
return {
|
|
810
|
+
migrations: migrationsList.migrationDirectories.map((dir) => dir.path)
|
|
811
|
+
};
|
|
773
812
|
}
|
|
774
|
-
devDiagnostic() {
|
|
813
|
+
async devDiagnostic() {
|
|
775
814
|
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
815
|
+
const migrationsList = await (0, import_chunk_V6PVGSDJ.listMigrations)(this.migrationsDirectoryPath);
|
|
776
816
|
return this.engine.devDiagnostic({
|
|
777
|
-
|
|
817
|
+
migrationsList
|
|
778
818
|
});
|
|
779
819
|
}
|
|
780
820
|
async markMigrationApplied({ migrationId }) {
|
|
781
821
|
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
822
|
+
const migrationsList = await (0, import_chunk_V6PVGSDJ.listMigrations)(this.migrationsDirectoryPath);
|
|
782
823
|
return await this.engine.markMigrationApplied({
|
|
783
|
-
|
|
824
|
+
migrationsList,
|
|
784
825
|
migrationName: migrationId
|
|
785
826
|
});
|
|
786
827
|
}
|
|
@@ -789,17 +830,19 @@ var Migrate = class {
|
|
|
789
830
|
migrationName: migrationId
|
|
790
831
|
});
|
|
791
832
|
}
|
|
792
|
-
applyMigrations() {
|
|
833
|
+
async applyMigrations() {
|
|
793
834
|
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
835
|
+
const migrationsList = await (0, import_chunk_V6PVGSDJ.listMigrations)(this.migrationsDirectoryPath);
|
|
794
836
|
return this.engine.applyMigrations({
|
|
795
|
-
|
|
837
|
+
migrationsList
|
|
796
838
|
});
|
|
797
839
|
}
|
|
798
840
|
async evaluateDataLoss() {
|
|
799
841
|
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
842
|
+
const migrationsList = await (0, import_chunk_V6PVGSDJ.listMigrations)(this.migrationsDirectoryPath);
|
|
800
843
|
const schema = (0, import_internals.toSchemasContainer)((await this.getPrismaSchema()).schemas);
|
|
801
844
|
return this.engine.evaluateDataLoss({
|
|
802
|
-
|
|
845
|
+
migrationsList,
|
|
803
846
|
schema
|
|
804
847
|
});
|
|
805
848
|
}
|
|
@@ -26,12 +26,12 @@ 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_63ZT25OL_exports = {};
|
|
30
|
+
__export(chunk_63ZT25OL_exports, {
|
|
31
31
|
DbPush: () => DbPush
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_63ZT25OL_exports);
|
|
34
|
+
var import_chunk_5Q5BJS5B = require("./chunk-5Q5BJS5B.js");
|
|
35
35
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
36
36
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
37
37
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
@@ -98,7 +98,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
98
98
|
});
|
|
99
99
|
const datasourceInfo = (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext.primaryDatasource);
|
|
100
100
|
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo });
|
|
101
|
-
const migrate = new
|
|
101
|
+
const migrate = new import_chunk_5Q5BJS5B.Migrate(schemaContext.schemaPath);
|
|
102
102
|
try {
|
|
103
103
|
const wasDbCreated = await (0, import_chunk_74LUB4XX.ensureDatabaseExists)(schemaContext.primaryDatasource);
|
|
104
104
|
if (wasDbCreated) {
|
|
@@ -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_ABQZ5J74_exports = {};
|
|
20
|
+
__export(chunk_ABQZ5J74_exports, {
|
|
21
21
|
introspectSql: () => introspectSql
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_ABQZ5J74_exports);
|
|
24
|
+
var import_chunk_GHZAN2PG = require("./chunk-GHZAN2PG.js");
|
|
25
25
|
var import_internals = require("@prisma/internals");
|
|
26
26
|
var supportedProviders = ["postgresql", "cockroachdb", "mysql", "sqlite"];
|
|
27
27
|
async function introspectSql(schemaPath, queries) {
|
|
@@ -41,7 +41,7 @@ async function introspectSql(schemaPath, queries) {
|
|
|
41
41
|
if (!url) {
|
|
42
42
|
throw new Error(`Could not get url from datasource ${firstDatasource.name} in ${schema.schemaPath}`);
|
|
43
43
|
}
|
|
44
|
-
const schemaEngine = new
|
|
44
|
+
const schemaEngine = new import_chunk_GHZAN2PG.SchemaEngine({ schemaPath: schema.schemaPath });
|
|
45
45
|
const results = [];
|
|
46
46
|
const errors = [];
|
|
47
47
|
try {
|
|
@@ -26,14 +26,14 @@ 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_AM7BRZFD_exports = {};
|
|
30
|
+
__export(chunk_AM7BRZFD_exports, {
|
|
31
31
|
MigrateReset: () => MigrateReset
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_AM7BRZFD_exports);
|
|
34
34
|
var import_chunk_5LKIRKDL = require("./chunk-5LKIRKDL.js");
|
|
35
35
|
var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
|
|
36
|
-
var
|
|
36
|
+
var import_chunk_5Q5BJS5B = require("./chunk-5Q5BJS5B.js");
|
|
37
37
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
38
38
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
39
39
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
@@ -117,7 +117,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
117
117
|
process.exit(130);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
const migrate = new
|
|
120
|
+
const migrate = new import_chunk_5Q5BJS5B.Migrate(schemaContext.schemaPath);
|
|
121
121
|
let migrationIds;
|
|
122
122
|
try {
|
|
123
123
|
await migrate.reset();
|
|
@@ -26,12 +26,12 @@ 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_BUAYZ4KA_exports = {};
|
|
30
|
+
__export(chunk_BUAYZ4KA_exports, {
|
|
31
31
|
MigrateStatus: () => MigrateStatus
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_BUAYZ4KA_exports);
|
|
34
|
+
var import_chunk_5Q5BJS5B = require("./chunk-5Q5BJS5B.js");
|
|
35
35
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
36
36
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
37
37
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
@@ -88,7 +88,7 @@ Check the status of your database migrations
|
|
|
88
88
|
schemaPathFromConfig: config.schema
|
|
89
89
|
});
|
|
90
90
|
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext.primaryDatasource) });
|
|
91
|
-
const migrate = new
|
|
91
|
+
const migrate = new import_chunk_5Q5BJS5B.Migrate(schemaContext.schemaPath);
|
|
92
92
|
await (0, import_chunk_74LUB4XX.ensureCanConnectToDatabase)(schemaContext.primaryDatasource);
|
|
93
93
|
let diagnoseResult;
|
|
94
94
|
let listMigrationDirectoriesResult;
|
|
@@ -26,12 +26,12 @@ 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_GHZAN2PG_exports = {};
|
|
30
|
+
__export(chunk_GHZAN2PG_exports, {
|
|
31
31
|
EngineError: () => EngineError,
|
|
32
32
|
SchemaEngine: () => SchemaEngine
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(chunk_GHZAN2PG_exports);
|
|
35
35
|
var import_chunk_G7PJKEOV = require("./chunk-G7PJKEOV.js");
|
|
36
36
|
var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
|
|
37
37
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
@@ -194,12 +194,6 @@ var SchemaEngine = class {
|
|
|
194
194
|
migrateDiff(args) {
|
|
195
195
|
return this.runCommand(this.getRPCPayload("diff", args));
|
|
196
196
|
}
|
|
197
|
-
/**
|
|
198
|
-
* List the names of the migrations in the migrations directory.
|
|
199
|
-
*/
|
|
200
|
-
listMigrationDirectories(args) {
|
|
201
|
-
return this.runCommand(this.getRPCPayload("listMigrationDirectories", args));
|
|
202
|
-
}
|
|
203
197
|
/**
|
|
204
198
|
* Mark a migration as applied in the migrations table.
|
|
205
199
|
* There are two possible outcomes:
|
|
@@ -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_HQJ7FIWN_exports = {};
|
|
20
|
+
__export(chunk_HQJ7FIWN_exports, {
|
|
21
21
|
MigrateResolve: () => MigrateResolve
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_HQJ7FIWN_exports);
|
|
24
|
+
var import_chunk_5Q5BJS5B = require("./chunk-5Q5BJS5B.js");
|
|
25
25
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
26
26
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
27
27
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
@@ -108,7 +108,7 @@ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_in
|
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
await (0, import_chunk_74LUB4XX.ensureCanConnectToDatabase)(schemaContext.primaryDatasource);
|
|
111
|
-
const migrate = new
|
|
111
|
+
const migrate = new import_chunk_5Q5BJS5B.Migrate(schemaContext.schemaPath);
|
|
112
112
|
try {
|
|
113
113
|
await migrate.markMigrationApplied({
|
|
114
114
|
migrationId: args["--applied"]
|
|
@@ -129,7 +129,7 @@ Migration ${args["--applied"]} marked as applied.
|
|
|
129
129
|
);
|
|
130
130
|
}
|
|
131
131
|
await (0, import_chunk_74LUB4XX.ensureCanConnectToDatabase)(schemaContext.primaryDatasource);
|
|
132
|
-
const migrate = new
|
|
132
|
+
const migrate = new import_chunk_5Q5BJS5B.Migrate(schemaContext.schemaPath);
|
|
133
133
|
try {
|
|
134
134
|
await migrate.markMigrationRolledBack({
|
|
135
135
|
migrationId: args["--rolled-back"]
|
|
@@ -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_IRYXRMQC_exports = {};
|
|
30
|
+
__export(chunk_IRYXRMQC_exports, {
|
|
31
31
|
MigrateDeploy: () => MigrateDeploy
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_IRYXRMQC_exports);
|
|
34
34
|
var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_5Q5BJS5B = require("./chunk-5Q5BJS5B.js");
|
|
36
36
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
37
37
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
38
38
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
@@ -90,7 +90,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
90
90
|
schemaPathFromConfig: config.schema
|
|
91
91
|
});
|
|
92
92
|
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext.primaryDatasource) });
|
|
93
|
-
const migrate = new
|
|
93
|
+
const migrate = new import_chunk_5Q5BJS5B.Migrate(schemaContext.schemaPath);
|
|
94
94
|
try {
|
|
95
95
|
const wasDbCreated = await (0, import_chunk_74LUB4XX.ensureDatabaseExists)(schemaContext.primaryDatasource);
|
|
96
96
|
if (wasDbCreated) {
|
|
@@ -26,12 +26,12 @@ 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
36
|
var import_internals = require("@prisma/internals");
|
|
37
37
|
var import_fs = __toESM(require("fs"));
|
|
@@ -202,7 +202,7 @@ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExec
|
|
|
202
202
|
configDir: schemaContext.primaryDatasourceDirectory
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
|
-
const migrate = new
|
|
205
|
+
const migrate = new import_chunk_5Q5BJS5B.Migrate();
|
|
206
206
|
try {
|
|
207
207
|
await migrate.engine.dbExecute({
|
|
208
208
|
script,
|
|
@@ -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);
|
|
@@ -26,20 +26,20 @@ 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_SCH55BRJ_exports = {};
|
|
30
|
+
__export(chunk_SCH55BRJ_exports, {
|
|
31
31
|
DbPull: () => DbPull
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_SCH55BRJ_exports);
|
|
34
34
|
var import_chunk_IINN7QUV = require("./chunk-IINN7QUV.js");
|
|
35
|
+
var import_chunk_JZ75RIMZ = require("./chunk-JZ75RIMZ.js");
|
|
36
|
+
var import_chunk_RR6BKMNO = require("./chunk-RR6BKMNO.js");
|
|
35
37
|
var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
|
|
36
38
|
var import_chunk_AI6DH66U = require("./chunk-AI6DH66U.js");
|
|
37
39
|
var import_chunk_AHJ2N6BJ = require("./chunk-AHJ2N6BJ.js");
|
|
38
|
-
var import_chunk_JZ75RIMZ = require("./chunk-JZ75RIMZ.js");
|
|
39
|
-
var import_chunk_RR6BKMNO = require("./chunk-RR6BKMNO.js");
|
|
40
40
|
var import_chunk_JFKDSUIE = require("./chunk-JFKDSUIE.js");
|
|
41
41
|
var import_chunk_LGYRZ6CV = require("./chunk-LGYRZ6CV.js");
|
|
42
|
-
var
|
|
42
|
+
var import_chunk_GHZAN2PG = require("./chunk-GHZAN2PG.js");
|
|
43
43
|
var import_chunk_G7PJKEOV = require("./chunk-G7PJKEOV.js");
|
|
44
44
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
45
45
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
@@ -237,7 +237,7 @@ Some information will be lost (relations, comments, mapped fields, @ignore...),
|
|
|
237
237
|
)} for more info.`);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
const engine = new
|
|
240
|
+
const engine = new import_chunk_GHZAN2PG.SchemaEngine({
|
|
241
241
|
schemaPath: schemaContext?.schemaPath ?? void 0
|
|
242
242
|
});
|
|
243
243
|
const basedOn = !args["--url"] && schemaContext?.primaryDatasource ? ` based on datasource defined in ${(0, import_chunk_SKRR5WT4.underline)(schemaContext.loadedFromPathForLogMessages)}` : "";
|