Files
TimeTracker/migrations/versions/022_add_project_code_field.py
T
Dries Peeters 0c316ac5e1 feat: Implement bulk operations and status management improvements
Major improvements:
- Add bulk operations functionality across clients, projects, and tasks
- Implement deletion and status management enhancements
- Add project code field with database migration (022)
- Improve inactive status handling for projects

Backend changes:
- Update project model with new code field and status logic
- Enhance routes for clients, projects, and tasks with bulk actions
- Add migration for project_code field (022_add_project_code_field.py)

Frontend updates:
- Refactor bulk actions widget component
- Update clients list and detail views with bulk operations
- Enhance project list, view, and kanban templates
- Improve task list, edit, view, and kanban displays
- Update base template with UI improvements
- Refine saved filters and time entry templates lists

Testing:
- Add test_project_inactive_status.py for status handling
- Update test_tasks_templates.py with new functionality

Documentation:
- Add BULK_OPERATIONS_IMPROVEMENTS.md
- Add DELETION_AND_STATUS_IMPROVEMENTS.md
- Add docs/QUICK_WINS_IMPLEMENTATION.md
- Update ALL_BUGFIXES_SUMMARY.md and IMPLEMENTATION_COMPLETE.md
2025-10-23 12:41:22 +02:00

53 lines
1.3 KiB
Python

"""Add short project code field for compact identifiers
Revision ID: 023
Revises: 022
Create Date: 2025-10-23 00:00:00
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '023'
down_revision = '022'
branch_labels = None
depends_on = None
def upgrade():
bind = op.get_bind()
dialect_name = bind.dialect.name if bind else 'generic'
# Add code column if not present
with op.batch_alter_table('projects') as batch_op:
batch_op.add_column(sa.Column('code', sa.String(length=20), nullable=True))
try:
batch_op.create_unique_constraint('uq_projects_code', ['code'])
except Exception:
# Some dialects may not support unique with NULLs the same way; ignore if exists
pass
try:
batch_op.create_index('ix_projects_code', ['code'])
except Exception:
pass
def downgrade():
with op.batch_alter_table('projects') as batch_op:
try:
batch_op.drop_index('ix_projects_code')
except Exception:
pass
try:
batch_op.drop_constraint('uq_projects_code', type_='unique')
except Exception:
pass
try:
batch_op.drop_column('code')
except Exception:
pass