"""inbox

Revision: 0208
Revision ID: 41d379ba09af
Revises: 0f6cbf29afd9
Create Date: 2021-02-26 16:02:57.613574

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


# revision identifiers, used by Alembic.
revision = '41d379ba09af'
down_revision = '0f6cbf29afd9'
branch_labels = None
depends_on = None


def upgrade():
    op.execute("""
        DELETE FROM activities
        WHERE object_type = 'CardComment' AND NOT EXISTS (SELECT 1 FROM card_comments WHERE card_comments.id = activities.object_id)
    """)


def downgrade():
    pass
