"""Restructure user organizations.

Revision ID: 34b7f4f4ac81
Revises: d16c82cfe1fe
Create Date: 2025-06-07 17:22:08.104181

"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "34b7f4f4ac81"
down_revision = "d16c82cfe1fe"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(op.f("user_organization_id_fkey"), "user", type_="foreignkey")
    op.drop_column("user", "organization_id")
    op.drop_column("user", "current_organization_id")
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "user", sa.Column("current_organization_id", sa.UUID(), autoincrement=False, nullable=True)
    )
    op.add_column(
        "user", sa.Column("organization_id", sa.UUID(), autoincrement=False, nullable=False)
    )
    op.create_foreign_key(
        op.f("user_organization_id_fkey"), "user", "organization", ["organization_id"], ["id"]
    )
    # ### end Alembic commands ###
