"""updating user model to include company id and company name

Revision ID: e66bac2c3d0d
Revises: 6f10a7fb1911
Create Date: 2024-08-02 15:58:14.405888

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'e66bac2c3d0d'
down_revision = '6f10a7fb1911'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('user', schema=None) as batch_op:
        batch_op.add_column(sa.Column('company_id', sa.Integer(), nullable=True))
        batch_op.drop_constraint('fk_user_company', type_='foreignkey')
        batch_op.create_foreign_key(batch_op.f('fk_user_company_id_company'), 'company', ['company_id'], ['id'])

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('user', schema=None) as batch_op:
        batch_op.drop_constraint(batch_op.f('fk_user_company_id_company'), type_='foreignkey')
        batch_op.create_foreign_key('fk_user_company', 'company', ['company_name'], ['id'])
        batch_op.drop_column('company_id')

    # ### end Alembic commands ###
