UMBRA/backend/alembic/versions/020_extend_location_model.py
Kyle Pope cb9f74a387 Entity pages enhancement: backend model extensions, shared components, Locations rebuild, panel animations
- Add migrations 019/020: extend Person (first/last name, nickname, is_favourite, company, job_title, mobile, category) and Location (is_frequent, contact_number, email)
- Update Person/Location models, schemas, and routers with new fields + name denormalisation
- Create shared component library: EntityTable, EntityDetailPanel, CategoryFilterBar, CopyableField, CategoryAutocomplete, useTableVisibility hook
- Rebuild LocationsPage: table layout with sortable columns, detail side panel, category filter bar, frequent pinned section
- Extend LocationForm with contact number, email, frequent toggle, category autocomplete
- Add animated panel transitions to ProjectDetail (55/45 split with cubic-bezier easing)
- Update TypeScript interfaces for Person and Location

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 21:10:26 +08:00

29 lines
865 B
Python

"""Extend location model with new fields
Revision ID: 020
Revises: 019
Create Date: 2026-02-24
"""
from alembic import op
import sqlalchemy as sa
revision = '020'
down_revision = '019'
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column('locations', sa.Column('is_frequent', sa.Boolean(), nullable=False, server_default='false'))
op.add_column('locations', sa.Column('contact_number', sa.String(50), nullable=True))
op.add_column('locations', sa.Column('email', sa.String(255), nullable=True))
# Belt-and-suspenders: ensure no NULL on is_frequent despite server_default
op.execute("UPDATE locations SET is_frequent = FALSE WHERE is_frequent IS NULL")
def downgrade() -> None:
op.drop_column('locations', 'email')
op.drop_column('locations', 'contact_number')
op.drop_column('locations', 'is_frequent')