acm-site/migrations/versions/300f24071c14_add_microsoft_guid_to_user_model.py
Cara Salter 5b1d41eb58
Don't key off of email for login
Let's not emulate the rest of WPI's shitty login system that doesn't
deal with name changes

This also opens us to up to making it significantly easier to update
names and emails, if they don't match on login but ID matches. Will file
bug to implement this, though it'll be hard to test

Note that this is a BREAKING CHANGE, the database will need to be
cleared before applying migrations will succeed
2024-04-06 10:20:30 +11:00

34 lines
944 B
Python

"""add microsoft GUID to user model
Revision ID: 300f24071c14
Revises: 4fa893cdd432
Create Date: 2024-04-06 10:15:35.146272
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '300f24071c14'
down_revision = '4fa893cdd432'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('acm_users', schema=None) as batch_op:
batch_op.add_column(sa.Column('microsoft_id', sa.String(), nullable=False))
batch_op.create_unique_constraint(None, ['microsoft_id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('acm_users', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='unique')
batch_op.drop_column('microsoft_id')
# ### end Alembic commands ###