"""fix existing users

Revision ID: 7554ab70efe7
Revises: 43dfd2543fad
Create Date: 2024-03-19 10:05:00.000000

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy import inspect
from sqlalchemy.sql import text


# revision identifiers, used by Alembic.
revision = '7554ab70efe7'
down_revision = '43dfd2543fad'
branch_labels = None
depends_on = None


def upgrade():
    # Update existing users to set default values
    connection = op.get_bind()
    connection.execute(
        text("""
        UPDATE "user"
        SET position = 'Administrator',
            is_active = true
        WHERE position IS NULL
        """)
    )


def downgrade():
    pass
