managarten/maerchenzauber/apps/backend/migrations/005_add_blurhash_to_images.sql
Till-JS e7f5f942f3 chore: initial commit - consolidate 4 projects into monorepo
Projects included:
- maerchenzauber (NestJS backend + Expo mobile + SvelteKit web + Astro landing)
- manacore (Expo mobile + SvelteKit web + Astro landing)
- manadeck (NestJS backend + Expo mobile + SvelteKit web)
- memoro (Expo mobile + SvelteKit web + Astro landing)

This commit preserves the current state before monorepo restructuring.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:38:24 +01:00

22 lines
1 KiB
SQL

-- Add blurhash field to stories pages for smooth image loading
-- BlurHash allows instant placeholder rendering while images load
-- Add blur_hash column to stories table (for cover images)
ALTER TABLE stories
ADD COLUMN IF NOT EXISTS blur_hash TEXT;
-- Add blur_hash to each page in the pages JSONB array
-- We'll store it alongside the image URL for each page
-- Example page structure: { "image": "url", "blur_hash": "LEHV6nWB...", "text": "..." }
-- Add blur_hash column to characters table
ALTER TABLE characters
ADD COLUMN IF NOT EXISTS blur_hash TEXT;
-- Create index for faster queries when blur_hash is needed
CREATE INDEX IF NOT EXISTS idx_stories_blurhash ON stories(blur_hash) WHERE blur_hash IS NOT NULL;
CREATE INDEX IF NOT EXISTS idx_characters_blurhash ON characters(blur_hash) WHERE blur_hash IS NOT NULL;
-- Add comment for documentation
COMMENT ON COLUMN stories.blur_hash IS 'BlurHash string for cover image placeholder (first page)';
COMMENT ON COLUMN characters.blur_hash IS 'BlurHash string for character image placeholder';