Files
SkyArtShop/backend/migrations/005-add-pagedata-column.sql
Local Server dc58a8ae5f webupdate1
2026-01-04 18:09:47 -06:00

31 lines
1.2 KiB
SQL

-- Add structured fields to pages table for contact information
-- This allows each section to be edited independently without breaking layout
-- This is valid PostgreSQL syntax (JSONB type and IF NOT EXISTS are PostgreSQL features)
ALTER TABLE pages ADD COLUMN IF NOT EXISTS pagedata JSONB DEFAULT '{}'::jsonb;
COMMENT ON COLUMN pages.pagedata IS 'Structured data for pages that need separate editable fields (e.g., contact info)';
-- Update contact page with structured data
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';
-- Verify the update
SELECT slug, pagedata FROM pages WHERE slug = 'contact';