Files
soroban-abacus-flashcards/apps/web/drizzle/0022_nappy_titanium_man.sql
Thomas Hallock 906fa63f24 feat: add database schema for custom skills and skill customizations
Database changes:
- Add custom_skills table for user-created skills
- Add skill_customizations table for modified default skills
- Both tables support per-user, per-operator configurations
- Include digit range, regrouping config, and display rules

Schema includes:
- Foreign keys to users table with cascade delete
- Composite primary key for skill_customizations
- Index on (user_id, operator) for efficient queries

This enables:
- Teachers to create custom skills for mastery progression
- Teachers to customize default skill configurations
- Per-user skill configurations (don't affect other users)
- Full reversi bility (reset to defaults)

Next steps: API endpoints, SkillConfigurationModal UI

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 13:30:36 -06:00

32 lines
1.1 KiB
SQL

-- Custom SQL migration file, put your code below! --
-- Table for fully user-created custom skills
CREATE TABLE `custom_skills` (
`id` text PRIMARY KEY NOT NULL,
`user_id` text NOT NULL,
`operator` text NOT NULL,
`name` text NOT NULL,
`description` text,
`digit_range` text NOT NULL,
`regrouping_config` text NOT NULL,
`display_rules` 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 INDEX `idx_custom_skills_user_operator` ON `custom_skills` (`user_id`, `operator`);
--> statement-breakpoint
-- Table for customizations of default skills
CREATE TABLE `skill_customizations` (
`user_id` text NOT NULL,
`skill_id` text NOT NULL,
`operator` text NOT NULL,
`digit_range` text NOT NULL,
`regrouping_config` text NOT NULL,
`display_rules` text NOT NULL,
`updated_at` text NOT NULL,
PRIMARY KEY (`user_id`, `skill_id`, `operator`),
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
);