commit 1eeea9f83ad9230a5c1f7a75662770eaab0df837 Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 21:15:41 2025 +0200 Disable resuming of old time entries. commit 3e3ec2f01cb7943622b819a19179388078ae1315 Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 20:59:19 2025 +0200 Refactor db migrations. commit 15a51a569da36c6b7c9e01ab17b6fdbdee6ad994 Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 19:58:04 2025 +0200 Apply new style for Time Tracking view. commit 77e5278b303e060d2b03853b06277f8aa567ae68 Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 18:06:04 2025 +0200 Allow direct registrations as a Company. commit 188a8772757cbef374243d3a5f29e4440ddecabe Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 18:04:45 2025 +0200 Add email invitation feature. commit d9ebaa02aa01b518960a20dccdd5a327d82f30c6 Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 17:12:32 2025 +0200 Apply common style for Company, User, Team management pages. commit 81149caf4d8fc6317e2ab1b4f022b32fc5aa6d22 Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 16:44:32 2025 +0200 Move export functions to own module. commit 1a26e19338e73f8849c671471dd15cc3c1b1fe82 Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 15:51:15 2025 +0200 Split up models.py. commit 61f1ccd10f721b0ff4dc1eccf30c7a1ee13f204d Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 12:05:28 2025 +0200 Move utility function into own modules. commit 84b341ed35e2c5387819a8b9f9d41eca900ae79f Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 11:44:24 2025 +0200 Refactor auth functions use. commit 923e311e3da5b26d85845c2832b73b7b17c48adb Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 11:35:52 2025 +0200 Refactor route nameing and fix bugs along the way. commit f0a5c4419c340e62a2615c60b2a9de28204d2995 Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 10:34:33 2025 +0200 Fix URL endpoints in announcement template. commit b74d74542a1c8dc350749e4788a9464d067a88b5 Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 09:25:53 2025 +0200 Move announcements to own module. commit 9563a28021ac46c82c04fe4649b394dbf96f92c7 Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 09:16:30 2025 +0200 Combine Company view and edit templates. commit 6687c373e681d54e4deab6b2582fed5cea9aadf6 Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 08:17:42 2025 +0200 Move Users, Company and System Administration to own modules. commit 8b7894a2e3eb84bb059f546648b6b9536fea724e Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 07:40:57 2025 +0200 Move Teams and Projects to own modules. commit d11bf059d99839ecf1f5d7020b8c8c8a2454c00b Author: Jens Luedicke <jens@luedicke.me> Date: Mon Jul 7 07:09:33 2025 +0200 Move Tasks and Sprints to own modules.
6.6 KiB
6.6 KiB
Database Schema Changes Summary
This document summarizes all database schema changes between commit 4214e88 and the current state of the TimeTrack application.
Architecture Changes
1. Model Structure Refactoring
- Before: Single monolithic
models.pyfile containing all models - After: Models split into domain-specific modules:
models/__init__.py- Package initializationmodels/base.py- Base model definitionsmodels/company.py- Company-related modelsmodels/user.py- User-related modelsmodels/project.py- Project-related modelsmodels/task.py- Task-related modelsmodels/time_entry.py- Time entry modelmodels/sprint.py- Sprint modelmodels/team.py- Team modelmodels/system.py- System settings modelsmodels/announcement.py- Announcement modelmodels/dashboard.py- Dashboard-related modelsmodels/work_config.py- Work configuration modelmodels/invitation.py- Company invitation modelmodels/enums.py- All enum definitions
New Tables Added
1. company_invitation (NEW)
- Purpose: Email-based company registration invitations
- Columns:
id(INTEGER, PRIMARY KEY)company_id(INTEGER, FOREIGN KEY → company.id)email(VARCHAR(120), NOT NULL)token(VARCHAR(64), UNIQUE, NOT NULL)role(VARCHAR(50), DEFAULT 'Team Member')invited_by_id(INTEGER, FOREIGN KEY → user.id)created_at(TIMESTAMP, DEFAULT CURRENT_TIMESTAMP)expires_at(TIMESTAMP, NOT NULL)accepted(BOOLEAN, DEFAULT FALSE)accepted_at(TIMESTAMP)accepted_by_user_id(INTEGER, FOREIGN KEY → user.id)
- Indexes:
idx_invitation_tokenon tokenidx_invitation_emailon emailidx_invitation_companyon company_ididx_invitation_expireson expires_at
Modified Tables
1. company
- Added columns:
updated_at(TIMESTAMP, DEFAULT CURRENT_TIMESTAMP) - NEW
2. user
- Added columns:
two_factor_enabled(BOOLEAN, DEFAULT FALSE) - NEWtwo_factor_secret(VARCHAR(32), NULLABLE) - NEWavatar_url(VARCHAR(255), NULLABLE) - NEW
3. user_preferences
- Added columns:
theme(VARCHAR(20), DEFAULT 'light')language(VARCHAR(10), DEFAULT 'en')timezone(VARCHAR(50), DEFAULT 'UTC')date_format(VARCHAR(20), DEFAULT 'YYYY-MM-DD')time_format(VARCHAR(10), DEFAULT '24h')email_notifications(BOOLEAN, DEFAULT TRUE)email_daily_summary(BOOLEAN, DEFAULT FALSE)email_weekly_summary(BOOLEAN, DEFAULT TRUE)default_project_id(INTEGER, FOREIGN KEY → project.id)timer_reminder_enabled(BOOLEAN, DEFAULT TRUE)timer_reminder_interval(INTEGER, DEFAULT 60)dashboard_layout(JSON, NULLABLE)
4. user_dashboard
- Added columns:
layout(JSON, NULLABLE) - Alternative grid layout configurationis_locked(BOOLEAN, DEFAULT FALSE) - Prevent accidental changes
5. company_work_config
- Added columns:
standard_hours_per_day(FLOAT, DEFAULT 8.0)standard_hours_per_week(FLOAT, DEFAULT 40.0)overtime_enabled(BOOLEAN, DEFAULT TRUE)overtime_rate(FLOAT, DEFAULT 1.5)double_time_enabled(BOOLEAN, DEFAULT FALSE)double_time_threshold(FLOAT, DEFAULT 12.0)double_time_rate(FLOAT, DEFAULT 2.0)require_breaks(BOOLEAN, DEFAULT TRUE)break_duration_minutes(INTEGER, DEFAULT 30)break_after_hours(FLOAT, DEFAULT 6.0)weekly_overtime_threshold(FLOAT, DEFAULT 40.0)weekly_overtime_rate(FLOAT, DEFAULT 1.5)
6. company_settings
- Added columns:
work_week_start(INTEGER, DEFAULT 1)work_days(VARCHAR(20), DEFAULT '1,2,3,4,5')allow_overlapping_entries(BOOLEAN, DEFAULT FALSE)require_project_for_time_entry(BOOLEAN, DEFAULT TRUE)allow_future_entries(BOOLEAN, DEFAULT FALSE)max_hours_per_entry(FLOAT, DEFAULT 24.0)enable_tasks(BOOLEAN, DEFAULT TRUE)enable_sprints(BOOLEAN, DEFAULT FALSE)enable_client_access(BOOLEAN, DEFAULT FALSE)notify_on_overtime(BOOLEAN, DEFAULT TRUE)overtime_threshold_daily(FLOAT, DEFAULT 8.0)overtime_threshold_weekly(FLOAT, DEFAULT 40.0)
7. dashboard_widget
- Added columns:
config(JSON) - Widget-specific configurationis_visible(BOOLEAN, DEFAULT TRUE)
Enum Changes
1. WorkRegion enum
- Added value:
GERMANY = "Germany"- NEW
2. TaskStatus enum
- Added value:
ARCHIVED = "Archived"- NEW
3. WidgetType enum
- Expanded with many new widget types:
- Time Tracking:
CURRENT_TIMER,DAILY_SUMMARY,WEEKLY_CHART,BREAK_REMINDER,TIME_SUMMARY - Project Management:
ACTIVE_PROJECTS,PROJECT_PROGRESS,PROJECT_ACTIVITY,PROJECT_DEADLINES,PROJECT_STATUS - Task Management:
ASSIGNED_TASKS,TASK_PRIORITY,TASK_CALENDAR,UPCOMING_TASKS,TASK_LIST - Sprint:
SPRINT_OVERVIEW,SPRINT_BURNDOWN,SPRINT_PROGRESS - Team & Analytics:
TEAM_WORKLOAD,TEAM_PRESENCE,TEAM_ACTIVITY - Performance:
PRODUCTIVITY_STATS,TIME_DISTRIBUTION,PERSONAL_STATS - Actions:
QUICK_ACTIONS,RECENT_ACTIVITY
- Time Tracking:
Migration Requirements
PostgreSQL Migration Steps:
- Add company_invitation table (migration 19)
- Add updated_at to company table (migration 20)
- Add new columns to user table for 2FA and avatar
- Add new columns to user_preferences table
- Add new columns to user_dashboard table
- Add new columns to company_work_config table
- Add new columns to company_settings table
- Add new columns to dashboard_widget table
- Update enum types for WorkRegion and TaskStatus
- Update WidgetType enum with new values
Data Migration Considerations:
- Default values: All new columns have appropriate defaults
- Nullable fields: Most new fields are nullable or have defaults
- Foreign keys: New invitation table has proper FK constraints
- Indexes: Performance indexes added for invitation lookups
- Enum migrations: Need to handle enum type changes carefully in PostgreSQL
Breaking Changes:
- None identified - all changes are additive or have defaults
Rollback Strategy:
- Drop new tables (company_invitation)
- Drop new columns from existing tables
- Revert enum changes (remove new values)
Summary
The main changes involve:
- Adding email invitation functionality with a new table
- Enhancing user features with 2FA and avatars
- Expanding dashboard and widget capabilities
- Adding comprehensive work configuration options
- Better tracking with updated_at timestamps
- Regional compliance support with expanded WorkRegion enum