Internal
Public Access
Features: - Django-based REST API with web interface - Task management with tags, priorities, and due dates - Time tracking with start/stop timers - Subtasks support - Task filtering (all, today, upcoming, overdue, completed) - Tag-based organization with color coding - Sorting by due date and priority - Auto-assign tags when filtering - Responsive 3-pane layout (sidebar, task list, detail panel) - Task sharing between users - Mobile-responsive design with dark mode support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
62 lines
2.0 KiB
Python
62 lines
2.0 KiB
Python
# Generated by Django 5.2.9 on 2025-12-13 07:00
|
|
|
|
from django.db import migrations
|
|
|
|
|
|
def fix_task_shares_table(apps, schema_editor):
|
|
"""
|
|
Fix the task_shares table to reference the correct 'tags' table
|
|
instead of the old 'task_groups' table.
|
|
"""
|
|
db_alias = schema_editor.connection.alias
|
|
|
|
# Drop and recreate the task_shares table with correct foreign keys
|
|
schema_editor.execute(
|
|
"DROP TABLE IF EXISTS task_shares;"
|
|
)
|
|
|
|
schema_editor.execute(
|
|
"""
|
|
CREATE TABLE task_shares (
|
|
id CHAR(32) NOT NULL PRIMARY KEY,
|
|
permission VARCHAR(20) NOT NULL,
|
|
sync_id CHAR(32) NOT NULL UNIQUE,
|
|
created_at DATETIME NOT NULL,
|
|
updated_at DATETIME NOT NULL,
|
|
owner_id CHAR(32) NOT NULL REFERENCES users(id) DEFERRABLE INITIALLY DEFERRED,
|
|
shared_with_id CHAR(32) NOT NULL REFERENCES users(id) DEFERRABLE INITIALLY DEFERRED,
|
|
task_id CHAR(32) NULL REFERENCES tasks(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
|
|
tag_id CHAR(32) NULL REFERENCES tags(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
|
|
CONSTRAINT share_task_or_tag_not_both CHECK (
|
|
(tag_id IS NULL AND task_id IS NOT NULL) OR
|
|
(tag_id IS NOT NULL AND task_id IS NULL)
|
|
)
|
|
);
|
|
"""
|
|
)
|
|
|
|
# Create indexes for foreign keys
|
|
schema_editor.execute(
|
|
"CREATE INDEX task_shares_owner_id_idx ON task_shares(owner_id);"
|
|
)
|
|
schema_editor.execute(
|
|
"CREATE INDEX task_shares_shared_with_id_idx ON task_shares(shared_with_id);"
|
|
)
|
|
schema_editor.execute(
|
|
"CREATE INDEX task_shares_task_id_idx ON task_shares(task_id);"
|
|
)
|
|
schema_editor.execute(
|
|
"CREATE INDEX task_shares_tag_id_idx ON task_shares(tag_id);"
|
|
)
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('tasks', '0005_fix_tasks_tags_table'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(fix_task_shares_table, migrations.RunPython.noop),
|
|
]
|