@prisma/migrate 6.5.0-dev.1 → 6.5.0-dev.2
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 -4
- package/dist/Migrate.js +6 -7
- package/dist/SchemaEngine.js +6 -7
- package/dist/bin.js +116 -146
- package/dist/{chunk-WOOPRG54.js → chunk-255BRND3.js} +7 -14
- package/dist/{chunk-75EIHNAH.js → chunk-2NMFKGXM.js} +5 -6
- package/dist/chunk-3WC4XD74.js +98 -0
- package/dist/chunk-4EV2RVXY.js +226 -0
- package/dist/{chunk-YWWOSXMY.js → chunk-4JQIX6O7.js} +7 -15
- package/dist/{chunk-M5YNQ2NP.js → chunk-6DFJIBJX.js} +5 -12
- package/dist/{chunk-SGCF5OHF.js → chunk-7CQBDP4H.js} +6 -13
- package/dist/{chunk-7IT2ZO3D.js → chunk-AHJ2N6BJ.js} +3 -9
- package/dist/chunk-C2PR6JQR.js +266 -0
- package/dist/chunk-CTPONE6G.js +65 -0
- package/dist/{chunk-DUCG3NRP.js → chunk-D74DU52C.js} +633 -806
- package/dist/{chunk-UVNSK22K.js → chunk-DDHPSYC4.js} +122 -130
- package/dist/{chunk-CUDKD32S.js → chunk-DIAO4W7O.js} +11 -17
- package/dist/{chunk-XJQP3B4W.js → chunk-DJMFXNR4.js} +7 -15
- package/dist/{chunk-YD7GG4WS.js → chunk-FRTPDRF2.js} +66 -74
- package/dist/chunk-HIFVDK2U.js +96 -0
- package/dist/chunk-I4EY55DC.js +195 -0
- package/dist/{chunk-WLJHGKMK.js → chunk-IHDN3L3R.js} +7 -8
- package/dist/{chunk-V5LEZ5BX.js → chunk-IIBRYI63.js} +634 -807
- package/dist/{chunk-INC2OACE.js → chunk-JFKDSUIE.js} +3 -9
- package/dist/{chunk-V7DE6JTG.js → chunk-JZ75RIMZ.js} +3 -9
- package/dist/{chunk-AAATUOV6.js → chunk-L6KOIJJ5.js} +53 -59
- package/dist/{chunk-GN5BY5N2.js → chunk-LGYRZ6CV.js} +4 -10
- package/dist/chunk-LVLRGTYH.js +148 -0
- package/dist/{chunk-CQQQ436N.js → chunk-MATFO4ZW.js} +186 -200
- package/dist/{chunk-IFCV5MY4.js → chunk-OCQGHQED.js} +5 -11
- package/dist/chunk-ORL3LJOT.js +470 -0
- package/dist/{chunk-Q7ACZDDT.js → chunk-QOPTDDIH.js} +5 -12
- package/dist/chunk-QTAIWPLH.js +78 -0
- package/dist/{chunk-35LAJN5S.js → chunk-RP2N6UXA.js} +23 -29
- package/dist/chunk-RQFGRXJI.js +174 -0
- package/dist/{chunk-QBK5XTJE.js → chunk-RR6BKMNO.js} +3 -9
- package/dist/{chunk-ILJRJJ3S.js → chunk-RTGQXNX6.js} +3 -9
- package/dist/chunk-SKRR5WT4.js +76 -0
- package/dist/chunk-TM3ETZES.js +153 -0
- package/dist/{chunk-KPUNMK5W.js → chunk-TWPTG4XS.js} +5 -12
- package/dist/{chunk-6QFE3AWR.js → chunk-UP6FVCDK.js} +6 -13
- package/dist/{chunk-YKUZUAXA.js → chunk-V3ZMNXZC.js} +16 -23
- package/dist/chunk-WLPX3672.js +365 -0
- package/dist/chunk-WNH2ACJS.js +122 -0
- package/dist/chunk-XSNOKQTD.js +347 -0
- package/dist/{chunk-X6XGFLEF.js → chunk-YZVZCC3I.js} +25 -30
- package/dist/commands/DbCommand.js +3 -4
- package/dist/commands/DbDrop.js +9 -9
- package/dist/commands/DbExecute.js +7 -8
- package/dist/commands/DbPull.js +18 -19
- package/dist/commands/DbPush.js +12 -13
- package/dist/commands/DbSeed.js +4 -5
- package/dist/commands/MigrateCommand.js +3 -4
- package/dist/commands/MigrateDeploy.js +13 -14
- package/dist/commands/MigrateDev.js +17 -18
- package/dist/commands/MigrateDiff.js +8 -9
- package/dist/commands/MigrateReset.js +15 -16
- package/dist/commands/MigrateResolve.js +11 -12
- package/dist/commands/MigrateStatus.js +11 -12
- package/dist/index.js +60 -77
- package/dist/{multipart-parser-73VM3J4A.js → multipart-parser-NDLECNMN.js} +527 -561
- package/dist/utils/byline.js +5 -6
- package/dist/utils/captureStdout.js +2 -3
- package/dist/utils/countModelsAndTypes.js +2 -3
- package/dist/utils/ensureDatabaseExists.js +8 -9
- package/dist/utils/errors.js +8 -9
- package/dist/utils/flagErrors.js +5 -5
- package/dist/utils/getDatabaseVersionSafe.js +6 -7
- package/dist/utils/getSchemaPathAndPrint.js +4 -5
- package/dist/utils/handleEvaluateDataloss.js +3 -4
- package/dist/utils/introspectSql.js +6 -6
- package/dist/utils/isSchemaEmpty.js +2 -3
- package/dist/utils/printDatasource.js +3 -4
- package/dist/utils/printDatasources.js +3 -4
- package/dist/utils/printFiles.js +5 -6
- package/dist/utils/printIntrospectedSchema.js +2 -3
- package/dist/utils/printMigrationId.js +4 -5
- package/dist/utils/promptForMigrationName.js +2 -3
- package/dist/utils/removeSchemaFiles.js +2 -3
- package/dist/utils/replaceOrAddDatasource.js +2 -3
- package/dist/utils/replaceOrAddDatasource.test.js +7 -8
- package/dist/utils/saveSchemaFiles.js +2 -3
- package/dist/utils/seed.js +6 -7
- package/dist/utils/spinner.js +2 -3
- package/dist/utils/unixSocket.js +2 -3
- package/dist/views/handleViewsIO.js +2 -3
- package/package.json +6 -6
- package/dist/chunk-26XQQ4AG.js +0 -386
- package/dist/chunk-2RSEPJFX.js +0 -165
- package/dist/chunk-4B2LXK4R.js +0 -207
- package/dist/chunk-4UJBOCZJ.js +0 -130
- package/dist/chunk-5HZLCY6X.js +0 -161
- package/dist/chunk-6TE2RIPN.js +0 -80
- package/dist/chunk-7S3Q4MCN.js +0 -480
- package/dist/chunk-AOX7CJAS.js +0 -234
- package/dist/chunk-FF3526PX.js +0 -279
- package/dist/chunk-FUSFURVP.js +0 -86
- package/dist/chunk-GCTCQLOF.js +0 -365
- package/dist/chunk-K44VNAFW.js +0 -189
- package/dist/chunk-O4BT6W33.js +0 -104
- package/dist/chunk-TKAGMA5K.js +0 -72
- package/dist/chunk-U374EXYQ.js +0 -106
|
@@ -26,15 +26,14 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__g
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
Migrate: () => Migrate
|
|
32
|
-
init_Migrate: () => init_Migrate
|
|
29
|
+
var chunk_DDHPSYC4_exports = {};
|
|
30
|
+
__export(chunk_DDHPSYC4_exports, {
|
|
31
|
+
Migrate: () => Migrate
|
|
33
32
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_DDHPSYC4_exports);
|
|
35
34
|
var import_chunk_6C7ESGWY = require("./chunk-6C7ESGWY.js");
|
|
36
|
-
var
|
|
37
|
-
var
|
|
35
|
+
var import_chunk_ORL3LJOT = require("./chunk-ORL3LJOT.js");
|
|
36
|
+
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
38
37
|
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
39
38
|
var import_engines_version = require("@prisma/engines-version");
|
|
40
39
|
var import_internals = require("@prisma/internals");
|
|
@@ -538,128 +537,121 @@ var require_log_update = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
538
537
|
module2.exports.create = main;
|
|
539
538
|
}
|
|
540
539
|
});
|
|
541
|
-
var import_log_update
|
|
542
|
-
var
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
});
|
|
629
|
-
return {
|
|
630
|
-
executedSteps,
|
|
631
|
-
warnings,
|
|
632
|
-
unexecutable
|
|
633
|
-
};
|
|
634
|
-
}
|
|
635
|
-
async tryToRunGenerate(datasourceInfo) {
|
|
636
|
-
if (!this.schemaPath) throw new Error("this.schemaPath is undefined");
|
|
637
|
-
const skipEngines = (0, import_internals.isPrismaPostgres)(datasourceInfo.url);
|
|
638
|
-
const message = [];
|
|
639
|
-
process.stdout.write("\n");
|
|
640
|
-
(0, import_log_update.default)(`Running generate... ${(0, import_chunk_6TE2RIPN.dim)("(Use --skip-generate to skip the generators)")}`);
|
|
641
|
-
const generators = await (0, import_internals.getGenerators)({
|
|
642
|
-
schemaPath: this.schemaPath,
|
|
643
|
-
printDownloadProgress: true,
|
|
644
|
-
version: import_engines_version.enginesVersion,
|
|
645
|
-
cliVersion: packageJson.version,
|
|
646
|
-
noEngine: skipEngines
|
|
647
|
-
});
|
|
648
|
-
for (const generator of generators) {
|
|
649
|
-
(0, import_log_update.default)(`Running generate... - ${generator.getPrettyName()}`);
|
|
650
|
-
const before = Math.round(performance.now());
|
|
651
|
-
try {
|
|
652
|
-
await generator.generate();
|
|
653
|
-
const after = Math.round(performance.now());
|
|
654
|
-
message.push((0, import_internals.getGeneratorSuccessMessage)(generator, after - before));
|
|
655
|
-
generator.stop();
|
|
656
|
-
} catch (e) {
|
|
657
|
-
message.push(`${e.message}`);
|
|
658
|
-
generator.stop();
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
(0, import_log_update.default)(message.join("\n"));
|
|
662
|
-
}
|
|
540
|
+
var import_log_update = (0, import_chunk_WWAWV7DQ.__toESM)(require_log_update());
|
|
541
|
+
var packageJson = eval(`require('../package.json')`);
|
|
542
|
+
var Migrate = class {
|
|
543
|
+
constructor(schemaPath, enabledPreviewFeatures) {
|
|
544
|
+
if (schemaPath) {
|
|
545
|
+
this.schemaPath = import_path.default.resolve(process.cwd(), schemaPath);
|
|
546
|
+
this.migrationsDirectoryPath = import_path.default.join(import_path.default.dirname(this.schemaPath), "migrations");
|
|
547
|
+
this.engine = new import_chunk_ORL3LJOT.SchemaEngine({
|
|
548
|
+
schemaPath: this.schemaPath,
|
|
549
|
+
enabledPreviewFeatures
|
|
550
|
+
});
|
|
551
|
+
} else {
|
|
552
|
+
this.engine = new import_chunk_ORL3LJOT.SchemaEngine({
|
|
553
|
+
enabledPreviewFeatures
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
stop() {
|
|
558
|
+
this.engine.stop();
|
|
559
|
+
}
|
|
560
|
+
getPrismaSchema() {
|
|
561
|
+
if (!this.schemaPath) throw new Error("this.schemaPath is undefined");
|
|
562
|
+
return (0, import_internals.getSchemaWithPath)(this.schemaPath);
|
|
563
|
+
}
|
|
564
|
+
reset() {
|
|
565
|
+
return this.engine.reset();
|
|
566
|
+
}
|
|
567
|
+
createMigration(params) {
|
|
568
|
+
return this.engine.createMigration(params);
|
|
569
|
+
}
|
|
570
|
+
diagnoseMigrationHistory({
|
|
571
|
+
optInToShadowDatabase
|
|
572
|
+
}) {
|
|
573
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
574
|
+
return this.engine.diagnoseMigrationHistory({
|
|
575
|
+
migrationsDirectoryPath: this.migrationsDirectoryPath,
|
|
576
|
+
optInToShadowDatabase
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
listMigrationDirectories() {
|
|
580
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
581
|
+
return this.engine.listMigrationDirectories({
|
|
582
|
+
migrationsDirectoryPath: this.migrationsDirectoryPath
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
devDiagnostic() {
|
|
586
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
587
|
+
return this.engine.devDiagnostic({
|
|
588
|
+
migrationsDirectoryPath: this.migrationsDirectoryPath
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
async markMigrationApplied({ migrationId }) {
|
|
592
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
593
|
+
return await this.engine.markMigrationApplied({
|
|
594
|
+
migrationsDirectoryPath: this.migrationsDirectoryPath,
|
|
595
|
+
migrationName: migrationId
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
markMigrationRolledBack({ migrationId }) {
|
|
599
|
+
return this.engine.markMigrationRolledBack({
|
|
600
|
+
migrationName: migrationId
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
applyMigrations() {
|
|
604
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
605
|
+
return this.engine.applyMigrations({
|
|
606
|
+
migrationsDirectoryPath: this.migrationsDirectoryPath
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
async evaluateDataLoss() {
|
|
610
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
611
|
+
const schema = (0, import_internals.toSchemasContainer)((await this.getPrismaSchema()).schemas);
|
|
612
|
+
return this.engine.evaluateDataLoss({
|
|
613
|
+
migrationsDirectoryPath: this.migrationsDirectoryPath,
|
|
614
|
+
schema
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
async push({ force = false }) {
|
|
618
|
+
const schema = (0, import_internals.toSchemasContainer)((await this.getPrismaSchema()).schemas);
|
|
619
|
+
const { warnings, unexecutable, executedSteps } = await this.engine.schemaPush({
|
|
620
|
+
force,
|
|
621
|
+
schema
|
|
622
|
+
});
|
|
623
|
+
return {
|
|
624
|
+
executedSteps,
|
|
625
|
+
warnings,
|
|
626
|
+
unexecutable
|
|
663
627
|
};
|
|
664
628
|
}
|
|
665
|
-
|
|
629
|
+
async tryToRunGenerate(datasourceInfo) {
|
|
630
|
+
if (!this.schemaPath) throw new Error("this.schemaPath is undefined");
|
|
631
|
+
const skipEngines = (0, import_internals.isPrismaPostgres)(datasourceInfo.url);
|
|
632
|
+
const message = [];
|
|
633
|
+
process.stdout.write("\n");
|
|
634
|
+
(0, import_log_update.default)(`Running generate... ${(0, import_chunk_SKRR5WT4.dim)("(Use --skip-generate to skip the generators)")}`);
|
|
635
|
+
const generators = await (0, import_internals.getGenerators)({
|
|
636
|
+
schemaPath: this.schemaPath,
|
|
637
|
+
printDownloadProgress: true,
|
|
638
|
+
version: import_engines_version.enginesVersion,
|
|
639
|
+
cliVersion: packageJson.version,
|
|
640
|
+
noEngine: skipEngines
|
|
641
|
+
});
|
|
642
|
+
for (const generator of generators) {
|
|
643
|
+
(0, import_log_update.default)(`Running generate... - ${generator.getPrettyName()}`);
|
|
644
|
+
const before = Math.round(performance.now());
|
|
645
|
+
try {
|
|
646
|
+
await generator.generate();
|
|
647
|
+
const after = Math.round(performance.now());
|
|
648
|
+
message.push((0, import_internals.getGeneratorSuccessMessage)(generator, after - before));
|
|
649
|
+
generator.stop();
|
|
650
|
+
} catch (e) {
|
|
651
|
+
message.push(`${e.message}`);
|
|
652
|
+
generator.stop();
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
(0, import_log_update.default)(message.join("\n"));
|
|
656
|
+
}
|
|
657
|
+
};
|
|
@@ -16,12 +16,11 @@ 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(
|
|
21
|
-
createSpinner: () => createSpinner
|
|
22
|
-
init_spinner: () => init_spinner
|
|
19
|
+
var chunk_DIAO4W7O_exports = {};
|
|
20
|
+
__export(chunk_DIAO4W7O_exports, {
|
|
21
|
+
createSpinner: () => createSpinner
|
|
23
22
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(chunk_DIAO4W7O_exports);
|
|
25
24
|
var import_chunk_YUCPBDWV = require("./chunk-YUCPBDWV.js");
|
|
26
25
|
var import_chunk_RM5LJIEV = require("./chunk-RM5LJIEV.js");
|
|
27
26
|
var import_chunk_6C7ESGWY = require("./chunk-6C7ESGWY.js");
|
|
@@ -5734,6 +5733,13 @@ var require_ora = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
5734
5733
|
};
|
|
5735
5734
|
}
|
|
5736
5735
|
});
|
|
5736
|
+
var import_ora = (0, import_chunk_WWAWV7DQ.__toESM)(require_ora());
|
|
5737
|
+
var defaultOraOptions = {
|
|
5738
|
+
spinner: "dots",
|
|
5739
|
+
color: "cyan",
|
|
5740
|
+
indent: 0,
|
|
5741
|
+
stream: process.stdout
|
|
5742
|
+
};
|
|
5737
5743
|
function createSpinner(enableOutput = true, oraOptions = {}) {
|
|
5738
5744
|
const actualOptions = { ...defaultOraOptions, ...oraOptions };
|
|
5739
5745
|
return (text) => {
|
|
@@ -5766,15 +5772,3 @@ function createSpinner(enableOutput = true, oraOptions = {}) {
|
|
|
5766
5772
|
};
|
|
5767
5773
|
};
|
|
5768
5774
|
}
|
|
5769
|
-
var import_ora, defaultOraOptions;
|
|
5770
|
-
var init_spinner = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
5771
|
-
"src/utils/spinner.ts"() {
|
|
5772
|
-
import_ora = (0, import_chunk_WWAWV7DQ.__toESM)(require_ora());
|
|
5773
|
-
defaultOraOptions = {
|
|
5774
|
-
spinner: "dots",
|
|
5775
|
-
color: "cyan",
|
|
5776
|
-
indent: 0,
|
|
5777
|
-
stream: process.stdout
|
|
5778
|
-
};
|
|
5779
|
-
}
|
|
5780
|
-
});
|
|
@@ -16,19 +16,17 @@ 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_DJMFXNR4_exports = {};
|
|
20
|
+
__export(chunk_DJMFXNR4_exports, {
|
|
21
21
|
ensureCanConnectToDatabase: () => ensureCanConnectToDatabase,
|
|
22
22
|
ensureDatabaseExists: () => ensureDatabaseExists,
|
|
23
23
|
getDatasourceInfo: () => getDatasourceInfo,
|
|
24
24
|
getDbLocation: () => getDbLocation,
|
|
25
|
-
init_ensureDatabaseExists: () => init_ensureDatabaseExists,
|
|
26
25
|
prettifyProvider: () => prettifyProvider
|
|
27
26
|
});
|
|
28
|
-
module.exports = __toCommonJS(
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
27
|
+
module.exports = __toCommonJS(chunk_DJMFXNR4_exports);
|
|
28
|
+
var import_chunk_TWPTG4XS = require("./chunk-TWPTG4XS.js");
|
|
29
|
+
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
32
30
|
var import_internals = require("@prisma/internals");
|
|
33
31
|
async function getDatasourceInfo({
|
|
34
32
|
schemaPath,
|
|
@@ -156,7 +154,7 @@ async function ensureDatabaseExists(action, schemaPath) {
|
|
|
156
154
|
let message2 = `${prettyProvider} database${credentials.database ? ` ${credentials.database} ` : " "}created`;
|
|
157
155
|
const dbLocation = getDbLocation(credentials);
|
|
158
156
|
if (dbLocation) {
|
|
159
|
-
message2 += ` at ${(0,
|
|
157
|
+
message2 += ` at ${(0, import_chunk_SKRR5WT4.bold)(dbLocation)}`;
|
|
160
158
|
}
|
|
161
159
|
return message2;
|
|
162
160
|
}
|
|
@@ -166,7 +164,7 @@ function getDbLocation(credentials) {
|
|
|
166
164
|
if (credentials.type === "sqlite") {
|
|
167
165
|
return credentials.uri;
|
|
168
166
|
}
|
|
169
|
-
const socket = (0,
|
|
167
|
+
const socket = (0, import_chunk_TWPTG4XS.getSocketFromDatabaseCredentials)(credentials);
|
|
170
168
|
if (socket) {
|
|
171
169
|
return `unix:${socket}`;
|
|
172
170
|
} else if (credentials.host && credentials.port) {
|
|
@@ -195,9 +193,3 @@ function prettifyProvider(provider) {
|
|
|
195
193
|
return `MongoDB`;
|
|
196
194
|
}
|
|
197
195
|
}
|
|
198
|
-
var init_ensureDatabaseExists = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
199
|
-
"src/utils/ensureDatabaseExists.ts"() {
|
|
200
|
-
(0, import_chunk_6TE2RIPN.init_colors)();
|
|
201
|
-
(0, import_chunk_KPUNMK5W.init_unixSocket)();
|
|
202
|
-
}
|
|
203
|
-
});
|
|
@@ -16,14 +16,13 @@ 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(
|
|
21
|
-
DbSeed: () => DbSeed
|
|
22
|
-
init_DbSeed: () => init_DbSeed
|
|
19
|
+
var chunk_FRTPDRF2_exports = {};
|
|
20
|
+
__export(chunk_FRTPDRF2_exports, {
|
|
21
|
+
DbSeed: () => DbSeed
|
|
23
22
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
25
|
-
var
|
|
26
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_FRTPDRF2_exports);
|
|
24
|
+
var import_chunk_V3ZMNXZC = require("./chunk-V3ZMNXZC.js");
|
|
25
|
+
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
27
26
|
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
28
27
|
var import_internals = require("@prisma/internals");
|
|
29
28
|
var require_arg = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
@@ -169,84 +168,77 @@ var require_arg = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
169
168
|
module2.exports = arg2;
|
|
170
169
|
}
|
|
171
170
|
});
|
|
172
|
-
var import_arg
|
|
173
|
-
var
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
false
|
|
193
|
-
);
|
|
194
|
-
if ((0, import_internals.isError)(args)) {
|
|
195
|
-
if (args instanceof import_arg.ArgError && args.code === "ARG_UNKNOWN_OPTION") {
|
|
196
|
-
throw new Error(`${args.message}
|
|
171
|
+
var import_arg = (0, import_chunk_WWAWV7DQ.__toESM)(require_arg());
|
|
172
|
+
var _DbSeed = class _DbSeed2 {
|
|
173
|
+
static new() {
|
|
174
|
+
return new _DbSeed2();
|
|
175
|
+
}
|
|
176
|
+
async parse(argv, config) {
|
|
177
|
+
const args = (0, import_internals.arg)(
|
|
178
|
+
argv,
|
|
179
|
+
{
|
|
180
|
+
"--help": Boolean,
|
|
181
|
+
"-h": "--help",
|
|
182
|
+
"--schema": String,
|
|
183
|
+
"--config": String,
|
|
184
|
+
"--telemetry-information": String
|
|
185
|
+
},
|
|
186
|
+
false
|
|
187
|
+
);
|
|
188
|
+
if ((0, import_internals.isError)(args)) {
|
|
189
|
+
if (args instanceof import_arg.ArgError && args.code === "ARG_UNKNOWN_OPTION") {
|
|
190
|
+
throw new Error(`${args.message}
|
|
197
191
|
Did you mean to pass these as arguments to your seed script? If so, add a -- separator before them:
|
|
198
|
-
${(0,
|
|
199
|
-
}
|
|
200
|
-
return this.help(args.message);
|
|
201
|
-
}
|
|
202
|
-
if (args["--help"]) {
|
|
203
|
-
return this.help();
|
|
204
|
-
}
|
|
205
|
-
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
206
|
-
const seedCommandFromPkgJson = await (0, import_chunk_YKUZUAXA.getSeedCommandFromPackageJson)(process.cwd());
|
|
207
|
-
if (!seedCommandFromPkgJson) {
|
|
208
|
-
const schemaResult = await (0, import_internals.getSchemaWithPath)(args["--schema"], config.schema);
|
|
209
|
-
const message = await (0, import_chunk_YKUZUAXA.verifySeedConfigAndReturnMessage)(schemaResult?.schemaPath ?? null);
|
|
210
|
-
if (message) {
|
|
211
|
-
throw new Error(message);
|
|
212
|
-
}
|
|
213
|
-
return ``;
|
|
214
|
-
}
|
|
215
|
-
const extraArgs = args._.join(" ");
|
|
216
|
-
const successfulSeeding = await (0, import_chunk_YKUZUAXA.executeSeedCommand)({ commandFromConfig: seedCommandFromPkgJson, extraArgs });
|
|
217
|
-
if (successfulSeeding) {
|
|
218
|
-
return `
|
|
219
|
-
${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.`;
|
|
220
|
-
} else {
|
|
221
|
-
process.exit(1);
|
|
222
|
-
}
|
|
192
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db seed -- --arg1 value1 --arg2 value2`);
|
|
223
193
|
}
|
|
224
|
-
help(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
194
|
+
return this.help(args.message);
|
|
195
|
+
}
|
|
196
|
+
if (args["--help"]) {
|
|
197
|
+
return this.help();
|
|
198
|
+
}
|
|
199
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
200
|
+
const seedCommandFromPkgJson = await (0, import_chunk_V3ZMNXZC.getSeedCommandFromPackageJson)(process.cwd());
|
|
201
|
+
if (!seedCommandFromPkgJson) {
|
|
202
|
+
const schemaResult = await (0, import_internals.getSchemaWithPath)(args["--schema"], config.schema);
|
|
203
|
+
const message = await (0, import_chunk_V3ZMNXZC.verifySeedConfigAndReturnMessage)(schemaResult?.schemaPath ?? null);
|
|
204
|
+
if (message) {
|
|
205
|
+
throw new Error(message);
|
|
231
206
|
}
|
|
232
|
-
|
|
233
|
-
|
|
207
|
+
return ``;
|
|
208
|
+
}
|
|
209
|
+
const extraArgs = args._.join(" ");
|
|
210
|
+
const successfulSeeding = await (0, import_chunk_V3ZMNXZC.executeSeedCommand)({ commandFromConfig: seedCommandFromPkgJson, extraArgs });
|
|
211
|
+
if (successfulSeeding) {
|
|
212
|
+
return `
|
|
213
|
+
${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.`;
|
|
214
|
+
} else {
|
|
215
|
+
process.exit(1);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
help(error) {
|
|
219
|
+
if (error) {
|
|
220
|
+
return new import_internals.HelpError(`
|
|
221
|
+
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
222
|
+
${_DbSeed2.help}`);
|
|
223
|
+
}
|
|
224
|
+
return _DbSeed2.help;
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
_DbSeed.help = (0, import_internals.format)(`
|
|
234
228
|
${process.platform === "win32" ? "" : "\u{1F64C} "}Seed your database
|
|
235
229
|
|
|
236
|
-
${(0,
|
|
230
|
+
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
237
231
|
|
|
238
|
-
${(0,
|
|
232
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db seed [options]
|
|
239
233
|
|
|
240
|
-
${(0,
|
|
234
|
+
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
241
235
|
|
|
242
236
|
-h, --help Display this help message
|
|
243
237
|
--config Custom path to your Prisma config file
|
|
244
238
|
|
|
245
|
-
${(0,
|
|
239
|
+
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
246
240
|
|
|
247
241
|
Passing extra arguments to the seed command
|
|
248
|
-
${(0,
|
|
242
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db seed -- --arg1 value1 --arg2 value2
|
|
249
243
|
`);
|
|
250
|
-
|
|
251
|
-
}
|
|
252
|
-
});
|
|
244
|
+
var DbSeed = _DbSeed;
|
|
@@ -0,0 +1,96 @@
|
|
|
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_HIFVDK2U_exports = {};
|
|
20
|
+
__export(chunk_HIFVDK2U_exports, {
|
|
21
|
+
DbCommand: () => DbCommand
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(chunk_HIFVDK2U_exports);
|
|
24
|
+
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
25
|
+
var import_internals = require("@prisma/internals");
|
|
26
|
+
var _DbCommand = class _DbCommand2 {
|
|
27
|
+
constructor(cmds) {
|
|
28
|
+
this.cmds = cmds;
|
|
29
|
+
}
|
|
30
|
+
static new(cmds) {
|
|
31
|
+
return new _DbCommand2(cmds);
|
|
32
|
+
}
|
|
33
|
+
async parse(argv, config) {
|
|
34
|
+
const args = (0, import_internals.arg)(argv, {
|
|
35
|
+
"--help": Boolean,
|
|
36
|
+
"-h": "--help",
|
|
37
|
+
"--config": String,
|
|
38
|
+
"--preview-feature": Boolean,
|
|
39
|
+
"--telemetry-information": String
|
|
40
|
+
});
|
|
41
|
+
if ((0, import_internals.isError)(args)) {
|
|
42
|
+
return this.help(args.message);
|
|
43
|
+
}
|
|
44
|
+
if (args._.length === 0 || args["--help"]) {
|
|
45
|
+
return this.help();
|
|
46
|
+
}
|
|
47
|
+
const cmd = this.cmds[args._[0]];
|
|
48
|
+
if (cmd) {
|
|
49
|
+
const argsForCmd = args["--preview-feature"] ? [...args._.slice(1), `--preview-feature`] : args._.slice(1);
|
|
50
|
+
return cmd.parse(argsForCmd, config);
|
|
51
|
+
}
|
|
52
|
+
return (0, import_internals.unknownCommand)(_DbCommand2.help, args._[0]);
|
|
53
|
+
}
|
|
54
|
+
help(error) {
|
|
55
|
+
if (error) {
|
|
56
|
+
return new import_internals.HelpError(`
|
|
57
|
+
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
58
|
+
${_DbCommand2.help}`);
|
|
59
|
+
}
|
|
60
|
+
return _DbCommand2.help;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
_DbCommand.help = (0, import_internals.format)(`
|
|
64
|
+
${process.platform === "win32" ? "" : "\u{1F3CB}\uFE0F "}Manage your database schema and lifecycle during development.
|
|
65
|
+
|
|
66
|
+
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
67
|
+
|
|
68
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db [command] [options]
|
|
69
|
+
|
|
70
|
+
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
71
|
+
|
|
72
|
+
-h, --help Display this help message
|
|
73
|
+
--config Custom path to your Prisma config file
|
|
74
|
+
--schema Custom path to your Prisma schema
|
|
75
|
+
|
|
76
|
+
${(0, import_chunk_SKRR5WT4.bold)("Commands")}
|
|
77
|
+
pull Pull the state from the database to the Prisma schema using introspection
|
|
78
|
+
push Push the state from Prisma schema to the database during prototyping
|
|
79
|
+
seed Seed your database
|
|
80
|
+
execute Execute native commands to your database
|
|
81
|
+
|
|
82
|
+
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
83
|
+
|
|
84
|
+
Run \`prisma db pull\`
|
|
85
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull
|
|
86
|
+
|
|
87
|
+
Run \`prisma db push\`
|
|
88
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db push
|
|
89
|
+
|
|
90
|
+
Run \`prisma db seed\`
|
|
91
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db seed
|
|
92
|
+
|
|
93
|
+
Run \`prisma db execute\`
|
|
94
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute
|
|
95
|
+
`);
|
|
96
|
+
var DbCommand = _DbCommand;
|