summaryrefslogtreecommitdiff
path: root/backend/scripts/patch-medusa.js
diff options
context:
space:
mode:
Diffstat (limited to 'backend/scripts/patch-medusa.js')
-rw-r--r--backend/scripts/patch-medusa.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/backend/scripts/patch-medusa.js b/backend/scripts/patch-medusa.js
new file mode 100644
index 0000000..9d95d9a
--- /dev/null
+++ b/backend/scripts/patch-medusa.js
@@ -0,0 +1,34 @@
+const fs = require("fs");
+const path = require("path");
+
+const targetPath = path.join(
+ __dirname,
+ "..",
+ "node_modules",
+ "@medusajs",
+ "medusa",
+ "dist",
+ "services",
+ "payment-provider.js"
+);
+
+if (!fs.existsSync(targetPath)) {
+ console.error("patch-medusa: cible introuvable:", targetPath);
+ process.exit(1);
+}
+
+const original = fs.readFileSync(targetPath, "utf8");
+const before = "model.update({}, { is_installed: false })";
+const after =
+ "model.createQueryBuilder().update().set({ is_installed: false }).where('1=1').execute()";
+
+if (!original.includes(before)) {
+ console.error(
+ "patch-medusa: motif introuvable, le patch n'a pas ete applique."
+ );
+ process.exit(1);
+}
+
+const patched = original.replace(before, after);
+fs.writeFileSync(targetPath, patched, "utf8");
+console.log("patch-medusa: update vide remplace avec succes.");