-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fixed ondelete for logos and documents
- Loading branch information
1 parent
166b83e
commit 5bf0f9f
Showing
3 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
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
42 changes: 42 additions & 0 deletions
42
alembic/versions/2024-03-11_updated_projects_and_documents_tables.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 @@ | ||
"""updated projects and documents tables | ||
Revision ID: f4541e89938b | ||
Revises: 07ffc299dbad | ||
Create Date: 2024-03-11 14:44:40.749399 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "f4541e89938b" | ||
down_revision: Union[str, None] = "07ffc299dbad" | ||
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("documents_project_id_fkey", "documents", type_="foreignkey") | ||
op.create_foreign_key( | ||
None, "documents", "projects", ["project_id"], ["id"], ondelete="CASCADE" | ||
) | ||
op.drop_constraint("projects_logo_id_fkey", "projects", type_="foreignkey") | ||
op.create_foreign_key( | ||
None, "projects", "logos", ["logo_id"], ["id"], ondelete="SET NULL" | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint(None, "projects", type_="foreignkey") | ||
op.create_foreign_key( | ||
"projects_logo_id_fkey", "projects", "logos", ["logo_id"], ["id"] | ||
) | ||
op.drop_constraint(None, "documents", type_="foreignkey") | ||
op.create_foreign_key( | ||
"documents_project_id_fkey", "documents", "projects", ["project_id"], ["id"] | ||
) | ||
# ### 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