-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#192] Add updated_by column n implement updated_by in update case
endpoint
- Loading branch information
1 parent
073ff85
commit 652e071
Showing
5 changed files
with
86 additions
and
5 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
backend/alembic/versions/2024_01_05_0404-9bafa33c5c7e_add_updated_by_column_to_case_table.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,42 @@ | ||
"""add updated_by column to case table | ||
Revision ID: 9bafa33c5c7e | ||
Revises: c50aa947afb3 | ||
Create Date: 2024-01-05 04:04:12.817493 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "9bafa33c5c7e" | ||
down_revision: Union[str, None] = "c50aa947afb3" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.add_column( | ||
"case", | ||
sa.Column( | ||
"updated_by", sa.Integer(), sa.ForeignKey("user.id"), nullable=True | ||
), | ||
) | ||
op.create_foreign_key( | ||
"case_updated_by_user_constraint", | ||
"case", | ||
"user", | ||
["updated_by"], | ||
["id"], | ||
ondelete="CASCADE", | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_constraint( | ||
"case_updated_by_user_constraint", "case", type_="foreignkey" | ||
) | ||
op.drop_column("case", "updated_by") |
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
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