updateweb

This commit is contained in:
Local Server
2026-01-01 22:24:30 -06:00
parent 017c6376fc
commit 1919f6f8bb
185 changed files with 19860 additions and 17603 deletions

View File

@@ -0,0 +1,43 @@
const db = require("./config/database");
async function updatePageIdsToReadable() {
try {
console.log("Updating page IDs to readable format...\n");
// Get all pages
const pages = await db.query("SELECT id, slug FROM pages");
for (const page of pages.rows) {
const newId = `page-${page.slug}`;
if (page.id !== newId) {
console.log(`Updating: ${page.slug}`);
console.log(` Old ID: ${page.id}`);
console.log(` New ID: ${newId}`);
await db.query("UPDATE pages SET id = $1 WHERE slug = $2", [
newId,
page.slug,
]);
}
}
console.log("\n✅ All page IDs updated to readable format!");
console.log("\nVerifying updates...");
const updated = await db.query(
"SELECT id, slug, title FROM pages ORDER BY slug"
);
console.log("\nCurrent page IDs:");
updated.rows.forEach((p) => {
console.log(` ${p.id.padEnd(25)}${p.title}`);
});
process.exit(0);
} catch (error) {
console.error("Error updating page IDs:", error);
process.exit(1);
}
}
updatePageIdsToReadable();