Fix DB Model.

This commit is contained in:
2025-07-09 18:21:23 +02:00
parent 092a8b7084
commit 2d18849267
4 changed files with 29 additions and 6 deletions

View File

@@ -0,0 +1,20 @@
-- Add time formatting and rounding preferences to user_preferences table
-- These columns support user-specific time display and rounding settings
-- Add time formatting preference (24h vs 12h)
ALTER TABLE user_preferences
ADD COLUMN IF NOT EXISTS time_format_24h BOOLEAN DEFAULT TRUE;
-- Add time rounding preference (0, 5, 10, 15, 30, 60 minutes)
ALTER TABLE user_preferences
ADD COLUMN IF NOT EXISTS time_rounding_minutes INTEGER DEFAULT 0;
-- Add rounding direction preference (false=round down, true=round to nearest)
ALTER TABLE user_preferences
ADD COLUMN IF NOT EXISTS round_to_nearest BOOLEAN DEFAULT FALSE;
-- Update existing date_format column default if needed
-- (The column should already exist, but let's ensure the default is correct)
UPDATE user_preferences
SET date_format = 'ISO'
WHERE date_format = 'YYYY-MM-DD' OR date_format IS NULL;

View File

@@ -1,7 +1,8 @@
-- Remove all email preference columns from user_preferences table
-- These columns were not being used and are being removed to clean up the schema
-- Remove unused columns from user_preferences table
-- These columns were defined in the model but never used in the application
ALTER TABLE user_preferences
DROP COLUMN IF EXISTS email_daily_summary,
DROP COLUMN IF EXISTS email_notifications,
DROP COLUMN IF EXISTS email_weekly_summary;
DROP COLUMN IF EXISTS email_weekly_summary,
DROP COLUMN IF EXISTS default_project_id;

View File

@@ -19,6 +19,7 @@ POSTGRES_MIGRATIONS = [
'postgres_only_migration.py', # Main migration from commit 4214e88 onward
'add_note_sharing.sql', # Add note sharing functionality
'remove_email_preferences.sql', # Remove unused email preference columns
'add_time_preferences.sql', # Add time formatting and rounding preferences
]