Files
soroban-abacus-flashcards/apps/web/drizzle/0001_friendly_stingray.sql
Thomas Hallock 92ef1360a4 feat: migrate abacus display settings to database
- Add abacus_settings table with all display configuration fields
- Create API routes (GET/PATCH) for abacus settings
- Add React Query hooks with optimistic updates
- Create AbacusSettingsSync component to bridge localStorage and API
- Settings now persist server-side per guest/user session
- Maintains backward compatibility with existing localStorage pattern

Migration includes:
- Database schema for 12 abacus display settings
- Automatic migration generation and application
- API-driven persistence with guest session support
- Sync component loads from API on mount and saves changes automatically

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 19:34:33 -05:00

17 lines
732 B
SQL

CREATE TABLE `abacus_settings` (
`user_id` text PRIMARY KEY NOT NULL,
`color_scheme` text DEFAULT 'place-value' NOT NULL,
`bead_shape` text DEFAULT 'diamond' NOT NULL,
`color_palette` text DEFAULT 'default' NOT NULL,
`hide_inactive_beads` integer DEFAULT false NOT NULL,
`colored_numerals` integer DEFAULT false NOT NULL,
`scale_factor` real DEFAULT 1 NOT NULL,
`show_numbers` integer DEFAULT true NOT NULL,
`animated` integer DEFAULT true NOT NULL,
`interactive` integer DEFAULT false NOT NULL,
`gestures` integer DEFAULT false NOT NULL,
`sound_enabled` integer DEFAULT true NOT NULL,
`sound_volume` real DEFAULT 0.8 NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
);