"""clear_card_attributes

Revision: 0170
Revision ID: 27a5b637092e
Revises: 21cd415ba55b
Create Date: 2019-07-04 16:34:26.117473

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql


# revision identifiers, used by Alembic.
revision = '27a5b637092e'
down_revision = '21cd415ba55b'
branch_labels = None
depends_on = None


def upgrade():
    op.execute("""UPDATE cards SET cache_id = uuid_generate_v4() FROM card_attributes WHERE card_attributes.card_id = cards.id AND card_attributes.type_name = 'group_type'""")
    op.execute("""DELETE FROM card_attributes WHERE type_name = 'group_type'""")


def downgrade():
    pass
