updateweb
This commit is contained in:
44
backend/add-pagedata-column.js
Normal file
44
backend/add-pagedata-column.js
Normal file
@@ -0,0 +1,44 @@
|
||||
const db = require("./config/database");
|
||||
|
||||
async function addPageDataColumn() {
|
||||
try {
|
||||
// Update contact page with structured data (column already added manually)
|
||||
console.log("Updating contact page with structured data...");
|
||||
const result = await db.query(`
|
||||
UPDATE pages
|
||||
SET pagedata = jsonb_build_object(
|
||||
'contactInfo', jsonb_build_object(
|
||||
'phone', '+1 (555) 123-4567',
|
||||
'email', 'contact@skyartshop.com',
|
||||
'address', '123 Art Street, Creative City, CC 12345'
|
||||
),
|
||||
'businessHours', jsonb_build_array(
|
||||
jsonb_build_object('days', 'Monday - Friday', 'hours', '9:00 AM - 6:00 PM'),
|
||||
jsonb_build_object('days', 'Saturday', 'hours', '10:00 AM - 4:00 PM'),
|
||||
jsonb_build_object('days', 'Sunday', 'hours', 'Closed')
|
||||
),
|
||||
'header', jsonb_build_object(
|
||||
'title', 'Our Contact Information',
|
||||
'subtitle', 'Reach out to us through any of these channels'
|
||||
)
|
||||
)
|
||||
WHERE slug = 'contact'
|
||||
RETURNING id, title, pagedata
|
||||
`);
|
||||
|
||||
if (result.rows.length > 0) {
|
||||
console.log("✓ Contact page updated with structured data");
|
||||
console.log(
|
||||
"\nStructured data:",
|
||||
JSON.stringify(result.rows[0].pagedata, null, 2)
|
||||
);
|
||||
}
|
||||
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error("Error:", error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
addPageDataColumn();
|
||||
Reference in New Issue
Block a user