You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ai_synth/backend/migrations/20260321000009_create_synth...

13 lines
513 B
SQL

-- Create the syntheses table for storing generated news syntheses.
CREATE TABLE syntheses (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
week VARCHAR(10) NOT NULL,
sections JSONB NOT NULL DEFAULT '[]'::jsonb,
status VARCHAR(20) NOT NULL DEFAULT 'completed',
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX idx_syntheses_user_id_created_at ON syntheses(user_id, created_at DESC);