-- Add the published column to the blog_posts table if it doesn't exist DO $$ BEGIN IF NOT EXISTS ( SELECT FROM information_schema.columns WHERE table_name = 'blog_posts' AND column_name = 'published' ) THEN ALTER TABLE blog_posts ADD COLUMN published BOOLEAN DEFAULT false; -- Update existing posts to be published by default UPDATE blog_posts SET published = true; RAISE NOTICE 'Added published column to blog_posts table'; ELSE RAISE NOTICE 'Column published already exists in blog_posts table'; END IF; END $$; -- Refresh the PostgREST schema cache (this may require admin privileges) NOTIFY pgrst, 'reload schema'; -- Verify the column was added SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'blog_posts' AND column_name = 'published';