Files
Compass/backend/supabase/love_questions.sql
2025-09-13 13:14:56 +02:00

22 lines
699 B
SQL

CREATE TABLE IF NOT EXISTS love_questions (
answer_type TEXT DEFAULT 'free_response' NOT NULL,
created_time TIMESTAMPTZ DEFAULT now() NOT NULL,
creator_id TEXT NOT NULL,
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
importance_score NUMERIC DEFAULT 0 NOT NULL,
multiple_choice_options JSONB,
question TEXT NOT NULL
);
-- Row Level Security
ALTER TABLE love_questions ENABLE ROW LEVEL SECURITY;
-- Policies
DROP POLICY IF EXISTS "public read" ON love_questions;
CREATE POLICY "public read" ON love_questions
FOR ALL USING (true);
-- Indexes
-- The primary key automatically creates a unique index on (id),
-- so the explicit index on id is redundant and removed.