"""clear_model_on_card_links

Revision: 0232
Revision ID: 658071592313
Revises: 0ce8c01ee717
Create Date: 2022-03-16 15:33:44.066377

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


# revision identifiers, used by Alembic.
revision = '658071592313'
down_revision = '0ce8c01ee717'
branch_labels = None
depends_on = None


def upgrade():
    op.execute("""UPDATE cards SET model_id = null, cache_id = uuid_generate_v4() WHERE is_link AND NOT link_has_own_attributes AND model_id IS NOT NULL""")


def downgrade():
    pass
