16 lines
No EOL
550 B
SQL
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 ); |