mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-14 03:26:40 +07:00
Aurum — a self-hosted personal finance operating system: cash flow, net worth tracking, budgets, goals, recurring payments, reports, proactive alerts, and a compound-interest returns calculator, all bilingual (RU/EN) and mobile-first. Ships as a three-container Docker Compose stack (Postgres + FastAPI + nginx-served React frontend). See README.md for setup and CONTRIBUTING.md for development.
50 lines
1.9 KiB
Python
50 lines
1.9 KiB
Python
"""add assets and asset valuations
|
|
|
|
Revision ID: 6721ea138cdf
|
|
Revises: cfcd12cc849b
|
|
Create Date: 2026-08-14 15:43:19.548554
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '6721ea138cdf'
|
|
down_revision: Union[str, None] = 'cfcd12cc849b'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('assets',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('name', sa.String(length=150), nullable=False),
|
|
sa.Column('asset_class', sa.Enum('INVESTMENTS', 'CRYPTO', 'REAL_ESTATE', 'VEHICLES', 'OTHER', name='asset_class', native_enum=False, length=20), nullable=False),
|
|
sa.Column('currency', sa.String(length=3), nullable=False),
|
|
sa.Column('notes', sa.Text(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_table('asset_valuations',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('asset_id', sa.Integer(), nullable=False),
|
|
sa.Column('value', sa.Numeric(precision=14, scale=2), nullable=False),
|
|
sa.Column('as_of_date', sa.Date(), nullable=False),
|
|
sa.ForeignKeyConstraint(['asset_id'], ['assets.id'], ondelete='CASCADE'),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('asset_id', 'as_of_date', name='uq_asset_valuation_date')
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('asset_valuations')
|
|
op.drop_table('assets')
|
|
# ### end Alembic commands ###
|