diff --git a/src/backend/langflow/alembic/versions/67cc006d50bf_add_profile_image_column.py b/src/backend/langflow/alembic/versions/67cc006d50bf_add_profile_image_column.py new file mode 100644 index 000000000..5a3cbc448 --- /dev/null +++ b/src/backend/langflow/alembic/versions/67cc006d50bf_add_profile_image_column.py @@ -0,0 +1,39 @@ +"""Add profile-image column + +Revision ID: 67cc006d50bf +Revises: 260dbcc8b680 +Create Date: 2023-09-08 07:36:13.387318 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa +import sqlmodel + + +# revision identifiers, used by Alembic. +revision: str = "67cc006d50bf" +down_revision: Union[str, None] = "260dbcc8b680" +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! ### + with op.batch_alter_table("user", schema=None) as batch_op: + batch_op.add_column( + sa.Column( + "profile_image", sqlmodel.sql.sqltypes.AutoString(), nullable=True + ) + ) + + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table("user", schema=None) as batch_op: + batch_op.drop_column("profile_image") + + # ### end Alembic commands ### diff --git a/src/backend/langflow/services/database/models/user/user.py b/src/backend/langflow/services/database/models/user/user.py index b58f7226a..105f6281b 100644 --- a/src/backend/langflow/services/database/models/user/user.py +++ b/src/backend/langflow/services/database/models/user/user.py @@ -15,6 +15,7 @@ class User(SQLModelSerializable, table=True): id: UUID = Field(default_factory=uuid4, primary_key=True, unique=True) username: str = Field(index=True, unique=True) password: str = Field() + profile_image: Optional[str] = Field(default=None) is_active: bool = Field(default=False) is_superuser: bool = Field(default=False) create_at: datetime = Field(default_factory=datetime.utcnow) @@ -40,6 +41,7 @@ class UserRead(SQLModel): class UserUpdate(SQLModel): + profile_image: Optional[str] = Field() password: Optional[str] = Field() is_active: Optional[bool] = Field() is_superuser: Optional[bool] = Field()