compassmock/drizzle/0016_noisy_gorilla_man.sql
Nicholai b5211d181d
feat(theme): visual theme system with presets and AI tools (#51)
* feat(theme): visual theme system with presets, custom themes, and AI tools

Runtime theming engine with 10 preset palettes, user custom themes
persisted to D1, animated circle-reveal transitions via View Transition
API, and AI agent tools for generating/editing themes incrementally.

- Theme library: types, presets, CSS injection, font loading, animation
- Theme provider with localStorage cache for instant load (no FOUC)
- Server actions for theme CRUD and user preference persistence
- Agent tools: listThemes, setTheme, generateTheme, editTheme
- Appearance tab extracted from settings modal
- Migration 0015: custom_themes + user_theme_preference tables
- Developer documentation in docs/theme-system.md

* fix(db): make migration 0016 idempotent

tables were already created as 0015 before renumber.
use IF NOT EXISTS so the migration is safe to re-run.

---------

Co-authored-by: Nicholai <nicholaivogelfilms@gmail.com>
2026-02-06 22:32:21 -07:00

18 lines
616 B
SQL
Executable File

CREATE TABLE IF NOT EXISTS `custom_themes` (
`id` text PRIMARY KEY NOT NULL,
`user_id` text NOT NULL,
`name` text NOT NULL,
`description` text DEFAULT '' NOT NULL,
`theme_data` text NOT NULL,
`created_at` text NOT NULL,
`updated_at` text NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS `user_theme_preference` (
`user_id` text PRIMARY KEY NOT NULL,
`active_theme_id` text NOT NULL,
`updated_at` text NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
);