release: publish saldo 0.1.0
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
"""add entry benefit scope
|
||||
|
||||
Revision ID: 46efbd09438b
|
||||
Revises: 71ff8f291d18
|
||||
Create Date: 2026-04-20 22:26:46.698956
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '46efbd09438b'
|
||||
down_revision = '71ff8f291d18'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('entry', schema=None) as batch_op:
|
||||
batch_op.add_column(
|
||||
sa.Column(
|
||||
'benefit_scope',
|
||||
sa.String(length=20),
|
||||
nullable=False,
|
||||
server_default='both',
|
||||
)
|
||||
)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('entry', schema=None) as batch_op:
|
||||
batch_op.drop_column('benefit_scope')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,35 @@
|
||||
"""add distribution ranges to month
|
||||
|
||||
Revision ID: 5f1c2e87a921
|
||||
Revises: c4a1d9b9e2f1
|
||||
Create Date: 2026-04-20 15:45:00.000000
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "5f1c2e87a921"
|
||||
down_revision = "c4a1d9b9e2f1"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column("month", sa.Column("savings_min_pct", sa.Numeric(5, 2), nullable=False, server_default="15.00"))
|
||||
op.add_column("month", sa.Column("savings_max_pct", sa.Numeric(5, 2), nullable=False, server_default="20.00"))
|
||||
op.add_column("month", sa.Column("vacation_min_pct", sa.Numeric(5, 2), nullable=False, server_default="5.00"))
|
||||
op.add_column("month", sa.Column("vacation_max_pct", sa.Numeric(5, 2), nullable=False, server_default="8.00"))
|
||||
op.add_column("month", sa.Column("leisure_min_pct", sa.Numeric(5, 2), nullable=False, server_default="5.00"))
|
||||
op.add_column("month", sa.Column("leisure_max_pct", sa.Numeric(5, 2), nullable=False, server_default="10.00"))
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("month", "leisure_max_pct")
|
||||
op.drop_column("month", "leisure_min_pct")
|
||||
op.drop_column("month", "vacation_max_pct")
|
||||
op.drop_column("month", "vacation_min_pct")
|
||||
op.drop_column("month", "savings_max_pct")
|
||||
op.drop_column("month", "savings_min_pct")
|
||||
@@ -0,0 +1,239 @@
|
||||
"""initial schema
|
||||
|
||||
Revision ID: 71ff8f291d18
|
||||
Revises:
|
||||
Create Date: 2026-04-20 16:47:07.607628
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '71ff8f291d18'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('account',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=120), nullable=False),
|
||||
sa.Column('slug', sa.String(length=120), nullable=False),
|
||||
sa.Column('description', sa.Text(), nullable=True),
|
||||
sa.Column('sort_order', sa.Integer(), nullable=False),
|
||||
sa.Column('is_active', sa.Boolean(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name'),
|
||||
sa.UniqueConstraint('slug')
|
||||
)
|
||||
op.create_table('month',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('label', sa.String(length=7), nullable=False),
|
||||
sa.Column('year', sa.Integer(), nullable=False),
|
||||
sa.Column('month', sa.Integer(), nullable=False),
|
||||
sa.Column('auto_created', sa.Boolean(), nullable=False),
|
||||
sa.Column('is_locked', sa.Boolean(), nullable=False),
|
||||
sa.Column('notes', sa.Text(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('label')
|
||||
)
|
||||
op.create_table('user',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('username', sa.String(length=80), nullable=False),
|
||||
sa.Column('email', sa.String(length=255), nullable=False),
|
||||
sa.Column('password_hash', sa.String(length=255), nullable=False),
|
||||
sa.Column('role', sa.String(length=20), nullable=False),
|
||||
sa.Column('is_active', sa.Boolean(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('email'),
|
||||
sa.UniqueConstraint('username')
|
||||
)
|
||||
op.create_table('allocation_suggestion',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('month_id', sa.Integer(), nullable=False),
|
||||
sa.Column('target_account_id', sa.Integer(), nullable=False),
|
||||
sa.Column('suggested_amount', sa.Numeric(precision=12, scale=2), nullable=False),
|
||||
sa.Column('reason', sa.Text(), nullable=True),
|
||||
sa.Column('strategy_key', sa.String(length=80), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['month_id'], ['month.id'], ),
|
||||
sa.ForeignKeyConstraint(['target_account_id'], ['account.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('audit_log',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||
sa.Column('action', sa.String(length=120), nullable=False),
|
||||
sa.Column('entity_type', sa.String(length=80), nullable=False),
|
||||
sa.Column('entity_id', sa.Integer(), nullable=True),
|
||||
sa.Column('payload_json', sa.Text(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('category',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('account_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=120), nullable=False),
|
||||
sa.Column('slug', sa.String(length=120), nullable=False),
|
||||
sa.Column('description', sa.Text(), nullable=True),
|
||||
sa.Column('sort_order', sa.Integer(), nullable=False),
|
||||
sa.Column('is_active', sa.Boolean(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['account_id'], ['account.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('account_id', 'slug')
|
||||
)
|
||||
op.create_table('cost_participant',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=120), nullable=False),
|
||||
sa.Column('is_app_user', sa.Boolean(), nullable=False),
|
||||
sa.Column('linked_user_id', sa.Integer(), nullable=True),
|
||||
sa.Column('is_external', sa.Boolean(), nullable=False),
|
||||
sa.Column('is_active', sa.Boolean(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['linked_user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
op.create_table('in_app_notification',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('type', sa.String(length=50), nullable=False),
|
||||
sa.Column('title', sa.String(length=150), nullable=False),
|
||||
sa.Column('body', sa.Text(), nullable=False),
|
||||
sa.Column('action_url', sa.String(length=255), nullable=True),
|
||||
sa.Column('is_read', sa.Boolean(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('monthly_allocation',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('month_id', sa.Integer(), nullable=False),
|
||||
sa.Column('target_account_id', sa.Integer(), nullable=False),
|
||||
sa.Column('label', sa.String(length=120), nullable=False),
|
||||
sa.Column('amount', sa.Numeric(precision=12, scale=2), nullable=False),
|
||||
sa.Column('source', sa.String(length=30), nullable=False),
|
||||
sa.Column('is_locked', sa.Boolean(), nullable=False),
|
||||
sa.Column('sort_order', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['month_id'], ['month.id'], ),
|
||||
sa.ForeignKeyConstraint(['target_account_id'], ['account.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('month_id', 'target_account_id')
|
||||
)
|
||||
op.create_table('monthly_income',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('month_id', sa.Integer(), nullable=False),
|
||||
sa.Column('label', sa.String(length=120), nullable=False),
|
||||
sa.Column('amount', sa.Numeric(precision=12, scale=2), nullable=False),
|
||||
sa.Column('sort_order', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['month_id'], ['month.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('notification_preference',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('notify_month_end', sa.Boolean(), nullable=False),
|
||||
sa.Column('notify_missing_distribution', sa.Boolean(), nullable=False),
|
||||
sa.Column('notify_missing_values', sa.Boolean(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('user_id')
|
||||
)
|
||||
op.create_table('push_subscription',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('endpoint', sa.Text(), nullable=False),
|
||||
sa.Column('p256dh_key', sa.Text(), nullable=False),
|
||||
sa.Column('auth_key', sa.Text(), nullable=False),
|
||||
sa.Column('user_agent', sa.String(length=255), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('entry',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('category_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=120), nullable=False),
|
||||
sa.Column('slug', sa.String(length=120), nullable=False),
|
||||
sa.Column('description', sa.Text(), nullable=True),
|
||||
sa.Column('default_amount', sa.Numeric(precision=12, scale=2), nullable=False),
|
||||
sa.Column('amount_type', sa.String(length=20), nullable=False),
|
||||
sa.Column('is_active', sa.Boolean(), nullable=False),
|
||||
sa.Column('sort_order', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['category_id'], ['category.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('category_id', 'slug')
|
||||
)
|
||||
op.create_table('entry_share_rule',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('entry_id', sa.Integer(), nullable=False),
|
||||
sa.Column('participant_id', sa.Integer(), nullable=False),
|
||||
sa.Column('share_type', sa.String(length=20), nullable=False),
|
||||
sa.Column('share_value', sa.Numeric(precision=12, scale=4), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['entry_id'], ['entry.id'], ),
|
||||
sa.ForeignKeyConstraint(['participant_id'], ['cost_participant.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('entry_id', 'participant_id')
|
||||
)
|
||||
op.create_table('monthly_entry_value',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('month_id', sa.Integer(), nullable=False),
|
||||
sa.Column('entry_id', sa.Integer(), nullable=False),
|
||||
sa.Column('planned_amount', sa.Numeric(precision=12, scale=2), nullable=False),
|
||||
sa.Column('note', sa.Text(), nullable=True),
|
||||
sa.Column('created_by', sa.Integer(), nullable=True),
|
||||
sa.Column('updated_by', sa.Integer(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['created_by'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['entry_id'], ['entry.id'], ),
|
||||
sa.ForeignKeyConstraint(['month_id'], ['month.id'], ),
|
||||
sa.ForeignKeyConstraint(['updated_by'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('month_id', 'entry_id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('monthly_entry_value')
|
||||
op.drop_table('entry_share_rule')
|
||||
op.drop_table('entry')
|
||||
op.drop_table('push_subscription')
|
||||
op.drop_table('notification_preference')
|
||||
op.drop_table('monthly_income')
|
||||
op.drop_table('monthly_allocation')
|
||||
op.drop_table('in_app_notification')
|
||||
op.drop_table('cost_participant')
|
||||
op.drop_table('category')
|
||||
op.drop_table('audit_log')
|
||||
op.drop_table('allocation_suggestion')
|
||||
op.drop_table('user')
|
||||
op.drop_table('month')
|
||||
op.drop_table('account')
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,28 @@
|
||||
"""add entry allocation target
|
||||
|
||||
Revision ID: 8d3f0c61bb21
|
||||
Revises: 5f1c2e87a921
|
||||
Create Date: 2026-04-20 16:10:00.000000
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "8d3f0c61bb21"
|
||||
down_revision = "5f1c2e87a921"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column(
|
||||
"entry",
|
||||
sa.Column("is_allocation_target", sa.Boolean(), nullable=False, server_default=sa.false()),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("entry", "is_allocation_target")
|
||||
@@ -0,0 +1,53 @@
|
||||
"""add community accounts
|
||||
|
||||
Revision ID: a91b7c4d2f10
|
||||
Revises: 8d3f0c61bb21
|
||||
Create Date: 2026-04-21 11:30:00.000000
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "a91b7c4d2f10"
|
||||
down_revision = "8d3f0c61bb21"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"community_account",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.String(length=120), nullable=False),
|
||||
sa.Column("slug", sa.String(length=120), nullable=False),
|
||||
sa.Column("description", sa.Text(), nullable=True),
|
||||
sa.Column("account_type", sa.String(length=20), nullable=False),
|
||||
sa.Column("linked_account_slug", sa.String(length=120), nullable=True),
|
||||
sa.Column("sort_order", sa.Integer(), nullable=False),
|
||||
sa.Column("is_active", sa.Boolean(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint("name"),
|
||||
sa.UniqueConstraint("slug"),
|
||||
)
|
||||
|
||||
with op.batch_alter_table("category", schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column("community_account_id", sa.Integer(), nullable=True))
|
||||
batch_op.create_foreign_key(
|
||||
"fk_category_community_account_id",
|
||||
"community_account",
|
||||
["community_account_id"],
|
||||
["id"],
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
with op.batch_alter_table("category", schema=None) as batch_op:
|
||||
batch_op.drop_constraint("fk_category_community_account_id", type_="foreignkey")
|
||||
batch_op.drop_column("community_account_id")
|
||||
|
||||
op.drop_table("community_account")
|
||||
@@ -0,0 +1,35 @@
|
||||
"""expand entry benefit scope
|
||||
|
||||
Revision ID: ab4c2d1e9a10
|
||||
Revises: d9f3c6a1b7f0
|
||||
Create Date: 2026-04-21 16:05:00.000000
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "ab4c2d1e9a10"
|
||||
down_revision = "d9f3c6a1b7f0"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
with op.batch_alter_table("entry", schema=None) as batch_op:
|
||||
batch_op.alter_column(
|
||||
"benefit_scope",
|
||||
existing_type=sa.String(length=20),
|
||||
type_=sa.String(length=120),
|
||||
existing_nullable=False,
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
with op.batch_alter_table("entry", schema=None) as batch_op:
|
||||
batch_op.alter_column(
|
||||
"benefit_scope",
|
||||
existing_type=sa.String(length=120),
|
||||
type_=sa.String(length=20),
|
||||
existing_nullable=False,
|
||||
)
|
||||
@@ -0,0 +1,33 @@
|
||||
"""add avatar fields
|
||||
|
||||
Revision ID: c1f8d92b4e31
|
||||
Revises: a91b7c4d2f10
|
||||
Create Date: 2026-04-21 12:20:00.000000
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "c1f8d92b4e31"
|
||||
down_revision = "a91b7c4d2f10"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
with op.batch_alter_table("user", schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column("avatar_url", sa.String(length=255), nullable=True))
|
||||
|
||||
with op.batch_alter_table("cost_participant", schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column("avatar_url", sa.String(length=255), nullable=True))
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
with op.batch_alter_table("cost_participant", schema=None) as batch_op:
|
||||
batch_op.drop_column("avatar_url")
|
||||
|
||||
with op.batch_alter_table("user", schema=None) as batch_op:
|
||||
batch_op.drop_column("avatar_url")
|
||||
@@ -0,0 +1,28 @@
|
||||
"""add personal split to month
|
||||
|
||||
Revision ID: c4a1d9b9e2f1
|
||||
Revises: 46efbd09438b
|
||||
Create Date: 2026-04-20 15:10:00.000000
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "c4a1d9b9e2f1"
|
||||
down_revision = "46efbd09438b"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column(
|
||||
"month",
|
||||
sa.Column("personal_split_desi_pct", sa.Numeric(5, 2), nullable=False, server_default="50.00"),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("month", "personal_split_desi_pct")
|
||||
@@ -0,0 +1,31 @@
|
||||
"""add user display name
|
||||
|
||||
Revision ID: d9f3c6a1b7f0
|
||||
Revises: c1f8d92b4e31
|
||||
Create Date: 2026-04-21 18:20:00.000000
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "d9f3c6a1b7f0"
|
||||
down_revision = "c1f8d92b4e31"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table("user", schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column("display_name", sa.String(length=120), nullable=True))
|
||||
|
||||
op.execute('UPDATE user SET display_name = username WHERE display_name IS NULL')
|
||||
|
||||
with op.batch_alter_table("user", schema=None) as batch_op:
|
||||
batch_op.alter_column("display_name", existing_type=sa.String(length=120), nullable=False)
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table("user", schema=None) as batch_op:
|
||||
batch_op.drop_column("display_name")
|
||||
Reference in New Issue
Block a user