"""Added Payment.currency

Revision ID: b8efef98600a
Revises: cf5a62cdff0f
Create Date: 2021-06-30 10:28:26.956446

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'b8efef98600a'
down_revision = 'cf5a62cdff0f'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    # Создаем колонку
    op.add_column('payments', sa.Column('currency', sa.String(), nullable=True))
    # Всю всю заполняем
    op.execute("UPDATE payments SET currency='RUB'")
    # Делаем запрет на то чтобы она была пустой
    op.alter_column('payments', 'currency', nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('payments', 'currency')
    # ### end Alembic commands ###
