Files
momentry_core/migrations/011_create_talents.sql
Warren b54c2def30 feat: add migrations, test scripts, and utility tools
- Add database migrations (006-028) for face recognition, identity, file_uuid
- Add test scripts for ASR, face, search, processing
- Add portal frontend (Tauri)
- Add config, benchmark, and monitoring utilities
- Add model checkpoints and pretrained model references
2026-04-30 15:11:53 +08:00

31 lines
1.4 KiB
SQL

-- Migration 011: Create talents table
-- Stores global talent profiles (Actors, Real-world identities).
-- Create extension for vector if not exists (usually in 009 or similar)
CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE IF NOT EXISTS talents (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL UNIQUE,
embedding VECTOR(768), -- Face feature vector
metadata JSONB DEFAULT '{}',
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
-- Ensure identity_bindings references talents if needed
-- Current structure is generic: talent_id (bigint), identity_id (integer - likely person_id?), etc.
-- We will use talent_id to store the ID of the talent, and identity_id to store the ID of the person in person_identities (or we use uuid/identity_value).
-- Let's check current identity_bindings usage.
-- The columns are: talent_id, identity_id, uuid, identity_type, identity_value, binding_type, binding_value.
-- We will use:
-- talent_id: ID from talents table.
-- identity_id: ID of the row in person_identities (if we can map it) OR we rely on identity_value = person_id.
-- identity_type: 'person_id'
-- identity_value: 'Person_0'
-- binding_type: 'named'
-- Add index for faster lookups
CREATE INDEX IF NOT EXISTS idx_identity_bindings_talent_id ON identity_bindings(talent_id);
CREATE INDEX IF NOT EXISTS idx_identity_bindings_identity ON identity_bindings(identity_type, identity_value);