Ten31 LLC (and any GP/mgmt entity) can be linked to its investor account, so its Assets tab shows its real capital-account balance in each fund, pulled live from the eNAV capital accounts instead of manual entry. - entities.linked_user_id (migration c9d0e1f2a3b4) + EntityCreate/Update/ Response fields; validated to be an investor account. - Edit-entity form gains a "Linked investor account" picker for GP/mgmt. - Assets tab now auto-lists the linked account's balance per fund (the earlier manual-stakes API remains but is no longer used by the UI). Verified: 13/13 backend tests pass; alembic head c9d0e1f2a3b4; frontend tsc + vite build clean.
30 lines
912 B
Python
30 lines
912 B
Python
"""add entities.linked_user_id (link a GP entity to its investor account)
|
|
|
|
Revision ID: c9d0e1f2a3b4
|
|
Revises: b8c9d0e1f2a3
|
|
Create Date: 2026-07-01 10:45:00.000000
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
revision: str = 'c9d0e1f2a3b4'
|
|
down_revision: Union[str, None] = 'b8c9d0e1f2a3'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
with op.batch_alter_table('entities', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('linked_user_id', sa.Integer(), nullable=True))
|
|
op.create_index('ix_entities_linked_user_id', 'entities', ['linked_user_id'])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index('ix_entities_linked_user_id', table_name='entities')
|
|
with op.batch_alter_table('entities', schema=None) as batch_op:
|
|
batch_op.drop_column('linked_user_id')
|