"""clear_group_type_card_attributes

Revision ID: 0286
Revises: 0285
Create Date: 2026-03-03 11:09:29.673537

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


# revision identifiers, used by Alembic.
revision = '0286'
down_revision = '0285'
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
