Add sql
This commit is contained in:
parent
5dca273fd6
commit
fc173694fc
1 changed files with 16 additions and 0 deletions
16
sql/07_create_feedback_table.sql
Normal file
16
sql/07_create_feedback_table.sql
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
-- 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 );
|
||||
Loading…
Reference in a new issue