@prisma/migrate 6.20.0-integration-next.2 → 6.20.0-integration-merge-release-workflows.1
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 +6 -6
- package/dist/SchemaEngineCLI.js +4 -4
- package/dist/SchemaEngineWasm.js +4 -4
- package/dist/bin.js +31 -30
- package/dist/{chunk-GH6IOZTT.js → chunk-22YP3RXZ.js} +7 -7
- package/dist/{chunk-4BAGKFIV.js → chunk-3AKRTEIK.js} +11 -10
- package/dist/{chunk-FBPXMCYK.js → chunk-6ORQRJLP.js} +109 -28
- package/dist/{chunk-EVUHOCOP.js → chunk-7TVX3D4W.js} +65 -27
- package/dist/{chunk-PEUHUCS4.js → chunk-AXR7LS2N.js} +5 -4
- package/dist/{chunk-EERZNF42.js → chunk-BHJMJSM4.js} +7 -6
- package/dist/{chunk-WF7UXKO5.js → chunk-D4TRX77Y.js} +9 -6
- package/dist/{chunk-V3D2XB5I.js → chunk-D6LYHB65.js} +29 -37
- package/dist/{chunk-BP3VX5NQ.js → chunk-F2XCBEZ4.js} +13 -10
- package/dist/{chunk-SYWL5XS4.js → chunk-GSX25HRL.js} +5 -5
- package/dist/{chunk-SFX5KEGP.js → chunk-J33EXHZB.js} +12 -9
- package/dist/{chunk-PQ3UMDEP.js → chunk-NB4FRYRQ.js} +5 -5
- package/dist/{chunk-BB43AVYJ.js → chunk-O35BTK6Y.js} +13 -9
- package/dist/{chunk-FRY7T46S.js → chunk-OP2BDF75.js} +11 -10
- package/dist/{chunk-L7EZFBB4.js → chunk-PHXLQVPT.js} +68 -40
- package/dist/{chunk-XA2JOJS2.js → chunk-QVMYNWAN.js} +70 -157
- package/dist/{chunk-Z7WLEGCP.js → chunk-R4IWP35Z.js} +9 -8
- package/dist/chunk-RR6BKMNO.js +80 -0
- package/dist/{chunk-6FL2LODV.js → chunk-TW22Y3AA.js} +7 -6
- package/dist/{chunk-T2ACIU5M.js → chunk-VU5BLQUI.js} +8 -14
- package/dist/{chunk-JX2HIV7V.js → chunk-VV4M6AN7.js} +10 -10
- package/dist/{chunk-GY34KW2I.js → chunk-Z27SI4AV.js} +4 -6
- package/dist/{chunk-QCMPSEBY.js → chunk-ZTIS675B.js} +205 -138
- package/dist/commands/DbDrop.js +2 -2
- package/dist/commands/DbExecute.js +7 -7
- package/dist/commands/DbPull.js +9 -8
- package/dist/commands/DbPush.js +7 -7
- package/dist/commands/DbSeed.js +3 -3
- package/dist/commands/MigrateDeploy.js +7 -7
- package/dist/commands/MigrateDev.js +8 -8
- package/dist/commands/MigrateDiff.js +7 -8
- package/dist/commands/MigrateReset.js +8 -8
- package/dist/commands/MigrateResolve.js +7 -7
- package/dist/commands/MigrateStatus.js +7 -7
- package/dist/index.js +37 -36
- package/dist/internals/src/cli/getSchema.d.ts +15 -1
- package/dist/migrate/src/Migrate.d.ts +2 -1
- package/dist/migrate/src/commands/MigrateDiff.d.ts +0 -1
- package/dist/migrate/src/utils/introspectSql.d.ts +1 -2
- package/dist/migrate/src/utils/replaceOrAddDatasource.d.ts +2 -0
- package/dist/migrate/src/utils/replaceOrAddDatasource.test.d.ts +1 -0
- package/dist/migrate/src/utils/seed.d.ts +6 -0
- package/dist/utils/getDatabaseVersionSafe.js +7 -7
- package/dist/utils/introspectSql.js +7 -7
- package/dist/utils/replaceOrAddDatasource.js +25 -0
- package/dist/utils/replaceOrAddDatasource.test.js +207 -0
- package/dist/utils/seed.js +3 -2
- package/dist/utils/setupCockroach.js +2 -2
- package/dist/utils/setupMSSQL.js +30480 -31090
- package/dist/utils/setupMongo.js +768 -2048
- package/dist/utils/setupPostgres.js +2 -2
- package/dist/utils/spinner.js +3 -3
- package/dist/views/handleViewsIO.js +2 -2
- package/package.json +11 -11
- package/dist/open-GFNXULGD.js +0 -593
|
@@ -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(
|
|
31
|
-
MigrateDiff: () => MigrateDiff
|
|
32
|
-
getRemovedTargetParameterHint: () => getRemovedTargetParameterHint
|
|
29
|
+
var chunk_ZTIS675B_exports = {};
|
|
30
|
+
__export(chunk_ZTIS675B_exports, {
|
|
31
|
+
MigrateDiff: () => MigrateDiff
|
|
33
32
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_ZTIS675B_exports);
|
|
35
34
|
var import_chunk_VAJ4VX67 = require("./chunk-VAJ4VX67.js");
|
|
36
|
-
var
|
|
35
|
+
var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
|
|
37
36
|
var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
|
|
38
37
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
39
38
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
40
39
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
41
40
|
var import_internals = require("@prisma/internals");
|
|
42
41
|
var import_path = __toESM(require("path"));
|
|
42
|
+
var import_config = require("@prisma/config");
|
|
43
43
|
var import_debug2 = require("@prisma/debug");
|
|
44
44
|
var import_fs = __toESM(require("fs"));
|
|
45
45
|
var import_path2 = __toESM(require("path"));
|
|
@@ -1117,7 +1117,7 @@ var require_tree_walker = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
1117
1117
|
}
|
|
1118
1118
|
});
|
|
1119
1119
|
var require_path = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
1120
|
-
"../../node_modules/.pnpm/minimatch@5.1.
|
|
1120
|
+
"../../node_modules/.pnpm/minimatch@5.1.0/node_modules/minimatch/lib/path.js"(exports, module2) {
|
|
1121
1121
|
"use strict";
|
|
1122
1122
|
var isWindows = typeof process === "object" && process && process.platform === "win32";
|
|
1123
1123
|
module2.exports = isWindows ? { sep: "\\" } : { sep: "/" };
|
|
@@ -1180,7 +1180,7 @@ var require_balanced_match = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
1180
1180
|
}
|
|
1181
1181
|
});
|
|
1182
1182
|
var require_brace_expansion = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
1183
|
-
"../../node_modules/.pnpm/brace-expansion@2.0.
|
|
1183
|
+
"../../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js"(exports, module2) {
|
|
1184
1184
|
"use strict";
|
|
1185
1185
|
var balanced = require_balanced_match();
|
|
1186
1186
|
module2.exports = expandTop;
|
|
@@ -1255,7 +1255,7 @@ var require_brace_expansion = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
1255
1255
|
var isSequence = isNumericSequence || isAlphaSequence;
|
|
1256
1256
|
var isOptions = m.body.indexOf(",") >= 0;
|
|
1257
1257
|
if (!isSequence && !isOptions) {
|
|
1258
|
-
if (m.post.match(
|
|
1258
|
+
if (m.post.match(/,.*\}/)) {
|
|
1259
1259
|
str = m.pre + "{" + m.body + escClose + m.post;
|
|
1260
1260
|
return expand(str);
|
|
1261
1261
|
}
|
|
@@ -1329,7 +1329,7 @@ var require_brace_expansion = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
1329
1329
|
}
|
|
1330
1330
|
});
|
|
1331
1331
|
var require_minimatch = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
1332
|
-
"../../node_modules/.pnpm/minimatch@5.1.
|
|
1332
|
+
"../../node_modules/.pnpm/minimatch@5.1.0/node_modules/minimatch/minimatch.js"(exports, module2) {
|
|
1333
1333
|
"use strict";
|
|
1334
1334
|
var minimatch = module2.exports = (p, pattern, options = {}) => {
|
|
1335
1335
|
assertValidPattern(pattern);
|
|
@@ -1416,9 +1416,7 @@ var require_minimatch = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
1416
1416
|
return list;
|
|
1417
1417
|
};
|
|
1418
1418
|
var globUnescape = (s) => s.replace(/\\(.)/g, "$1");
|
|
1419
|
-
var charUnescape = (s) => s.replace(/\\([^-\]])/g, "$1");
|
|
1420
1419
|
var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1421
|
-
var braExpEscape = (s) => s.replace(/[[\]\\]/g, "\\$&");
|
|
1422
1420
|
var Minimatch = class {
|
|
1423
1421
|
constructor(pattern, options) {
|
|
1424
1422
|
assertValidPattern(pattern);
|
|
@@ -1471,7 +1469,7 @@ var require_minimatch = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
1471
1469
|
negate = !negate;
|
|
1472
1470
|
negateOffset++;
|
|
1473
1471
|
}
|
|
1474
|
-
if (negateOffset) this.pattern = pattern.
|
|
1472
|
+
if (negateOffset) this.pattern = pattern.substr(negateOffset);
|
|
1475
1473
|
this.negate = negate;
|
|
1476
1474
|
}
|
|
1477
1475
|
// set partial to true to test if, for example,
|
|
@@ -1557,7 +1555,7 @@ var require_minimatch = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
1557
1555
|
}
|
|
1558
1556
|
if (pattern === "") return "";
|
|
1559
1557
|
let re = "";
|
|
1560
|
-
let hasMagic =
|
|
1558
|
+
let hasMagic = !!options.nocase;
|
|
1561
1559
|
let escaping = false;
|
|
1562
1560
|
const patternListStack = [];
|
|
1563
1561
|
const negativeLists = [];
|
|
@@ -1568,10 +1566,7 @@ var require_minimatch = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
1568
1566
|
let cs;
|
|
1569
1567
|
let pl;
|
|
1570
1568
|
let sp;
|
|
1571
|
-
|
|
1572
|
-
let dotFileAllowed = options.dot || dotTravAllowed;
|
|
1573
|
-
const patternStart = () => dotTravAllowed ? "" : dotFileAllowed ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
|
|
1574
|
-
const subPatternStart = (p) => p.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
|
|
1569
|
+
const patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
|
|
1575
1570
|
const clearStateChar = () => {
|
|
1576
1571
|
if (stateChar) {
|
|
1577
1572
|
switch (stateChar) {
|
|
@@ -1610,10 +1605,6 @@ var require_minimatch = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
1610
1605
|
return false;
|
|
1611
1606
|
}
|
|
1612
1607
|
case "\\":
|
|
1613
|
-
if (inClass && pattern.charAt(i + 1) === "-") {
|
|
1614
|
-
re += c;
|
|
1615
|
-
continue;
|
|
1616
|
-
}
|
|
1617
1608
|
clearStateChar();
|
|
1618
1609
|
escaping = true;
|
|
1619
1610
|
continue;
|
|
@@ -1636,7 +1627,7 @@ var require_minimatch = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
1636
1627
|
stateChar = c;
|
|
1637
1628
|
if (options.noext) clearStateChar();
|
|
1638
1629
|
continue;
|
|
1639
|
-
case "(":
|
|
1630
|
+
case "(":
|
|
1640
1631
|
if (inClass) {
|
|
1641
1632
|
re += "(";
|
|
1642
1633
|
continue;
|
|
@@ -1645,54 +1636,39 @@ var require_minimatch = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
1645
1636
|
re += "\\(";
|
|
1646
1637
|
continue;
|
|
1647
1638
|
}
|
|
1648
|
-
|
|
1639
|
+
patternListStack.push({
|
|
1649
1640
|
type: stateChar,
|
|
1650
1641
|
start: i - 1,
|
|
1651
1642
|
reStart: re.length,
|
|
1652
1643
|
open: plTypes[stateChar].open,
|
|
1653
1644
|
close: plTypes[stateChar].close
|
|
1654
|
-
};
|
|
1655
|
-
|
|
1656
|
-
patternListStack.push(plEntry);
|
|
1657
|
-
re += plEntry.open;
|
|
1658
|
-
if (plEntry.start === 0 && plEntry.type !== "!") {
|
|
1659
|
-
dotTravAllowed = true;
|
|
1660
|
-
re += subPatternStart(pattern.slice(i + 1));
|
|
1661
|
-
}
|
|
1645
|
+
});
|
|
1646
|
+
re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
|
|
1662
1647
|
this.debug("plType %j %j", stateChar, re);
|
|
1663
1648
|
stateChar = false;
|
|
1664
1649
|
continue;
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
const plEntry = patternListStack[patternListStack.length - 1];
|
|
1668
|
-
if (inClass || !plEntry) {
|
|
1650
|
+
case ")":
|
|
1651
|
+
if (inClass || !patternListStack.length) {
|
|
1669
1652
|
re += "\\)";
|
|
1670
1653
|
continue;
|
|
1671
1654
|
}
|
|
1672
|
-
patternListStack.pop();
|
|
1673
1655
|
clearStateChar();
|
|
1674
1656
|
hasMagic = true;
|
|
1675
|
-
pl =
|
|
1657
|
+
pl = patternListStack.pop();
|
|
1676
1658
|
re += pl.close;
|
|
1677
1659
|
if (pl.type === "!") {
|
|
1678
|
-
negativeLists.push(
|
|
1660
|
+
negativeLists.push(pl);
|
|
1679
1661
|
}
|
|
1662
|
+
pl.reEnd = re.length;
|
|
1680
1663
|
continue;
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
const plEntry = patternListStack[patternListStack.length - 1];
|
|
1684
|
-
if (inClass || !plEntry) {
|
|
1664
|
+
case "|":
|
|
1665
|
+
if (inClass || !patternListStack.length) {
|
|
1685
1666
|
re += "\\|";
|
|
1686
1667
|
continue;
|
|
1687
1668
|
}
|
|
1688
1669
|
clearStateChar();
|
|
1689
1670
|
re += "|";
|
|
1690
|
-
if (plEntry.start === 0 && plEntry.type !== "!") {
|
|
1691
|
-
dotTravAllowed = true;
|
|
1692
|
-
re += subPatternStart(pattern.slice(i + 1));
|
|
1693
|
-
}
|
|
1694
1671
|
continue;
|
|
1695
|
-
}
|
|
1696
1672
|
// these are mostly the same in regexp and glob
|
|
1697
1673
|
case "[":
|
|
1698
1674
|
clearStateChar();
|
|
@@ -1712,13 +1688,17 @@ var require_minimatch = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
1712
1688
|
}
|
|
1713
1689
|
cs = pattern.substring(classStart + 1, i);
|
|
1714
1690
|
try {
|
|
1715
|
-
RegExp("[" +
|
|
1716
|
-
re += c;
|
|
1691
|
+
RegExp("[" + cs + "]");
|
|
1717
1692
|
} catch (er) {
|
|
1718
|
-
|
|
1693
|
+
sp = this.parse(cs, SUBPARSE);
|
|
1694
|
+
re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
|
|
1695
|
+
hasMagic = hasMagic || sp[1];
|
|
1696
|
+
inClass = false;
|
|
1697
|
+
continue;
|
|
1719
1698
|
}
|
|
1720
1699
|
hasMagic = true;
|
|
1721
1700
|
inClass = false;
|
|
1701
|
+
re += c;
|
|
1722
1702
|
continue;
|
|
1723
1703
|
default:
|
|
1724
1704
|
clearStateChar();
|
|
@@ -1730,9 +1710,9 @@ var require_minimatch = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
1730
1710
|
}
|
|
1731
1711
|
}
|
|
1732
1712
|
if (inClass) {
|
|
1733
|
-
cs = pattern.
|
|
1713
|
+
cs = pattern.substr(classStart + 1);
|
|
1734
1714
|
sp = this.parse(cs, SUBPARSE);
|
|
1735
|
-
re = re.
|
|
1715
|
+
re = re.substr(0, reClassStart) + "\\[" + sp[0];
|
|
1736
1716
|
hasMagic = hasMagic || sp[1];
|
|
1737
1717
|
}
|
|
1738
1718
|
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
|
@@ -1761,28 +1741,24 @@ var require_minimatch = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
1761
1741
|
const nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
|
|
1762
1742
|
let nlAfter = re.slice(nl.reEnd);
|
|
1763
1743
|
const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter;
|
|
1764
|
-
const
|
|
1765
|
-
const openParensBefore = nlBefore.split("(").length - closeParensBefore;
|
|
1744
|
+
const openParensBefore = nlBefore.split("(").length - 1;
|
|
1766
1745
|
let cleanAfter = nlAfter;
|
|
1767
1746
|
for (let i = 0; i < openParensBefore; i++) {
|
|
1768
1747
|
cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
|
|
1769
1748
|
}
|
|
1770
1749
|
nlAfter = cleanAfter;
|
|
1771
|
-
const dollar = nlAfter === "" && isSub !== SUBPARSE ? "
|
|
1750
|
+
const dollar = nlAfter === "" && isSub !== SUBPARSE ? "$" : "";
|
|
1772
1751
|
re = nlBefore + nlFirst + nlAfter + dollar + nlLast;
|
|
1773
1752
|
}
|
|
1774
1753
|
if (re !== "" && hasMagic) {
|
|
1775
1754
|
re = "(?=.)" + re;
|
|
1776
1755
|
}
|
|
1777
1756
|
if (addPatternStart) {
|
|
1778
|
-
re = patternStart
|
|
1757
|
+
re = patternStart + re;
|
|
1779
1758
|
}
|
|
1780
1759
|
if (isSub === SUBPARSE) {
|
|
1781
1760
|
return [re, hasMagic];
|
|
1782
1761
|
}
|
|
1783
|
-
if (options.nocase && !hasMagic) {
|
|
1784
|
-
hasMagic = pattern.toUpperCase() !== pattern.toLowerCase();
|
|
1785
|
-
}
|
|
1786
1762
|
if (!hasMagic) {
|
|
1787
1763
|
return globUnescape(pattern);
|
|
1788
1764
|
}
|
|
@@ -4963,7 +4939,7 @@ var require_ensure = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
4963
4939
|
}
|
|
4964
4940
|
});
|
|
4965
4941
|
var require_utils2 = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
4966
|
-
"../../node_modules/.pnpm/jsonfile@6.
|
|
4942
|
+
"../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js"(exports, module2) {
|
|
4967
4943
|
"use strict";
|
|
4968
4944
|
function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
|
|
4969
4945
|
const EOF = finalEOL ? EOL : "";
|
|
@@ -4978,7 +4954,7 @@ var require_utils2 = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
4978
4954
|
}
|
|
4979
4955
|
});
|
|
4980
4956
|
var require_jsonfile = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
4981
|
-
"../../node_modules/.pnpm/jsonfile@6.
|
|
4957
|
+
"../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js"(exports, module2) {
|
|
4982
4958
|
"use strict";
|
|
4983
4959
|
var _fs;
|
|
4984
4960
|
try {
|
|
@@ -5040,12 +5016,13 @@ var require_jsonfile = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
5040
5016
|
const str = stringify(obj, options);
|
|
5041
5017
|
return fs3.writeFileSync(file, str, options);
|
|
5042
5018
|
}
|
|
5043
|
-
|
|
5019
|
+
var jsonfile = {
|
|
5044
5020
|
readFile: readFile2,
|
|
5045
5021
|
readFileSync,
|
|
5046
5022
|
writeFile,
|
|
5047
5023
|
writeFileSync
|
|
5048
5024
|
};
|
|
5025
|
+
module2.exports = jsonfile;
|
|
5049
5026
|
}
|
|
5050
5027
|
});
|
|
5051
5028
|
var require_jsonfile2 = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
@@ -5592,6 +5569,10 @@ async function getSchemaWithPathInternal(schemaPathFromArgs, schemaPathFromConfi
|
|
|
5592
5569
|
if (prismaConfigResult.ok) {
|
|
5593
5570
|
return prismaConfigResult;
|
|
5594
5571
|
}
|
|
5572
|
+
const pkgJsonResult = await getSchemaFromPackageJson(cwd);
|
|
5573
|
+
if (pkgJsonResult.ok) {
|
|
5574
|
+
return pkgJsonResult;
|
|
5575
|
+
}
|
|
5595
5576
|
const defaultResult = await getDefaultSchema(cwd);
|
|
5596
5577
|
if (defaultResult.ok) {
|
|
5597
5578
|
return defaultResult;
|
|
@@ -5648,6 +5629,36 @@ async function readSchemaFromPrismaConfigBasedLocation(schemaPathFromConfig) {
|
|
|
5648
5629
|
}
|
|
5649
5630
|
return schemaResult;
|
|
5650
5631
|
}
|
|
5632
|
+
async function getSchemaFromPackageJson(cwd) {
|
|
5633
|
+
const prismaConfig = await (0, import_config.loadConfigFromPackageJson)(cwd);
|
|
5634
|
+
debug("prismaConfig", prismaConfig);
|
|
5635
|
+
if (!prismaConfig || !prismaConfig.config?.schema) {
|
|
5636
|
+
return { ok: false, error: { kind: "PackageJsonNotConfigured" } };
|
|
5637
|
+
}
|
|
5638
|
+
const schemaPathFromPkgJson = prismaConfig.config.schema;
|
|
5639
|
+
if (typeof schemaPathFromPkgJson !== "string") {
|
|
5640
|
+
throw new Error(
|
|
5641
|
+
`Provided schema path \`${schemaPathFromPkgJson}\` from \`${import_path2.default.relative(
|
|
5642
|
+
cwd,
|
|
5643
|
+
prismaConfig.loadedFromFile
|
|
5644
|
+
)}\` must be of type string`
|
|
5645
|
+
);
|
|
5646
|
+
}
|
|
5647
|
+
const absoluteSchemaPath = import_path2.default.isAbsolute(schemaPathFromPkgJson) ? schemaPathFromPkgJson : import_path2.default.resolve(import_path2.default.dirname(prismaConfig.loadedFromFile), schemaPathFromPkgJson);
|
|
5648
|
+
const lookupResult = await readSchemaFromFileOrDirectory(absoluteSchemaPath);
|
|
5649
|
+
if (!lookupResult.ok) {
|
|
5650
|
+
throw new Error(
|
|
5651
|
+
`Could not load schema from \`${import_path2.default.relative(
|
|
5652
|
+
cwd,
|
|
5653
|
+
absoluteSchemaPath
|
|
5654
|
+
)}\` provided by "prisma.schema" config of \`${import_path2.default.relative(
|
|
5655
|
+
cwd,
|
|
5656
|
+
prismaConfig.loadedFromFile
|
|
5657
|
+
)}\`: ${renderLookupError(lookupResult.error)}`
|
|
5658
|
+
);
|
|
5659
|
+
}
|
|
5660
|
+
return lookupResult;
|
|
5661
|
+
}
|
|
5651
5662
|
async function getDefaultSchema(cwd, failures = []) {
|
|
5652
5663
|
const lookupPaths = [import_path2.default.join(cwd, "schema.prisma"), import_path2.default.join(cwd, "prisma", "schema.prisma")];
|
|
5653
5664
|
for (const path3 of lookupPaths) {
|
|
@@ -5680,17 +5691,26 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
|
5680
5691
|
-o, --output Writes to a file instead of stdout
|
|
5681
5692
|
|
|
5682
5693
|
${(0, import_chunk_SKRR5WT4.italic)("From and To inputs (1 `--from-...` and 1 `--to-...` must be provided):")}
|
|
5694
|
+
--from-url A datasource URL
|
|
5695
|
+
--to-url
|
|
5696
|
+
|
|
5683
5697
|
--from-empty Flag to assume from or to is an empty datamodel
|
|
5684
5698
|
--to-empty
|
|
5685
5699
|
|
|
5686
|
-
--from-schema
|
|
5687
|
-
--to-schema
|
|
5700
|
+
--from-schema-datamodel Path to a Prisma schema file, uses the ${(0, import_chunk_SKRR5WT4.italic)("datamodel")} for the diff
|
|
5701
|
+
--to-schema-datamodel
|
|
5702
|
+
|
|
5703
|
+
--from-schema-datasource Path to a Prisma schema file, uses the ${(0, import_chunk_SKRR5WT4.italic)("datasource url")} for the diff
|
|
5704
|
+
--to-schema-datasource
|
|
5688
5705
|
|
|
5689
5706
|
--from-migrations Path to the Prisma Migrate migrations directory
|
|
5690
5707
|
--to-migrations
|
|
5691
5708
|
|
|
5692
|
-
--from-
|
|
5693
|
-
--to-
|
|
5709
|
+
--from-local-d1 Automatically locate the local Cloudflare D1 database
|
|
5710
|
+
--to-local-d1
|
|
5711
|
+
|
|
5712
|
+
${(0, import_chunk_SKRR5WT4.italic)("Shadow database (only required if using --from-migrations or --to-migrations):")}
|
|
5713
|
+
--shadow-database-url URL for the shadow database
|
|
5694
5714
|
|
|
5695
5715
|
${(0, import_chunk_SKRR5WT4.bold)("Flags")}
|
|
5696
5716
|
|
|
@@ -5711,7 +5731,7 @@ The command takes a source ${(0, import_chunk_SKRR5WT4.green)(`--from-...`)} and
|
|
|
5711
5731
|
The source and destination must use the same provider,
|
|
5712
5732
|
e.g. a diff using 2 different providers like PostgreSQL and SQLite is not supported.
|
|
5713
5733
|
|
|
5714
|
-
It compares the source with the destination to generate a diff.
|
|
5734
|
+
It compares the source with the destination to generate a diff.
|
|
5715
5735
|
The diff can be interpreted as generating a migration that brings the source schema (from) to the shape of the destination schema (to).
|
|
5716
5736
|
The default output is a human readable diff, it can be rendered as SQL using \`--script\` on SQL databases.
|
|
5717
5737
|
|
|
@@ -5719,26 +5739,47 @@ See the documentation for more information ${(0, import_internals.link)("https:/
|
|
|
5719
5739
|
|
|
5720
5740
|
${helpOptions}
|
|
5721
5741
|
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
5722
|
-
|
|
5723
|
-
From
|
|
5742
|
+
|
|
5743
|
+
From database to database as summary
|
|
5744
|
+
e.g. compare two live databases
|
|
5745
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
|
|
5746
|
+
--from-url "$DATABASE_URL" \\
|
|
5747
|
+
--to-url "postgresql://login:password@localhost:5432/db2"
|
|
5748
|
+
|
|
5749
|
+
From a live database to a Prisma datamodel
|
|
5724
5750
|
e.g. roll forward after a migration failed in the middle
|
|
5725
5751
|
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
|
|
5726
|
-
--
|
|
5727
|
-
--
|
|
5752
|
+
--shadow-database-url "$SHADOW_DB" \\
|
|
5753
|
+
--from-url "$PROD_DB" \\
|
|
5754
|
+
--to-schema-datamodel=next_datamodel.prisma \\
|
|
5755
|
+
--script
|
|
5756
|
+
|
|
5757
|
+
From a live database to a datamodel
|
|
5758
|
+
e.g. roll backward after a migration failed in the middle
|
|
5759
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
|
|
5760
|
+
--shadow-database-url "$SHADOW_DB" \\
|
|
5761
|
+
--from-url "$PROD_DB" \\
|
|
5762
|
+
--to-schema-datamodel=previous_datamodel.prisma \\
|
|
5728
5763
|
--script
|
|
5729
5764
|
|
|
5730
|
-
From a
|
|
5731
|
-
e.g. roll forward after a migration failed in the middle
|
|
5765
|
+
From a local D1 database to a datamodel
|
|
5732
5766
|
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
|
|
5733
|
-
--from-
|
|
5734
|
-
--to-
|
|
5767
|
+
--from-local-d1 \\
|
|
5768
|
+
--to-schema-datamodel=./prisma/schema.prisma \\
|
|
5735
5769
|
--script
|
|
5736
5770
|
|
|
5737
|
-
From a Prisma
|
|
5771
|
+
From a Prisma datamodel to a local D1 database
|
|
5772
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
|
|
5773
|
+
--from-schema-datamodel=./prisma/schema.prisma \\
|
|
5774
|
+
--to-local-d1 \\
|
|
5775
|
+
--script
|
|
5776
|
+
|
|
5777
|
+
From a Prisma Migrate \`migrations\` directory to another database
|
|
5738
5778
|
e.g. generate a migration for a hotfix already applied on production
|
|
5739
5779
|
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
|
|
5780
|
+
--shadow-database-url "$SHADOW_DB" \\
|
|
5740
5781
|
--from-migrations ./migrations \\
|
|
5741
|
-
--to-
|
|
5782
|
+
--to-url "$PROD_DB" \\
|
|
5742
5783
|
--script
|
|
5743
5784
|
|
|
5744
5785
|
Execute the --script output with \`prisma db execute\` using bash pipe \`|\`
|
|
@@ -5763,43 +5804,54 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
5763
5804
|
"-o": "--output",
|
|
5764
5805
|
// From
|
|
5765
5806
|
"--from-empty": Boolean,
|
|
5766
|
-
"--from-
|
|
5767
|
-
"--from-schema": String,
|
|
5807
|
+
"--from-schema-datasource": String,
|
|
5808
|
+
"--from-schema-datamodel": String,
|
|
5809
|
+
"--from-url": String,
|
|
5768
5810
|
"--from-migrations": String,
|
|
5811
|
+
"--from-local-d1": Boolean,
|
|
5769
5812
|
// To
|
|
5770
5813
|
"--to-empty": Boolean,
|
|
5771
|
-
"--to-
|
|
5772
|
-
"--to-schema": String,
|
|
5814
|
+
"--to-schema-datasource": String,
|
|
5815
|
+
"--to-schema-datamodel": String,
|
|
5816
|
+
"--to-url": String,
|
|
5773
5817
|
"--to-migrations": String,
|
|
5818
|
+
"--to-local-d1": Boolean,
|
|
5774
5819
|
// Others
|
|
5820
|
+
"--shadow-database-url": String,
|
|
5775
5821
|
"--script": Boolean,
|
|
5776
5822
|
"--exit-code": Boolean,
|
|
5777
5823
|
"--telemetry-information": String,
|
|
5778
|
-
"--config": String
|
|
5779
|
-
// Removed, but parsed to show help error
|
|
5780
|
-
"--from-url": String,
|
|
5781
|
-
"--to-url": String,
|
|
5782
|
-
"--from-schema-datasource": String,
|
|
5783
|
-
"--to-schema-datasource": String,
|
|
5784
|
-
"--from-schema-datamodel": String,
|
|
5785
|
-
"--to-schema-datamodel": String,
|
|
5786
|
-
"--from-local-d1": Boolean,
|
|
5787
|
-
"--to-local-d1": Boolean
|
|
5824
|
+
"--config": String
|
|
5788
5825
|
},
|
|
5789
5826
|
false
|
|
5790
5827
|
);
|
|
5791
5828
|
if ((0, import_internals.isError)(args)) {
|
|
5792
5829
|
return this.help(args.message);
|
|
5793
5830
|
}
|
|
5831
|
+
const cmd = "migrate diff";
|
|
5832
|
+
(0, import_internals.checkUnsupportedDataProxy)({
|
|
5833
|
+
cmd,
|
|
5834
|
+
urls: [args["--to-url"], args["--from-url"], args["--shadow-database-url"]]
|
|
5835
|
+
});
|
|
5836
|
+
(0, import_internals.checkUnsupportedSchemaEngineWasm)({
|
|
5837
|
+
cmd,
|
|
5838
|
+
config,
|
|
5839
|
+
args,
|
|
5840
|
+
flags: [
|
|
5841
|
+
"--from-url",
|
|
5842
|
+
"--to-url",
|
|
5843
|
+
"--from-schema-datasource",
|
|
5844
|
+
"--to-schema-datasource",
|
|
5845
|
+
"--shadow-database-url",
|
|
5846
|
+
"--to-local-d1",
|
|
5847
|
+
"--from-local-d1"
|
|
5848
|
+
]
|
|
5849
|
+
});
|
|
5794
5850
|
if (args["--help"]) {
|
|
5795
5851
|
return this.help();
|
|
5796
5852
|
}
|
|
5797
|
-
const
|
|
5798
|
-
|
|
5799
|
-
return this.help(removedTargetParameterHint);
|
|
5800
|
-
}
|
|
5801
|
-
const numberOfFromParameterProvided = Number(Boolean(args["--from-empty"])) + Number(Boolean(args["--from-config-datasource"])) + Number(Boolean(args["--from-schema"])) + Number(Boolean(args["--from-migrations"]));
|
|
5802
|
-
const numberOfToParameterProvided = Number(Boolean(args["--to-empty"])) + Number(Boolean(args["--to-config-datasource"])) + Number(Boolean(args["--to-schema"])) + Number(Boolean(args["--to-migrations"]));
|
|
5853
|
+
const numberOfFromParameterProvided = Number(Boolean(args["--from-empty"])) + Number(Boolean(args["--from-schema-datasource"])) + Number(Boolean(args["--from-schema-datamodel"])) + Number(Boolean(args["--from-url"])) + Number(Boolean(args["--from-migrations"])) + Number(Boolean(args["--from-local-d1"]));
|
|
5854
|
+
const numberOfToParameterProvided = Number(Boolean(args["--to-empty"])) + Number(Boolean(args["--to-schema-datasource"])) + Number(Boolean(args["--to-schema-datamodel"])) + Number(Boolean(args["--to-url"])) + Number(Boolean(args["--to-migrations"])) + Number(Boolean(args["--to-local-d1"]));
|
|
5803
5855
|
if (numberOfFromParameterProvided !== 1 || numberOfToParameterProvided !== 1) {
|
|
5804
5856
|
const errorMessages = [];
|
|
5805
5857
|
if (numberOfFromParameterProvided !== 1) {
|
|
@@ -5810,33 +5862,52 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
5810
5862
|
}
|
|
5811
5863
|
return this.help(`${errorMessages.join("\n")}`);
|
|
5812
5864
|
}
|
|
5865
|
+
if (args["--shadow-database-url"] && (args["--from-local-d1"] || args["--to-local-d1"])) {
|
|
5866
|
+
return this.help(
|
|
5867
|
+
`The flag \`--shadow-database-url\` is not compatible with \`--from-local-d1\` or \`--to-local-d1\`.`
|
|
5868
|
+
);
|
|
5869
|
+
}
|
|
5813
5870
|
let from;
|
|
5814
5871
|
if (args["--from-empty"]) {
|
|
5815
5872
|
from = {
|
|
5816
5873
|
tag: "empty"
|
|
5817
5874
|
};
|
|
5818
|
-
} else if (args["--from-schema"]) {
|
|
5819
|
-
|
|
5820
|
-
|
|
5875
|
+
} else if (args["--from-schema-datasource"]) {
|
|
5876
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--from-schema-datasource"], printMessage: false, config });
|
|
5877
|
+
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
5878
|
+
schemaPathFromArg: args["--from-schema-datasource"],
|
|
5879
|
+
schemaPathArgumentName: "--from-schema-datasource",
|
|
5880
|
+
schemaEngineConfig: config,
|
|
5881
|
+
printLoadMessage: false
|
|
5882
|
+
});
|
|
5883
|
+
(0, import_internals.checkUnsupportedDataProxy)({ cmd: "migrate diff", schemaContext });
|
|
5884
|
+
from = {
|
|
5885
|
+
tag: "schemaDatasource",
|
|
5886
|
+
...(0, import_internals.toSchemasWithConfigDir)(schemaContext)
|
|
5887
|
+
};
|
|
5888
|
+
} else if (args["--from-schema-datamodel"]) {
|
|
5889
|
+
const schema = await getSchemaWithPath(import_path.default.resolve(args["--from-schema-datamodel"]), config.schema, {
|
|
5890
|
+
argumentName: "--from-schema-datamodel"
|
|
5821
5891
|
});
|
|
5822
5892
|
from = {
|
|
5823
5893
|
tag: "schemaDatamodel",
|
|
5824
5894
|
...(0, import_internals.toSchemasContainer)(schema.schemas)
|
|
5825
5895
|
};
|
|
5896
|
+
} else if (args["--from-url"]) {
|
|
5897
|
+
from = {
|
|
5898
|
+
tag: "url",
|
|
5899
|
+
url: args["--from-url"]
|
|
5900
|
+
};
|
|
5826
5901
|
} else if (args["--from-migrations"]) {
|
|
5827
5902
|
from = {
|
|
5828
5903
|
tag: "migrations",
|
|
5829
5904
|
...await (0, import_chunk_GGA2F64G.listMigrations)(args["--from-migrations"], config.migrations?.initShadowDb ?? "")
|
|
5830
5905
|
};
|
|
5831
|
-
} else if (args["--from-
|
|
5832
|
-
const
|
|
5833
|
-
schemaPathFromConfig: config.schema,
|
|
5834
|
-
schemaEngineConfig: config,
|
|
5835
|
-
printLoadMessage: false
|
|
5836
|
-
});
|
|
5906
|
+
} else if (args["--from-local-d1"]) {
|
|
5907
|
+
const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--from-local-d1" });
|
|
5837
5908
|
from = {
|
|
5838
|
-
tag: "
|
|
5839
|
-
|
|
5909
|
+
tag: "url",
|
|
5910
|
+
url: `file:${d1Database}`
|
|
5840
5911
|
};
|
|
5841
5912
|
}
|
|
5842
5913
|
let to;
|
|
@@ -5844,35 +5915,48 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
5844
5915
|
to = {
|
|
5845
5916
|
tag: "empty"
|
|
5846
5917
|
};
|
|
5847
|
-
} else if (args["--to-schema"]) {
|
|
5848
|
-
|
|
5849
|
-
|
|
5918
|
+
} else if (args["--to-schema-datasource"]) {
|
|
5919
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--to-schema-datasource"], printMessage: false, config });
|
|
5920
|
+
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
5921
|
+
schemaPathFromArg: args["--to-schema-datasource"],
|
|
5922
|
+
schemaPathArgumentName: "--to-schema-datasource",
|
|
5923
|
+
printLoadMessage: false
|
|
5924
|
+
});
|
|
5925
|
+
(0, import_internals.checkUnsupportedDataProxy)({ cmd: "migrate diff", schemaContext });
|
|
5926
|
+
to = {
|
|
5927
|
+
tag: "schemaDatasource",
|
|
5928
|
+
...(0, import_internals.toSchemasWithConfigDir)(schemaContext)
|
|
5929
|
+
};
|
|
5930
|
+
} else if (args["--to-schema-datamodel"]) {
|
|
5931
|
+
const schema = await getSchemaWithPath(import_path.default.resolve(args["--to-schema-datamodel"]), config.schema, {
|
|
5932
|
+
argumentName: "--to-schema-datamodel"
|
|
5850
5933
|
});
|
|
5851
5934
|
to = {
|
|
5852
5935
|
tag: "schemaDatamodel",
|
|
5853
5936
|
...(0, import_internals.toSchemasContainer)(schema.schemas)
|
|
5854
5937
|
};
|
|
5938
|
+
} else if (args["--to-url"]) {
|
|
5939
|
+
to = {
|
|
5940
|
+
tag: "url",
|
|
5941
|
+
url: args["--to-url"]
|
|
5942
|
+
};
|
|
5855
5943
|
} else if (args["--to-migrations"]) {
|
|
5856
5944
|
to = {
|
|
5857
5945
|
tag: "migrations",
|
|
5858
5946
|
...await (0, import_chunk_GGA2F64G.listMigrations)(args["--to-migrations"], config.migrations?.initShadowDb ?? "")
|
|
5859
5947
|
};
|
|
5860
|
-
} else if (args["--to-
|
|
5861
|
-
const
|
|
5862
|
-
schemaPathFromConfig: config.schema,
|
|
5863
|
-
schemaEngineConfig: config,
|
|
5864
|
-
printLoadMessage: false
|
|
5865
|
-
});
|
|
5948
|
+
} else if (args["--to-local-d1"]) {
|
|
5949
|
+
const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--to-local-d1" });
|
|
5866
5950
|
to = {
|
|
5867
|
-
tag: "
|
|
5868
|
-
|
|
5951
|
+
tag: "url",
|
|
5952
|
+
url: `file:${d1Database}`
|
|
5869
5953
|
};
|
|
5870
5954
|
}
|
|
5871
5955
|
const schemaFilter = {
|
|
5872
5956
|
externalTables: config.tables?.external ?? [],
|
|
5873
5957
|
externalEnums: config.enums?.external ?? []
|
|
5874
5958
|
};
|
|
5875
|
-
const migrate = await
|
|
5959
|
+
const migrate = await import_chunk_D6LYHB65.Migrate.setup({
|
|
5876
5960
|
schemaEngineConfig: config,
|
|
5877
5961
|
schemaFilter,
|
|
5878
5962
|
extensions: config["extensions"]
|
|
@@ -5922,20 +6006,3 @@ ${helpOptions}`);
|
|
|
5922
6006
|
return _MigrateDiff.help;
|
|
5923
6007
|
}
|
|
5924
6008
|
};
|
|
5925
|
-
function getRemovedTargetParameterHint(parameter) {
|
|
5926
|
-
switch (parameter) {
|
|
5927
|
-
case "--from-url":
|
|
5928
|
-
case "--to-url":
|
|
5929
|
-
case "--from-schema-datasource":
|
|
5930
|
-
case "--to-schema-datasource":
|
|
5931
|
-
return `\`${parameter}\` was removed. Please use \`--[from/to]-config-datasource\` in combination with a Prisma config file that contains the appropriate datasource instead.`;
|
|
5932
|
-
case "--from-schema-datamodel":
|
|
5933
|
-
case "--to-schema-datamodel":
|
|
5934
|
-
return `\`${parameter}\` was removed. Please use \`--[from/to]-schema\` instead.`;
|
|
5935
|
-
case "--from-local-d1":
|
|
5936
|
-
case "--to-local-d1":
|
|
5937
|
-
return `\`${parameter}\` was removed. Please use \`--[from/to]-config-datasource\` in combination with a Prisma config file that contains the appropriate datasource instead. The \`@prisma/adapter-d1\` package exposes a \`listLocalDatabases()\` helper function to help you locate your local D1 databases. You can use the paths returned from that function to construct your datasource URL(s).`;
|
|
5938
|
-
default:
|
|
5939
|
-
return;
|
|
5940
|
-
}
|
|
5941
|
-
}
|
package/dist/commands/DbDrop.js
CHANGED
|
@@ -18,10 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var DbDrop_exports = {};
|
|
20
20
|
__export(DbDrop_exports, {
|
|
21
|
-
DbDrop: () =>
|
|
21
|
+
DbDrop: () => import_chunk_Z27SI4AV.DbDrop
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(DbDrop_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_chunk_Z27SI4AV = require("../chunk-Z27SI4AV.js");
|
|
25
25
|
var import_chunk_IHDN3L3R = require("../chunk-IHDN3L3R.js");
|
|
26
26
|
var import_chunk_FBDQVK4W = require("../chunk-FBDQVK4W.js");
|
|
27
27
|
var import_chunk_3WC4XD74 = require("../chunk-3WC4XD74.js");
|