Sindbad~EG File Manager
const router = require("express").Router();
const {
createNewMigration,
runMigrations,
undoLastMigration,
undoAllMigrations,
} = require("../run-migrations");
router.post("/create-migration", async (req, res) => {
try {
createNewMigration(req.body.migrationName);
return res.send("New Migration Is Creating!");
} catch (error) {
return res.json({ errorMessage: error.message });
}
});
router.get("/run-migrations", async (req, res) => {
try {
runMigrations();
return res.send("Migrations Are Running!");
} catch (error) {
return res.json({ errorMessage: error.message });
}
});
router.get("/undo-last-migration", async (req, res) => {
try {
undoLastMigration();
return res.send("Undo Migrations Are Running");
} catch (error) {
return res.json({ errorMessage: error.message });
}
});
router.get("/undo-all-migration", async (req, res) => {
try {
undoAllMigrations();
return res.send("Undo All Migrations Are Running");
} catch (error) {
return res.json({ errorMessage: error.message });
}
});
module.exports = router;
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists