Skip to content

Commit

Permalink
username field removed from users table
Browse files Browse the repository at this point in the history
  • Loading branch information
nrjadkry committed Jul 10, 2024
1 parent 6288f48 commit 34295b2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/backend/app/db/db_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ class DbUser(Base):
__tablename__ = "users"

id = cast(str, Column(String, primary_key=True))
username = cast(str, Column(String, nullable=False, unique=True))
email_address = cast(str, Column(String, nullable=False, unique=True))
password = cast(str, Column(String))
name = cast(str, Column(String))
is_active = cast(bool, Column(Boolean, default=False))
is_superuser = cast(bool, Column(Boolean, default=False))
profile_img = cast(str, Column(String, nullable=True))
name = cast(str, Column(String))
email_address = cast(str, Column(String, nullable=False, unique=True))
date_registered = cast(datetime, Column(DateTime, default=timestamp))


Expand Down
35 changes: 35 additions & 0 deletions src/backend/app/migrations/versions/88ae62ec8876_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""
Revision ID: 88ae62ec8876
Revises: 3293e9c98b2a
Create Date: 2024-07-10 05:21:58.749137
"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = "88ae62ec8876"
down_revision: Union[str, None] = "3293e9c98b2a"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint("users_username_key", "users", type_="unique")
op.drop_column("users", "username")
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"users",
sa.Column("username", sa.VARCHAR(), autoincrement=False, nullable=False),
)
op.create_unique_constraint("users_username_key", "users", ["username"])
# ### end Alembic commands ###

0 comments on commit 34295b2

Please sign in to comment.