feat: add database support for multiple user ebook folders

- Add ebook_folder_path column to users table (migration 004)
- Create user_ebook_folders table for multiple folders per user (migration 005)
- Remove old ebook_folder_path column from users table (migration 006)
- Add unique constraint to prevent duplicate folder paths per user
This commit is contained in:
2026-01-23 09:02:35 -05:00
parent 3d325c71a2
commit b5ec84c901
3 changed files with 15 additions and 0 deletions
@@ -0,0 +1,2 @@
-- Add ebook_folder_path to users table
ALTER TABLE users ADD COLUMN ebook_folder_path VARCHAR(500);
@@ -0,0 +1,11 @@
-- Create user_ebook_folders table for multiple folders per user
CREATE TABLE user_ebook_folders (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
folder_path VARCHAR(500) NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
UNIQUE(user_id, folder_path)
);
-- Create index for faster lookups
CREATE INDEX idx_user_ebook_folders_user_id ON user_ebook_folders(user_id);
@@ -0,0 +1,2 @@
-- Drop the old ebook_folder_path column from users table
ALTER TABLE users DROP COLUMN IF EXISTS ebook_folder_path;