@prisma/migrate 7.9.0-dev.2 → 7.9.0-dev.20
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/bin.js +6 -6
- package/dist/{chunk-QVMYNWAN.js → chunk-5JVYZEWJ.js} +7 -6
- package/dist/{chunk-WVAPMHNT.js → chunk-L6GPGK4U.js} +5 -5
- package/dist/chunk-PHX6STZ3.js +147 -0
- package/dist/{chunk-53R5LH65.js → chunk-UA3FFRRV.js} +5 -5
- package/dist/{chunk-KPQKIXQM.js → chunk-WP5M3D4N.js} +8 -5
- package/dist/commands/DbDrop.js +3 -3
- package/dist/commands/DbPush.js +3 -3
- package/dist/commands/MigrateReset.js +3 -3
- package/dist/index.js +7 -7
- package/dist/src/utils/ai-safety.d.ts +19 -1
- package/dist/utils/ai-safety.js +3 -2
- package/dist/utils/setupCockroach.js +2 -2
- package/dist/utils/setupPostgres.js +2 -2
- package/package.json +9 -9
- package/dist/chunk-FBDQVK4W.js +0 -77
package/dist/bin.js
CHANGED
|
@@ -29,7 +29,7 @@ var import_chunk_6UO6YJTU = require("./chunk-6UO6YJTU.js");
|
|
|
29
29
|
var import_chunk_C3722PDA = require("./chunk-C3722PDA.js");
|
|
30
30
|
var import_chunk_7CQBDP4H = require("./chunk-7CQBDP4H.js");
|
|
31
31
|
var import_chunk_RM4WK3ML = require("./chunk-RM4WK3ML.js");
|
|
32
|
-
var
|
|
32
|
+
var import_chunk_L6GPGK4U = require("./chunk-L6GPGK4U.js");
|
|
33
33
|
var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
|
|
34
34
|
var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
|
|
35
35
|
var import_chunk_2R6DII47 = require("./chunk-2R6DII47.js");
|
|
@@ -45,8 +45,8 @@ var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
|
|
|
45
45
|
var import_chunk_JFKDSUIE = require("./chunk-JFKDSUIE.js");
|
|
46
46
|
var import_chunk_AHJ2N6BJ = require("./chunk-AHJ2N6BJ.js");
|
|
47
47
|
var import_chunk_LGYRZ6CV = require("./chunk-LGYRZ6CV.js");
|
|
48
|
-
var
|
|
49
|
-
var
|
|
48
|
+
var import_chunk_WP5M3D4N = require("./chunk-WP5M3D4N.js");
|
|
49
|
+
var import_chunk_PHX6STZ3 = require("./chunk-PHX6STZ3.js");
|
|
50
50
|
var import_chunk_ZUHJASAP = require("./chunk-ZUHJASAP.js");
|
|
51
51
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
52
52
|
var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
|
|
@@ -67,7 +67,7 @@ var import_config = require("@prisma/config");
|
|
|
67
67
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
68
68
|
var import_engines_version = require("@prisma/engines-version");
|
|
69
69
|
var import_internals = require("@prisma/internals");
|
|
70
|
-
var version = "7.9.0-dev.
|
|
70
|
+
var version = "7.9.0-dev.20";
|
|
71
71
|
process.on("uncaughtException", (e) => {
|
|
72
72
|
console.log(e);
|
|
73
73
|
});
|
|
@@ -92,14 +92,14 @@ async function main() {
|
|
|
92
92
|
dev: import_chunk_6UO6YJTU.MigrateDev.new(),
|
|
93
93
|
status: import_chunk_TDN3QQTH.MigrateStatus.new(),
|
|
94
94
|
resolve: import_chunk_AL3XYISJ.MigrateResolve.new(),
|
|
95
|
-
reset:
|
|
95
|
+
reset: import_chunk_L6GPGK4U.MigrateReset.new(),
|
|
96
96
|
deploy: import_chunk_TEUL2TU3.MigrateDeploy.new(),
|
|
97
97
|
diff: import_chunk_RM4WK3ML.MigrateDiff.new()
|
|
98
98
|
}),
|
|
99
99
|
db: import_chunk_2HCAA4GX.DbCommand.new({
|
|
100
100
|
execute: import_chunk_QCPYZUFF.DbExecute.new(),
|
|
101
101
|
pull: import_chunk_2UHNNEP4.DbPull.new(),
|
|
102
|
-
push:
|
|
102
|
+
push: import_chunk_WP5M3D4N.DbPush.new(),
|
|
103
103
|
// drop: DbDrop.new(),
|
|
104
104
|
seed: import_chunk_XTEEOIUV.DbSeed.new()
|
|
105
105
|
})
|
|
@@ -16,11 +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(
|
|
19
|
+
var chunk_5JVYZEWJ_exports = {};
|
|
20
|
+
__export(chunk_5JVYZEWJ_exports, {
|
|
21
21
|
require_lib: () => require_lib2
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(chunk_5JVYZEWJ_exports);
|
|
24
24
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
25
25
|
var require_postgres_array = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
26
26
|
"../../node_modules/.pnpm/postgres-array@2.0.0/node_modules/postgres-array/index.js"(exports) {
|
|
@@ -322,11 +322,12 @@ var require_postgres_interval = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
324
|
var require_postgres_bytea = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
325
|
-
"../../node_modules/.pnpm/postgres-bytea@1.0.
|
|
325
|
+
"../../node_modules/.pnpm/postgres-bytea@1.0.1/node_modules/postgres-bytea/index.js"(exports, module2) {
|
|
326
326
|
"use strict";
|
|
327
|
+
var bufferFrom = Buffer.from || Buffer;
|
|
327
328
|
module2.exports = function parseBytea(input) {
|
|
328
329
|
if (/^\\x/.test(input)) {
|
|
329
|
-
return
|
|
330
|
+
return bufferFrom(input.substr(2), "hex");
|
|
330
331
|
}
|
|
331
332
|
var output = "";
|
|
332
333
|
var i = 0;
|
|
@@ -350,7 +351,7 @@ var require_postgres_bytea = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
350
351
|
}
|
|
351
352
|
}
|
|
352
353
|
}
|
|
353
|
-
return
|
|
354
|
+
return bufferFrom(output, "binary");
|
|
354
355
|
};
|
|
355
356
|
}
|
|
356
357
|
});
|
|
@@ -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_L6GPGK4U_exports = {};
|
|
30
|
+
__export(chunk_L6GPGK4U_exports, {
|
|
31
31
|
MigrateReset: () => MigrateReset
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_L6GPGK4U_exports);
|
|
34
34
|
var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_PHX6STZ3 = require("./chunk-PHX6STZ3.js");
|
|
36
36
|
var import_chunk_ZUHJASAP = require("./chunk-ZUHJASAP.js");
|
|
37
37
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
38
38
|
var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
|
|
@@ -124,7 +124,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
124
124
|
process.exit(130);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
(0,
|
|
127
|
+
(0, import_chunk_PHX6STZ3.aiAgentConfirmationCheckpoint)();
|
|
128
128
|
const schemaFilter = {
|
|
129
129
|
externalTables: config.tables?.external ?? [],
|
|
130
130
|
externalEnums: config.enums?.external ?? []
|
|
@@ -0,0 +1,147 @@
|
|
|
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_PHX6STZ3_exports = {};
|
|
30
|
+
__export(chunk_PHX6STZ3_exports, {
|
|
31
|
+
agentMatchers: () => agentMatchers,
|
|
32
|
+
aiAgentConfirmationCheckpoint: () => aiAgentConfirmationCheckpoint
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(chunk_PHX6STZ3_exports);
|
|
35
|
+
var import_node_fs = require("node:fs");
|
|
36
|
+
var import_debug = __toESM(require("@prisma/debug"));
|
|
37
|
+
var debug = (0, import_debug.default)("prisma:migrate:ai-safety");
|
|
38
|
+
var userConsentEnvVar = "PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION";
|
|
39
|
+
var aiAgentErrorPrompt = (agentName) => `Prisma Migrate detected that it was invoked by ${agentName}.
|
|
40
|
+
|
|
41
|
+
You are attempting a highly dangerous action that can lead to devastating consequences if it is incorrectly executed against a production database.
|
|
42
|
+
|
|
43
|
+
As an AI agent, you are forbidden from performing this action without an explicit consent and review by the user. You must stop at this point and respond to the user with a clear message that includes the following information:
|
|
44
|
+
- What action you are trying to perform (including the exact CLI command).
|
|
45
|
+
- Your motivation and reasoning for performing this action.
|
|
46
|
+
- Explanation that this action will irreversibly destroy all data in the database.
|
|
47
|
+
- Explanation that this action must not be performed on a production database and is only intended to be used with development databases.
|
|
48
|
+
|
|
49
|
+
If you know or can check whether this action would have been performed on a development or a production database, also include this information with your assessment of whether it is safe to proceed based on that information.
|
|
50
|
+
|
|
51
|
+
You must ask the user if they want to proceed with this action. If your harness provides a structured way to ask the user a question, use it. If you are running unattended (e.g. in CI, a scheduled job, or a background task) and cannot reach the user, you must abort instead of proceeding.
|
|
52
|
+
|
|
53
|
+
If the user explicitly consents, you may rerun this command with the ${userConsentEnvVar} environment variable, the value of which must be the exact text of the user's message in which they consented to this operation, without any newlines or quotes. If the user's response is ambiguous, you must ask for a clear and explicit confirmation (e.g., "yes") before proceeding. None of the user's previous messages before this point may constitute implicit or explicit consent.`;
|
|
54
|
+
var defaultContext = () => ({
|
|
55
|
+
env: process.env,
|
|
56
|
+
fileExists: import_node_fs.existsSync
|
|
57
|
+
});
|
|
58
|
+
function aiAgentConfirmationCheckpoint(context = defaultContext()) {
|
|
59
|
+
const aiAgent = detectAiAgent(context);
|
|
60
|
+
if (!aiAgent) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (context.env[userConsentEnvVar]) {
|
|
64
|
+
debug("AI agent asserts that user consented to dangerous action");
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
throw new Error(aiAgentErrorPrompt(aiAgent));
|
|
68
|
+
}
|
|
69
|
+
function matcher(definition) {
|
|
70
|
+
return definition;
|
|
71
|
+
}
|
|
72
|
+
function envMarker(agentName, ...envVars) {
|
|
73
|
+
return {
|
|
74
|
+
envVars,
|
|
75
|
+
files: [],
|
|
76
|
+
detect: ({ env }) => envVars.some((name) => env[name]) ? agentName : void 0
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function envValue(agentName, envVar, value) {
|
|
80
|
+
return {
|
|
81
|
+
envVars: [envVar],
|
|
82
|
+
files: [],
|
|
83
|
+
detect: ({ env }) => env[envVar] === value ? agentName : void 0
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
var devinMarkerFile = "/opt/.devin";
|
|
87
|
+
var agentMatchers = [
|
|
88
|
+
envMarker("Claude Code", "CLAUDECODE"),
|
|
89
|
+
// CODEX_SANDBOX is only set on macOS; the other markers are cross-platform.
|
|
90
|
+
envMarker("Codex CLI", "CODEX_THREAD_ID", "CODEX_CI", "CODEX_SANDBOX", "CODEX_SANDBOX_NETWORK_DISABLED"),
|
|
91
|
+
envMarker("Gemini CLI", "GEMINI_CLI"),
|
|
92
|
+
envMarker("Qwen Code", "QWEN_CODE"),
|
|
93
|
+
envMarker("Cursor", "CURSOR_AGENT"),
|
|
94
|
+
envMarker("GitHub Copilot CLI", "COPILOT_CLI"),
|
|
95
|
+
envMarker("OpenCode", "OPENCODE", "OPENCODE_CLIENT"),
|
|
96
|
+
envMarker("Cline", "CLINE_ACTIVE"),
|
|
97
|
+
envValue("Goose", "AGENT", "goose"),
|
|
98
|
+
envValue("Amp", "AGENT", "amp"),
|
|
99
|
+
envMarker("Crush", "CRUSH"),
|
|
100
|
+
envValue("Aider", "OR_APP_NAME", "Aider"),
|
|
101
|
+
envMarker("Augment Code", "AUGMENT_AGENT"),
|
|
102
|
+
envMarker("Antigravity", "ANTIGRAVITY_AGENT"),
|
|
103
|
+
// Replit does not document an agent marker. Observed behavior: in a
|
|
104
|
+
// human-controlled shell REPLIT_SESSION looks like `<user>-Xxxx`,
|
|
105
|
+
// while in an agent session it looks like `agent-<numeric id>-<random suffix>`.
|
|
106
|
+
matcher({
|
|
107
|
+
envVars: ["REPLIT_SESSION"],
|
|
108
|
+
files: [],
|
|
109
|
+
detect: ({ env }) => env.REPLIT_SESSION?.startsWith("agent-") ? "Replit Agent" : void 0
|
|
110
|
+
}),
|
|
111
|
+
// Devin does not set an environment variable; its VM is marked by a file.
|
|
112
|
+
matcher({
|
|
113
|
+
envVars: [],
|
|
114
|
+
files: [devinMarkerFile],
|
|
115
|
+
detect: ({ fileExists }) => fileExists(devinMarkerFile) ? "Devin" : void 0
|
|
116
|
+
}),
|
|
117
|
+
// Generic conventions: `AI_AGENT=<name>` (promoted by @vercel/detect-agent)
|
|
118
|
+
// and `AGENT=<name or 1>` (set by e.g. Goose, Amp, Crush, OpenCode).
|
|
119
|
+
matcher({
|
|
120
|
+
envVars: ["AI_AGENT", "AGENT"],
|
|
121
|
+
files: [],
|
|
122
|
+
detect: ({ env }) => {
|
|
123
|
+
const generic = env.AI_AGENT || env.AGENT;
|
|
124
|
+
if (!generic) {
|
|
125
|
+
return void 0;
|
|
126
|
+
}
|
|
127
|
+
if (generic === "1") {
|
|
128
|
+
return "an unidentified AI agent";
|
|
129
|
+
}
|
|
130
|
+
const sanitized = generic.slice(0, 64).replace(/[^\x20-\x7e]+/g, " ").trim();
|
|
131
|
+
if (!sanitized) {
|
|
132
|
+
return "an unidentified AI agent";
|
|
133
|
+
}
|
|
134
|
+
return `an AI agent identifying itself as ${JSON.stringify(sanitized)}`;
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
];
|
|
138
|
+
function detectAiAgent(context) {
|
|
139
|
+
for (const matcher2 of agentMatchers) {
|
|
140
|
+
const agentName = matcher2.detect(context);
|
|
141
|
+
if (agentName) {
|
|
142
|
+
debug("Detected %s", agentName);
|
|
143
|
+
return agentName;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return void 0;
|
|
147
|
+
}
|
|
@@ -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_UA3FFRRV_exports = {};
|
|
30
|
+
__export(chunk_UA3FFRRV_exports, {
|
|
31
31
|
DbDrop: () => DbDrop
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_UA3FFRRV_exports);
|
|
34
34
|
var import_chunk_IHDN3L3R = require("./chunk-IHDN3L3R.js");
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_PHX6STZ3 = require("./chunk-PHX6STZ3.js");
|
|
36
36
|
var import_chunk_ZUHJASAP = require("./chunk-ZUHJASAP.js");
|
|
37
37
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
38
38
|
var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
|
|
@@ -128,7 +128,7 @@ ${(0, import_chunk_SKRR5WT4.red)("All data will be lost")}.`
|
|
|
128
128
|
throw Error(`The database name entered "${confirmation.value}" doesn't match "${datasourceInfo.dbName}".`);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
(0,
|
|
131
|
+
(0, import_chunk_PHX6STZ3.aiAgentConfirmationCheckpoint)();
|
|
132
132
|
if (datasourceInfo.url === void 0) {
|
|
133
133
|
throw new Error("Datasource URL is undefined");
|
|
134
134
|
}
|
|
@@ -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_WP5M3D4N_exports = {};
|
|
30
|
+
__export(chunk_WP5M3D4N_exports, {
|
|
31
31
|
DbPush: () => DbPush
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_WP5M3D4N_exports);
|
|
34
|
+
var import_chunk_PHX6STZ3 = require("./chunk-PHX6STZ3.js");
|
|
35
35
|
var import_chunk_ZUHJASAP = require("./chunk-ZUHJASAP.js");
|
|
36
36
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
37
37
|
var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
|
|
@@ -144,7 +144,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
144
144
|
let wasDatabaseReset = false;
|
|
145
145
|
if (args["--force-reset"]) {
|
|
146
146
|
process.stdout.write("\n");
|
|
147
|
-
(0,
|
|
147
|
+
(0, import_chunk_PHX6STZ3.aiAgentConfirmationCheckpoint)();
|
|
148
148
|
try {
|
|
149
149
|
await migrate.reset();
|
|
150
150
|
} catch (e) {
|
|
@@ -172,6 +172,9 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
172
172
|
const before = Math.round(performance.now());
|
|
173
173
|
let migration;
|
|
174
174
|
try {
|
|
175
|
+
if (args["--accept-data-loss"]) {
|
|
176
|
+
(0, import_chunk_PHX6STZ3.aiAgentConfirmationCheckpoint)();
|
|
177
|
+
}
|
|
175
178
|
migration = await migrate.push({
|
|
176
179
|
force: args["--accept-data-loss"]
|
|
177
180
|
});
|
package/dist/commands/DbDrop.js
CHANGED
|
@@ -18,12 +18,12 @@ 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_UA3FFRRV.DbDrop
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(DbDrop_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_chunk_UA3FFRRV = require("../chunk-UA3FFRRV.js");
|
|
25
25
|
var import_chunk_IHDN3L3R = require("../chunk-IHDN3L3R.js");
|
|
26
|
-
var
|
|
26
|
+
var import_chunk_PHX6STZ3 = require("../chunk-PHX6STZ3.js");
|
|
27
27
|
var import_chunk_ZUHJASAP = require("../chunk-ZUHJASAP.js");
|
|
28
28
|
var import_chunk_QOPTDDIH = require("../chunk-QOPTDDIH.js");
|
|
29
29
|
var import_chunk_BRPS327A = require("../chunk-BRPS327A.js");
|
package/dist/commands/DbPush.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 DbPush_exports = {};
|
|
20
20
|
__export(DbPush_exports, {
|
|
21
|
-
DbPush: () =>
|
|
21
|
+
DbPush: () => import_chunk_WP5M3D4N.DbPush
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(DbPush_exports);
|
|
24
|
-
var
|
|
25
|
-
var
|
|
24
|
+
var import_chunk_WP5M3D4N = require("../chunk-WP5M3D4N.js");
|
|
25
|
+
var import_chunk_PHX6STZ3 = require("../chunk-PHX6STZ3.js");
|
|
26
26
|
var import_chunk_ZUHJASAP = require("../chunk-ZUHJASAP.js");
|
|
27
27
|
var import_chunk_QOPTDDIH = require("../chunk-QOPTDDIH.js");
|
|
28
28
|
var import_chunk_BRPS327A = require("../chunk-BRPS327A.js");
|
|
@@ -18,14 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var MigrateReset_exports = {};
|
|
20
20
|
__export(MigrateReset_exports, {
|
|
21
|
-
MigrateReset: () =>
|
|
21
|
+
MigrateReset: () => import_chunk_L6GPGK4U.MigrateReset
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(MigrateReset_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_chunk_L6GPGK4U = require("../chunk-L6GPGK4U.js");
|
|
25
25
|
var import_chunk_KRQEFTDT = require("../chunk-KRQEFTDT.js");
|
|
26
26
|
var import_chunk_UP6FVCDK = require("../chunk-UP6FVCDK.js");
|
|
27
27
|
var import_chunk_2R6DII47 = require("../chunk-2R6DII47.js");
|
|
28
|
-
var
|
|
28
|
+
var import_chunk_PHX6STZ3 = require("../chunk-PHX6STZ3.js");
|
|
29
29
|
var import_chunk_ZUHJASAP = require("../chunk-ZUHJASAP.js");
|
|
30
30
|
var import_chunk_QOPTDDIH = require("../chunk-QOPTDDIH.js");
|
|
31
31
|
var import_chunk_BRPS327A = require("../chunk-BRPS327A.js");
|
package/dist/index.js
CHANGED
|
@@ -19,10 +19,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var index_exports = {};
|
|
20
20
|
__export(index_exports, {
|
|
21
21
|
DbCommand: () => import_chunk_2HCAA4GX.DbCommand,
|
|
22
|
-
DbDrop: () =>
|
|
22
|
+
DbDrop: () => import_chunk_UA3FFRRV.DbDrop,
|
|
23
23
|
DbExecute: () => import_chunk_QCPYZUFF.DbExecute,
|
|
24
24
|
DbPull: () => import_chunk_2UHNNEP4.DbPull,
|
|
25
|
-
DbPush: () =>
|
|
25
|
+
DbPush: () => import_chunk_WP5M3D4N.DbPush,
|
|
26
26
|
DbSeed: () => import_chunk_XTEEOIUV.DbSeed,
|
|
27
27
|
EngineResults: () => import_chunk_LVR7W5DD.EngineResults,
|
|
28
28
|
Migrate: () => import_chunk_RGXJYLMD.Migrate,
|
|
@@ -30,7 +30,7 @@ __export(index_exports, {
|
|
|
30
30
|
MigrateDeploy: () => import_chunk_TEUL2TU3.MigrateDeploy,
|
|
31
31
|
MigrateDev: () => import_chunk_6UO6YJTU.MigrateDev,
|
|
32
32
|
MigrateDiff: () => import_chunk_RM4WK3ML.MigrateDiff,
|
|
33
|
-
MigrateReset: () =>
|
|
33
|
+
MigrateReset: () => import_chunk_L6GPGK4U.MigrateReset,
|
|
34
34
|
MigrateResolve: () => import_chunk_AL3XYISJ.MigrateResolve,
|
|
35
35
|
MigrateStatus: () => import_chunk_TDN3QQTH.MigrateStatus,
|
|
36
36
|
SchemaEngineCLI: () => import_chunk_6DDIA3ZD.SchemaEngineCLI,
|
|
@@ -41,7 +41,7 @@ __export(index_exports, {
|
|
|
41
41
|
module.exports = __toCommonJS(index_exports);
|
|
42
42
|
var import_chunk_NHSJJSXU = require("./chunk-NHSJJSXU.js");
|
|
43
43
|
var import_chunk_LVR7W5DD = require("./chunk-LVR7W5DD.js");
|
|
44
|
-
var
|
|
44
|
+
var import_chunk_UA3FFRRV = require("./chunk-UA3FFRRV.js");
|
|
45
45
|
var import_chunk_IHDN3L3R = require("./chunk-IHDN3L3R.js");
|
|
46
46
|
var import_chunk_LZ2DWYUY = require("./chunk-LZ2DWYUY.js");
|
|
47
47
|
var import_chunk_FXSCTGN2 = require("./chunk-FXSCTGN2.js");
|
|
@@ -50,7 +50,7 @@ var import_chunk_6UO6YJTU = require("./chunk-6UO6YJTU.js");
|
|
|
50
50
|
var import_chunk_C3722PDA = require("./chunk-C3722PDA.js");
|
|
51
51
|
var import_chunk_7CQBDP4H = require("./chunk-7CQBDP4H.js");
|
|
52
52
|
var import_chunk_RM4WK3ML = require("./chunk-RM4WK3ML.js");
|
|
53
|
-
var
|
|
53
|
+
var import_chunk_L6GPGK4U = require("./chunk-L6GPGK4U.js");
|
|
54
54
|
var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
|
|
55
55
|
var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
|
|
56
56
|
var import_chunk_2R6DII47 = require("./chunk-2R6DII47.js");
|
|
@@ -66,8 +66,8 @@ var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
|
|
|
66
66
|
var import_chunk_JFKDSUIE = require("./chunk-JFKDSUIE.js");
|
|
67
67
|
var import_chunk_AHJ2N6BJ = require("./chunk-AHJ2N6BJ.js");
|
|
68
68
|
var import_chunk_LGYRZ6CV = require("./chunk-LGYRZ6CV.js");
|
|
69
|
-
var
|
|
70
|
-
var
|
|
69
|
+
var import_chunk_WP5M3D4N = require("./chunk-WP5M3D4N.js");
|
|
70
|
+
var import_chunk_PHX6STZ3 = require("./chunk-PHX6STZ3.js");
|
|
71
71
|
var import_chunk_ZUHJASAP = require("./chunk-ZUHJASAP.js");
|
|
72
72
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
73
73
|
var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/** Ambient state the agent detection chain reads. */
|
|
2
|
+
export interface AgentDetectionContext<E extends string = string, F extends string = string> {
|
|
3
|
+
readonly env: Readonly<Partial<Record<E, string>>>;
|
|
4
|
+
readonly fileExists: (path: F) => boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function aiAgentConfirmationCheckpoint(context?: AgentDetectionContext): void;
|
|
7
|
+
/**
|
|
8
|
+
* A single link in the agent detection chain. `envVars` and `files` list
|
|
9
|
+
* every environment variable and filesystem path `detect` inspects; the
|
|
10
|
+
* context `detect` receives is narrowed to exactly those names, so a matcher
|
|
11
|
+
* cannot read a marker it does not declare, and tests can neutralize
|
|
12
|
+
* inherited markers without maintaining separate lists.
|
|
13
|
+
*/
|
|
14
|
+
export interface AgentMatcher<E extends string = string, F extends string = string> {
|
|
15
|
+
readonly envVars: readonly E[];
|
|
16
|
+
readonly files: readonly F[];
|
|
17
|
+
readonly detect: (context: AgentDetectionContext<E, F>) => string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare const agentMatchers: readonly AgentMatcher[];
|
package/dist/utils/ai-safety.js
CHANGED
|
@@ -18,8 +18,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var ai_safety_exports = {};
|
|
20
20
|
__export(ai_safety_exports, {
|
|
21
|
-
|
|
21
|
+
agentMatchers: () => import_chunk_PHX6STZ3.agentMatchers,
|
|
22
|
+
aiAgentConfirmationCheckpoint: () => import_chunk_PHX6STZ3.aiAgentConfirmationCheckpoint
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(ai_safety_exports);
|
|
24
|
-
var
|
|
25
|
+
var import_chunk_PHX6STZ3 = require("../chunk-PHX6STZ3.js");
|
|
25
26
|
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
|
|
@@ -32,12 +32,12 @@ __export(setupCockroach_exports, {
|
|
|
32
32
|
tearDownCockroach: () => tearDownCockroach
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(setupCockroach_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_5JVYZEWJ = require("../chunk-5JVYZEWJ.js");
|
|
36
36
|
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
|
|
37
37
|
var import_internals = require("@prisma/internals");
|
|
38
38
|
var import_fs = __toESM(require("fs"));
|
|
39
39
|
var import_path = __toESM(require("path"));
|
|
40
|
-
var import_pg = (0, import_chunk_2ESYSVXG.__toESM)((0,
|
|
40
|
+
var import_pg = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_5JVYZEWJ.require_lib)());
|
|
41
41
|
async function setupCockroach(options) {
|
|
42
42
|
const { connectionString } = options;
|
|
43
43
|
const { dirname } = options;
|
|
@@ -33,12 +33,12 @@ __export(setupPostgres_exports, {
|
|
|
33
33
|
tearDownPostgres: () => tearDownPostgres
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(setupPostgres_exports);
|
|
36
|
-
var
|
|
36
|
+
var import_chunk_5JVYZEWJ = require("../chunk-5JVYZEWJ.js");
|
|
37
37
|
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
|
|
38
38
|
var import_promises = __toESM(require("node:fs/promises"));
|
|
39
39
|
var import_node_path = __toESM(require("node:path"));
|
|
40
40
|
var import_internals = require("@prisma/internals");
|
|
41
|
-
var import_pg = (0, import_chunk_2ESYSVXG.__toESM)((0,
|
|
41
|
+
var import_pg = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_5JVYZEWJ.require_lib)());
|
|
42
42
|
async function setupPostgres(options) {
|
|
43
43
|
const { connectionString } = options;
|
|
44
44
|
const { dirname } = options;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/migrate",
|
|
3
|
-
"version": "7.9.0-dev.
|
|
3
|
+
"version": "7.9.0-dev.20",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/migrate/src/index.d.ts",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"tempy": "1.0.1",
|
|
45
45
|
"ts-pattern": "5.6.2",
|
|
46
46
|
"typescript": "5.4.5",
|
|
47
|
-
"@prisma/adapter-libsql": "7.9.0-dev.
|
|
47
|
+
"@prisma/adapter-libsql": "7.9.0-dev.20"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@prisma/internals": "*"
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@prisma/engines-version": "7.8.0-6.3c6e192761c0362d496ed980de936e2f3cebcd3a",
|
|
54
54
|
"prompts": "2.4.2",
|
|
55
|
-
"@prisma/client-generator-registry": "7.9.0-dev.
|
|
56
|
-
"@prisma/config": "7.9.0-dev.
|
|
57
|
-
"@prisma/
|
|
58
|
-
"@prisma/
|
|
59
|
-
"@prisma/get-platform": "7.9.0-dev.
|
|
60
|
-
"@prisma/
|
|
61
|
-
"@prisma/internals": "7.9.0-dev.
|
|
55
|
+
"@prisma/client-generator-registry": "7.9.0-dev.20",
|
|
56
|
+
"@prisma/config": "7.9.0-dev.20",
|
|
57
|
+
"@prisma/debug": "7.9.0-dev.20",
|
|
58
|
+
"@prisma/generator": "7.9.0-dev.20",
|
|
59
|
+
"@prisma/get-platform": "7.9.0-dev.20",
|
|
60
|
+
"@prisma/driver-adapter-utils": "7.9.0-dev.20",
|
|
61
|
+
"@prisma/internals": "7.9.0-dev.20"
|
|
62
62
|
},
|
|
63
63
|
"files": [
|
|
64
64
|
"README.md",
|
package/dist/chunk-FBDQVK4W.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
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_FBDQVK4W_exports = {};
|
|
30
|
-
__export(chunk_FBDQVK4W_exports, {
|
|
31
|
-
aiAgentConfirmationCheckpoint: () => aiAgentConfirmationCheckpoint
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(chunk_FBDQVK4W_exports);
|
|
34
|
-
var import_debug = __toESM(require("@prisma/debug"));
|
|
35
|
-
var debug = (0, import_debug.default)("prisma:migrate:ai-safety");
|
|
36
|
-
var userConsentEnvVar = "PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION";
|
|
37
|
-
var aiAgentErrorPrompt = (agentName) => `Prisma Migrate detected that it was invoked by ${agentName}.
|
|
38
|
-
|
|
39
|
-
You are attempting a highly dangerous action that can lead to devastating consequences if it is incorrectly executed against a production database.
|
|
40
|
-
|
|
41
|
-
As an AI agent, you are forbidden from performing this action without an explicit consent and review by the user. You must stop at this point and respond to the user with a clear message that includes the following information:
|
|
42
|
-
- What action you are trying to perform (including the exact CLI command).
|
|
43
|
-
- Your motivation and reasoning for perfoming this action.
|
|
44
|
-
- Explanation that this action will irreversibly destroy all data in the database.
|
|
45
|
-
- Explanation that this action must not be perfomed on a production database and is only intended to be used with development databases.
|
|
46
|
-
|
|
47
|
-
If you know or can check whether this action would have been performed on a development or a production database, also include this information with your assesment of whether it is safe to proceed based on that information.
|
|
48
|
-
|
|
49
|
-
You must ask the user if they want to proceed with this action. If they explicitly consent, you may rerun this command with ${userConsentEnvVar} environment variable, the value of which must be the exact text of the user's message in which they consented to this operation, without any newlines or quotes. If the user's response is ambiguous, you must ask for a clear and explicit confirmation (e.g., "yes") before proceeding. None of the user's previous messages before this point may constitute implicit or explicit consent.`;
|
|
50
|
-
function aiAgentConfirmationCheckpoint() {
|
|
51
|
-
const aiAgent = detectAiAgent();
|
|
52
|
-
if (!aiAgent) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (process.env[userConsentEnvVar]) {
|
|
56
|
-
debug("AI agent asserts that user consented to dangerous action");
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
throw new Error(aiAgentErrorPrompt(aiAgent));
|
|
60
|
-
}
|
|
61
|
-
function detectAiAgent() {
|
|
62
|
-
const agentMarkers = {
|
|
63
|
-
"Claude Code": process.env.CLAUDECODE,
|
|
64
|
-
"Gemini CLI or Qwen Code": process.env.GEMINI_CLI,
|
|
65
|
-
Cursor: process.env.CURSOR_AGENT,
|
|
66
|
-
Aider: process.env.OR_APP_NAME === "Aider",
|
|
67
|
-
Replit: process.env.REPLIT_CLI,
|
|
68
|
-
"Codex CLI": process.env.CODEX_SANDBOX === "seatbelt"
|
|
69
|
-
};
|
|
70
|
-
for (const [agentName, marker] of Object.entries(agentMarkers)) {
|
|
71
|
-
if (marker) {
|
|
72
|
-
debug("Detected %s", agentName);
|
|
73
|
-
return agentName;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return void 0;
|
|
77
|
-
}
|