mirror of https://github.com/stijndcl/didier
77 lines
2.5 KiB
Python
77 lines
2.5 KiB
Python
"""Currency updates
|
|
|
|
Revision ID: 8f7e8384cec3
|
|
Revises: 09128b6e34dd
|
|
Create Date: 2024-03-03 17:48:36.205106
|
|
|
|
"""
|
|
import sqlalchemy as sa
|
|
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "8f7e8384cec3"
|
|
down_revision = "09128b6e34dd"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
"cf_stats",
|
|
sa.Column("cf_stats_id", sa.Integer(), nullable=False),
|
|
sa.Column("games_won", sa.BigInteger(), server_default="0", nullable=False),
|
|
sa.Column("games_lost", sa.BigInteger(), server_default="0", nullable=False),
|
|
sa.Column("dinks_won", sa.BigInteger(), server_default="0", nullable=False),
|
|
sa.Column("dinks_lost", sa.BigInteger(), server_default="0", nullable=False),
|
|
sa.Column("user_id", sa.BigInteger(), nullable=False),
|
|
sa.ForeignKeyConstraint(
|
|
["user_id"],
|
|
["users.user_id"],
|
|
),
|
|
sa.PrimaryKeyConstraint("cf_stats_id"),
|
|
)
|
|
op.create_table(
|
|
"jail",
|
|
sa.Column("jail_entry_id", sa.Integer(), nullable=False),
|
|
sa.Column("user_id", sa.BigInteger(), nullable=False),
|
|
sa.Column("until", sa.DateTime(timezone=True), nullable=False),
|
|
sa.ForeignKeyConstraint(
|
|
["user_id"],
|
|
["users.user_id"],
|
|
),
|
|
sa.PrimaryKeyConstraint("jail_entry_id"),
|
|
)
|
|
op.create_table(
|
|
"savings",
|
|
sa.Column("savings_id", sa.Integer(), nullable=False),
|
|
sa.Column("user_id", sa.BigInteger(), nullable=False),
|
|
sa.Column("saved", sa.BigInteger(), server_default="0", nullable=False),
|
|
sa.Column("daily_minimum", sa.BigInteger(), server_default="0", nullable=False),
|
|
sa.ForeignKeyConstraint(
|
|
["user_id"],
|
|
["users.user_id"],
|
|
),
|
|
sa.PrimaryKeyConstraint("savings_id"),
|
|
)
|
|
with op.batch_alter_table("bank", schema=None) as batch_op:
|
|
batch_op.drop_column("invested")
|
|
|
|
# ### 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(
|
|
"invested", sa.BIGINT(), server_default=sa.text("'0'::bigint"), autoincrement=False, nullable=False
|
|
)
|
|
)
|
|
|
|
op.drop_table("savings")
|
|
op.drop_table("jail")
|
|
op.drop_table("cf_stats")
|
|
# ### end Alembic commands ###
|