// DBDiagram.io schema for Memoro Storyteller Table characters { id uuid [pk] user_id text [not null, note: 'Supabase auth.uid()'] name varchar [not null] user_description text [note: 'Raw user input (e.g., "schwurti das fette schwein")'] character_description text [not null, note: 'AI-enhanced detailed description for consistent story illustrations'] character_description_prompt text [not null] image_url text [not null] source_image_url text is_animal boolean [default: false] animal_type varchar [default: 'unspecified animal', note: 'Detected from user_description'] created_at timestamptz [not null, default: 'NOW()'] updated_at timestamptz [not null, default: 'NOW()'] images_data jsonb [note: 'Array of character images directly stored as JSON'] indexes { (user_id, id) [unique] } } // Note: character_images data now stored directly in characters table as JSONB field // This table is removed in favor of JSONB storage Table stories { id uuid [pk] user_id text [not null, note: 'Supabase auth.uid()'] title varchar story_prompt text [not null] story_text text is_animal_story boolean [default: false] animal_type varchar [default: 'unspecified animal'] character_id uuid [ref: > characters.id] character_name varchar created_at timestamptz [not null, default: 'NOW()'] updated_at timestamptz [not null, default: 'NOW()'] used_settings jsonb characters_data jsonb [note: 'Array of story characters directly stored as JSON'] pages_data jsonb [note: 'Array of story pages directly stored as JSON'] indexes { (user_id, id) [unique] } } // Note: story_pages and story_characters data now stored directly in stories table as JSONB fields // These tables are removed in favor of JSONB storage Table creators { id uuid [pk] creator_id varchar [unique, not null] name varchar [not null] type varchar [not null, note: 'illustrator or author'] system_prompt text [not null] description text [not null] profile_picture text extra_prompt_beginning text extra_prompt_end text created_at timestamptz [not null, default: 'NOW()'] updated_at timestamptz [not null, default: 'NOW()'] } Table errors { id uuid [pk] user_id text [not null, note: 'Supabase auth.uid()'] story_id uuid [ref: > stories.id] character_id uuid [ref: > characters.id] error_type varchar [not null] error_details jsonb [not null] created_at timestamptz [not null, default: 'NOW()'] }