Customer 360: extended Client fields, auto-migrate, updated Rolodex CRUD/templates, QDRO routes/views, importer mapping
QDRO links appear in rolodex_view.html case rows and case.html header when QDRO data exists, matching legacy flows.
This commit is contained in:
@@ -105,6 +105,40 @@ def create_tables() -> None:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Lightweight migration: ensure new client columns exist (SQLite safe)
|
||||
try:
|
||||
inspector = inspect(engine)
|
||||
client_cols = {col['name'] for col in inspector.get_columns('clients')}
|
||||
client_required_sql = {
|
||||
'prefix': 'ALTER TABLE clients ADD COLUMN prefix VARCHAR(20)',
|
||||
'middle_name': 'ALTER TABLE clients ADD COLUMN middle_name VARCHAR(50)',
|
||||
'suffix': 'ALTER TABLE clients ADD COLUMN suffix VARCHAR(20)',
|
||||
'title': 'ALTER TABLE clients ADD COLUMN title VARCHAR(100)',
|
||||
'group': 'ALTER TABLE clients ADD COLUMN "group" VARCHAR(50)',
|
||||
'email': 'ALTER TABLE clients ADD COLUMN email VARCHAR(255)',
|
||||
'dob': 'ALTER TABLE clients ADD COLUMN dob DATE',
|
||||
'ssn': 'ALTER TABLE clients ADD COLUMN ssn VARCHAR(20)',
|
||||
'legal_status': 'ALTER TABLE clients ADD COLUMN legal_status VARCHAR(50)',
|
||||
'memo': 'ALTER TABLE clients ADD COLUMN memo TEXT'
|
||||
}
|
||||
client_alters = []
|
||||
for col_name, ddl in client_required_sql.items():
|
||||
if col_name not in client_cols:
|
||||
client_alters.append(ddl)
|
||||
if client_alters:
|
||||
with engine.begin() as conn:
|
||||
for ddl in client_alters:
|
||||
conn.execute(text(ddl))
|
||||
except Exception as e:
|
||||
try:
|
||||
from .logging_config import setup_logging
|
||||
import structlog
|
||||
setup_logging()
|
||||
_logger = structlog.get_logger(__name__)
|
||||
_logger.warning("sqlite_migration_clients_failed", error=str(e))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Seed default admin user after creating tables
|
||||
try:
|
||||
from .auth import seed_admin_user
|
||||
|
||||
Reference in New Issue
Block a user