feat: identity PATCH update, alias system, name UNIQUE removal
- Add PATCH /api/v1/identity/:identity_uuid endpoint - Migration 030: remove name UNIQUE, add tmdb_id index - TMDb upsert: ON CONFLICT (name) -> ON CONFLICT (tmdb_id) - get_or_create_identity: pre-check by name - upload_identity: ON CONFLICT (name) -> ON CONFLICT (uuid) - Search: include aliases in identity text search - Add scripts/llm_metadata_enhancer.py - Add DESIGN/IdentityUpdateAndAliasSystem.md
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
-- Migration 030: Remove name UNIQUE constraint from identities table
|
||||
-- Rationale: uuid is the true identity key; name is a display label that can repeat.
|
||||
-- TMDb-sourced identities use tmdb_id as their unique key.
|
||||
|
||||
BEGIN;
|
||||
|
||||
-- Phase 1: Remove name UNIQUE (keep NOT NULL — every identity must have a name)
|
||||
ALTER TABLE identities DROP CONSTRAINT IF EXISTS identities_name_key;
|
||||
|
||||
-- Phase 2: Add updated_at column for tracking modifications
|
||||
ALTER TABLE identities ADD COLUMN IF NOT EXISTS updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW();
|
||||
|
||||
-- Phase 3: Partial unique index for TMDb-sourced identities
|
||||
-- Only applies to rows with a non-null tmdb_id.
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_identities_tmdb_id
|
||||
ON identities(tmdb_id) WHERE tmdb_id IS NOT NULL;
|
||||
|
||||
COMMIT;
|
||||
Reference in New Issue
Block a user