"""TripItem paid_by

Revision ID: 23320f01d8ce
Revises: 16bffb744f33
Create Date: 2025-10-04 16:22:33.968337

"""

import sqlalchemy as sa
import sqlmodel.sql.sqltypes
from alembic import op

# revision identifiers, used by Alembic.
revision = "23320f01d8ce"
down_revision = "16bffb744f33"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("tripitem", schema=None) as batch_op:
        batch_op.add_column(sa.Column("paid_by", sa.Integer(), nullable=True))
        batch_op.create_foreign_key(
            batch_op.f("fk_tripitem_paid_by_user"), "user", ["paid_by"], ["username"], ondelete="SET NULL"
        )

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("tripitem", schema=None) as batch_op:
        batch_op.drop_constraint(batch_op.f("fk_tripitem_paid_by_user"), type_="foreignkey")
        batch_op.drop_column("paid_by")

    # ### end Alembic commands ###
