-- Create devlog_entries table CREATE TABLE devlog_entries ( id SERIAL PRIMARY KEY, date TEXT NOT NULL, title TEXT NOT NULL, description TEXT, slug TEXT UNIQUE NOT NULL, image TEXT, content JSONB DEFAULT '[]'::jsonb, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() ); -- Enable Row Level Security ALTER TABLE devlog_entries ENABLE ROW LEVEL SECURITY; -- Create policies for public read access CREATE POLICY "Allow public read access" ON devlog_entries FOR SELECT USING (true); -- Create policies for authenticated users to insert/update CREATE POLICY "Allow authenticated insert" ON devlog_entries FOR INSERT WITH CHECK (true); CREATE POLICY "Allow authenticated update" ON devlog_entries FOR UPDATE USING (true); CREATE POLICY "Allow authenticated delete" ON devlog_entries FOR DELETE USING (true); -- Grant permissions to anon and authenticated roles GRANT SELECT ON devlog_entries TO anon; GRANT ALL PRIVILEGES ON devlog_entries TO authenticated; GRANT USAGE, SELECT ON SEQUENCE devlog_entries_id_seq TO authenticated;