|
| 1 | +"""Add combo multipliers |
| 2 | +
|
| 3 | +Revision ID: 28e53a4e60fe |
| 4 | +Revises: fa5ff0ea7eab |
| 5 | +Create Date: 2025-01-14 22:48:14.773004 |
| 6 | +
|
| 7 | +""" |
| 8 | +from alembic import op |
| 9 | +import sqlalchemy as sa |
| 10 | + |
| 11 | + |
| 12 | +# revision identifiers, used by Alembic. |
| 13 | +revision = '28e53a4e60fe' |
| 14 | +down_revision = 'fa5ff0ea7eab' |
| 15 | +branch_labels = None |
| 16 | +depends_on = None |
| 17 | + |
| 18 | + |
| 19 | +def upgrade(): |
| 20 | + # ### commands auto generated by Alembic - please adjust! ### |
| 21 | + with op.batch_alter_table('task', schema=None) as batch_op: |
| 22 | + batch_op.alter_column('streak', |
| 23 | + existing_type=sa.INTEGER(), |
| 24 | + nullable=False, |
| 25 | + existing_server_default=sa.text('0')) |
| 26 | + batch_op.alter_column('completed', |
| 27 | + existing_type=sa.INTEGER(), |
| 28 | + type_=sa.Boolean(), |
| 29 | + existing_nullable=False, |
| 30 | + existing_server_default=sa.text('0')) |
| 31 | + |
| 32 | + with op.batch_alter_table('user', schema=None) as batch_op: |
| 33 | + batch_op.add_column(sa.Column('combo_multiplier', sa.Integer(), nullable=False)) |
| 34 | + batch_op.add_column(sa.Column('last_task_completed', sa.Integer(), nullable=False)) |
| 35 | + batch_op.alter_column('tasks_completed', |
| 36 | + existing_type=sa.INTEGER(), |
| 37 | + nullable=False, |
| 38 | + existing_server_default=sa.text('0')) |
| 39 | + |
| 40 | + # ### end Alembic commands ### |
| 41 | + |
| 42 | + |
| 43 | +def downgrade(): |
| 44 | + # ### commands auto generated by Alembic - please adjust! ### |
| 45 | + with op.batch_alter_table('user', schema=None) as batch_op: |
| 46 | + batch_op.alter_column('tasks_completed', |
| 47 | + existing_type=sa.INTEGER(), |
| 48 | + nullable=True, |
| 49 | + existing_server_default=sa.text('0')) |
| 50 | + batch_op.drop_column('last_task_completed') |
| 51 | + batch_op.drop_column('combo_multiplier') |
| 52 | + |
| 53 | + with op.batch_alter_table('task', schema=None) as batch_op: |
| 54 | + batch_op.alter_column('completed', |
| 55 | + existing_type=sa.Boolean(), |
| 56 | + type_=sa.INTEGER(), |
| 57 | + existing_nullable=False, |
| 58 | + existing_server_default=sa.text('0')) |
| 59 | + batch_op.alter_column('streak', |
| 60 | + existing_type=sa.INTEGER(), |
| 61 | + nullable=True, |
| 62 | + existing_server_default=sa.text('0')) |
| 63 | + |
| 64 | + # ### end Alembic commands ### |
0 commit comments