xtablo-source/sql/07_create_feedback_table.sql
Arthur Belleville fc173694fc
Add sql
2025-06-28 14:50:19 +02:00

16 lines
No EOL
550 B
SQL

-- Create feedback table
CREATE TABLE IF NOT EXISTS feedbacks (
id SERIAL PRIMARY KEY,
fd_type VARCHAR(20) NOT NULL CHECK (fd_type IN ('bug', 'feature', 'improvement', 'other')),
user_id UUID NOT NULL,
message TEXT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
-- Enable Row Level Security
ALTER TABLE feedbacks ENABLE ROW LEVEL SECURITY;
create policy "Users can insert feedback."
on feedbacks for insert
to authenticated
with check ( (select auth.uid()) = user_id );