-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adding constraints for multiple auth methods (#531)
- Loading branch information
Showing
3 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
backend/alembic/versions/6f14afa8ea47_update_auth_models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"""Update User and OAuthAccount models | ||
Revision ID: 6f14afa8ea47 | ||
Revises: 397feb4e1315 | ||
Create Date: 2024-02-19 17:43:45.473226+01:00 | ||
""" | ||
import fastapi_users_db_sqlalchemy.generics # noqa | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "6f14afa8ea47" | ||
down_revision = "397feb4e1315" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column( | ||
"caseinfo", | ||
"diseases", | ||
existing_type=postgresql.JSONB(astext_type=sa.Text()), | ||
type_=sa.JSON(), | ||
existing_nullable=True, | ||
) | ||
op.alter_column( | ||
"caseinfo", | ||
"hpo_terms", | ||
existing_type=postgresql.JSONB(astext_type=sa.Text()), | ||
type_=sa.JSON(), | ||
existing_nullable=True, | ||
) | ||
op.create_unique_constraint(None, "oauth_account", ["oauth_name", "user_id"]) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint(None, "oauth_account", type_="unique") | ||
op.alter_column( | ||
"caseinfo", | ||
"hpo_terms", | ||
existing_type=sa.JSON(), | ||
type_=postgresql.JSONB(astext_type=sa.Text()), | ||
existing_nullable=True, | ||
) | ||
op.alter_column( | ||
"caseinfo", | ||
"diseases", | ||
existing_type=sa.JSON(), | ||
type_=postgresql.JSONB(astext_type=sa.Text()), | ||
existing_nullable=True, | ||
) | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters