- 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>
41 lines
1.6 KiB
Python
41 lines
1.6 KiB
Python
"""Extend person model with new fields
|
|
|
|
Revision ID: 019
|
|
Revises: 018
|
|
Create Date: 2026-02-24
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = '019'
|
|
down_revision = '018'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column('people', sa.Column('first_name', sa.String(100), nullable=True))
|
|
op.add_column('people', sa.Column('last_name', sa.String(100), nullable=True))
|
|
op.add_column('people', sa.Column('nickname', sa.String(100), nullable=True))
|
|
op.add_column('people', sa.Column('is_favourite', sa.Boolean(), nullable=False, server_default='false'))
|
|
op.add_column('people', sa.Column('company', sa.String(255), nullable=True))
|
|
op.add_column('people', sa.Column('job_title', sa.String(255), nullable=True))
|
|
op.add_column('people', sa.Column('mobile', sa.String(50), nullable=True))
|
|
op.add_column('people', sa.Column('category', sa.String(100), nullable=True))
|
|
|
|
# Data migration: seed category from existing relationship field
|
|
op.execute("UPDATE people SET category = relationship WHERE category IS NULL AND relationship IS NOT NULL")
|
|
# Belt-and-suspenders: ensure no NULL on is_favourite despite server_default
|
|
op.execute("UPDATE people SET is_favourite = FALSE WHERE is_favourite IS NULL")
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column('people', 'category')
|
|
op.drop_column('people', 'mobile')
|
|
op.drop_column('people', 'job_title')
|
|
op.drop_column('people', 'company')
|
|
op.drop_column('people', 'is_favourite')
|
|
op.drop_column('people', 'nickname')
|
|
op.drop_column('people', 'last_name')
|
|
op.drop_column('people', 'first_name')
|