Update db schema

dinks
Stijn De Clercq 2023-09-17 17:18:47 +02:00
parent 07b356bff2
commit 271cad9565
2 changed files with 42 additions and 9 deletions

View File

@ -0,0 +1,42 @@
"""Remove bank levels
Revision ID: ab20a9e527d6
Revises: 09128b6e34dd
Create Date: 2023-09-17 17:13:54.187842
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "ab20a9e527d6"
down_revision = "09128b6e34dd"
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("bank", schema=None) as batch_op:
batch_op.drop_column("rob_level")
batch_op.drop_column("interest_level")
batch_op.drop_column("capacity_level")
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("bank", schema=None) as batch_op:
batch_op.add_column(
sa.Column("capacity_level", sa.INTEGER(), server_default=sa.text("1"), autoincrement=False, nullable=False)
)
batch_op.add_column(
sa.Column("interest_level", sa.INTEGER(), server_default=sa.text("1"), autoincrement=False, nullable=False)
)
batch_op.add_column(
sa.Column("rob_level", sa.INTEGER(), server_default=sa.text("1"), autoincrement=False, nullable=False)
)
# ### end Alembic commands ###

View File

@ -53,15 +53,6 @@ class Bank(Base):
dinks: Mapped[int] = mapped_column(BigInteger, server_default="0", nullable=False)
invested: Mapped[int] = mapped_column(BigInteger, server_default="0", nullable=False)
# Interest rate
interest_level: Mapped[int] = mapped_column(server_default="1", nullable=False)
# Maximum amount that can be stored in the bank
capacity_level: Mapped[int] = mapped_column(server_default="1", nullable=False)
# Maximum amount that can be robbed
rob_level: Mapped[int] = mapped_column(server_default="1", nullable=False)
user: Mapped[User] = relationship(uselist=False, back_populates="bank", lazy="selectin")