-
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.
Updated triggers on child entities that were preventing deletion (#187)
- Loading branch information
1 parent
6f9ce33
commit c389011
Showing
2 changed files
with
105 additions
and
3 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
102 changes: 102 additions & 0 deletions
102
alembic/versions/0025_fixed_event_trigger_that_was_preventing_.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,102 @@ | ||
""" | ||
Fixed event trigger that was preventing event deletion | ||
Revision ID: 0025 | ||
Revises: 0024 | ||
Create Date: 2023-11-29 13:53:59.518084 | ||
""" | ||
from alembic_utils.pg_trigger import PGTrigger | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "0025" | ||
down_revision = "0024" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
public_family_document_update_family_last_modified = PGTrigger( | ||
schema="public", | ||
signature="update_family_last_modified", | ||
on_entity="public.family_document", | ||
is_constraint=False, | ||
definition=""" | ||
AFTER INSERT OR UPDATE OR DELETE ON public.family_document | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE public.update_2_family_last_modified() | ||
""", | ||
) | ||
op.replace_entity(public_family_document_update_family_last_modified) # type: ignore | ||
|
||
public_family_event_update_family_last_modified = PGTrigger( | ||
schema="public", | ||
signature="update_family_last_modified", | ||
on_entity="public.family_event", | ||
is_constraint=False, | ||
definition=""" | ||
AFTER INSERT OR UPDATE OR DELETE ON public.family_event | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE public.update_2_family_last_modified() | ||
""", | ||
) | ||
op.replace_entity(public_family_event_update_family_last_modified) # type: ignore | ||
|
||
public_collection_family_update_collection_last_modified = PGTrigger( | ||
schema="public", | ||
signature="update_collection_last_modified", | ||
on_entity="public.collection_family", | ||
is_constraint=False, | ||
definition=""" | ||
AFTER INSERT OR UPDATE OR DELETE ON public.collection_family | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE public.update_2_collection_last_modified() | ||
""", | ||
) | ||
op.replace_entity(public_collection_family_update_collection_last_modified) # type: ignore | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
public_collection_family_update_collection_last_modified = PGTrigger( | ||
schema="public", | ||
signature="update_collection_last_modified", | ||
on_entity="public.collection_family", | ||
is_constraint=False, | ||
definition=""" | ||
AFTER INSERT OR UPDATE OR DELETE ON public.collection_family | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE public.update_2_collection_last_modified() | ||
""", | ||
) | ||
op.replace_entity(public_collection_family_update_collection_last_modified) # type: ignore | ||
public_family_event_update_family_last_modified = PGTrigger( | ||
schema="public", | ||
signature="update_family_last_modified", | ||
on_entity="public.family_event", | ||
is_constraint=False, | ||
definition=""" | ||
AFTER INSERT OR UPDATE OR DELETE ON public.family_event | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE public.update_2_family_last_modified() | ||
""", | ||
) | ||
op.replace_entity(public_family_event_update_family_last_modified) # type: ignore | ||
public_family_document_update_family_last_modified = PGTrigger( | ||
schema="public", | ||
signature="update_family_last_modified", | ||
on_entity="public.family_document", | ||
is_constraint=False, | ||
definition=""" | ||
AFTER INSERT OR UPDATE OR DELETE ON public.family_document | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE public.update_2_family_last_modified() | ||
""", | ||
) | ||
op.replace_entity(public_family_document_update_family_last_modified) # type: ignore | ||
# ### end Alembic commands ### |