"""delete_table_ungrouped_collapsed_from_view_mode_options

Revision ID: 0260
Revises: 0259
Create Date: 2024-09-19 15:16:21.326305

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


# revision identifiers, used by Alembic.
revision = '0260'
down_revision = '0259'
branch_labels = None
depends_on = None


def upgrade():
    op.execute("""
        UPDATE
            views v
        SET
            mode_options = mode_options - '{
                table_(non-groupées)_collapsed,
                table_(ungrouped)_collapsed,
                table_(ungruppiert)_collapsed,
                table_(desagrupado)_collapsed,
                table_(non raggruppati)_collapsed,
                table_(não agrupados)_collapsed
            }'::text[]
        WHERE
        (
            v.mode_options ? 'table_(non-groupées)_collapsed'
            OR v.mode_options ? 'table_(ungrouped)_collapsed'
            OR v.mode_options ? 'table_(ungruppiert)_collapsed'
            OR v.mode_options ? 'table_(desagrupado)_collapsed'
            OR v.mode_options ? 'table_(non raggruppati)_collapsed'
            OR v.mode_options ? 'table_(não agrupados)_collapsed'
        )
    """)
    pass


def downgrade():
    pass
