"""per-user filter behavior

Revision ID: 3b969fcf37be
Revises: bcfaec0d682a
Create Date: 2025-02-13 18:13:15.930398+00:00

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '3b969fcf37be'
down_revision = 'bcfaec0d682a'
branch_labels = None
depends_on = None


def upgrade():
    filter_behavior = sa.Enum('AUTOMATIC', 'UNFILTERED', 'FILTERED', name='filterbehavior', create_type=False)

    filter_behavior.create(op.get_bind(), checkfirst=True)
         
    op.add_column('users', sa.Column('filter_behavior', filter_behavior, nullable=True))
    op.execute("UPDATE users SET filter_behavior = 'AUTOMATIC'::filterbehavior")
    op.alter_column('users', 'filter_behavior', nullable=False)


def downgrade():
	# ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('users', 'filter_behavior')
    # ### end Alembic commands ###
