"""Minimum donation count for each medal

Revision ID: 9c632e7c77df
Revises: 3f6d357b2be2
Create Date: 2021-01-16 11:54:59.767379

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "9c632e7c77df"
down_revision = "3f6d357b2be2"
branch_labels = None
depends_on = None


def upgrade():
    op.add_column("medals", sa.Column("minimum_donations", sa.Integer(), nullable=True))
    op.execute("UPDATE medals SET minimum_donations = 10  WHERE slug = 'br';")
    op.execute("UPDATE medals SET minimum_donations = 20  WHERE slug = 'st';")
    op.execute("UPDATE medals SET minimum_donations = 40  WHERE slug = 'zl';")
    op.execute("UPDATE medals SET minimum_donations = 80  WHERE slug = 'kr3';")
    op.execute("UPDATE medals SET minimum_donations = 120 WHERE slug = 'kr2';")
    op.execute("UPDATE medals SET minimum_donations = 160 WHERE slug = 'kr1';")
    op.execute("UPDATE medals SET minimum_donations = 250 WHERE slug = 'plk';")


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("medals", "minimum_donations")
    # ### end Alembic commands ###
