diff --git a/gdshowreelvote/database.py b/gdshowreelvote/database.py index 8d5dd42..1d7ce34 100644 --- a/gdshowreelvote/database.py +++ b/gdshowreelvote/database.py @@ -34,7 +34,7 @@ class User(DB.Model): id: Mapped[str] = mapped_column(String(KEYCLOAK_ID_SIZE), primary_key=True, autoincrement=False) email: Mapped[str] = mapped_column(String(128), unique=True, nullable=False) - username: Mapped[str] = mapped_column(String(150), unique=True, nullable=True) + username: Mapped[str] = mapped_column(String(150), unique=False, nullable=True) is_staff: Mapped[bool] = mapped_column(Boolean, default=False) is_active: Mapped[bool] = mapped_column(Boolean, default=True) diff --git a/migrations/versions/7c6cc24c9d34_.py b/migrations/versions/7c6cc24c9d34_.py new file mode 100644 index 0000000..5055b87 --- /dev/null +++ b/migrations/versions/7c6cc24c9d34_.py @@ -0,0 +1,32 @@ +"""empty message + +Revision ID: 7c6cc24c9d34 +Revises: 727eb738db92 +Create Date: 2026-08-05 12:54:04.147726 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '7c6cc24c9d34' +down_revision = '727eb738db92' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('users', schema=None) as batch_op: + batch_op.drop_constraint(batch_op.f('uq_users_username'), type_='unique') + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('users', schema=None) as batch_op: + batch_op.create_unique_constraint(batch_op.f('uq_users_username'), ['username']) + + # ### end Alembic commands ###