persona-community-5/services/persona-api/cmd/server/migrations/004_create_personas.sql
rdev-worker 9c009926d1
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature persona-model --requirements 'DB migration in pers...
2026-02-24 07:58:27 +00:00

24 lines
934 B
SQL

-- 004_create_personas.sql
-- Persona table for AI-generated personas with multi-stage generation pipeline.
-- Compatible with both PostgreSQL (local dev) and CockroachDB (production).
CREATE TABLE IF NOT EXISTS personas (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL,
handle TEXT UNIQUE NOT NULL,
gender TEXT NOT NULL,
description TEXT NOT NULL,
tags TEXT[] NOT NULL DEFAULT ARRAY[]::TEXT[],
spec_json JSONB,
anchor_url TEXT,
avatar_url TEXT,
banner_url TEXT,
image_urls TEXT[] NOT NULL DEFAULT ARRAY[]::TEXT[],
video_urls TEXT[] NOT NULL DEFAULT ARRAY[]::TEXT[],
status TEXT NOT NULL DEFAULT 'pending',
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_personas_status ON personas (status, created_at DESC);
CREATE INDEX IF NOT EXISTS idx_personas_handle ON personas (handle);