diff --git a/alembic/env.py b/alembic/env.py index 414b2103..4e1805af 100644 --- a/alembic/env.py +++ b/alembic/env.py @@ -117,7 +117,7 @@ signature="update_family_last_modified", on_entity="public.family_document", definition=""" - BEFORE INSERT OR UPDATE OR DELETE ON public.family_document + AFTER INSERT OR UPDATE OR DELETE ON public.family_document FOR EACH ROW EXECUTE PROCEDURE public.update_2_family_last_modified() """, @@ -139,7 +139,7 @@ signature="update_family_last_modified", on_entity="public.family_event", definition=""" - BEFORE INSERT OR UPDATE OR DELETE ON public.family_event + AFTER INSERT OR UPDATE OR DELETE ON public.family_event FOR EACH ROW EXECUTE PROCEDURE public.update_2_family_last_modified() """, @@ -162,7 +162,7 @@ signature="update_collection_last_modified ", on_entity="public.collection_family", definition=""" - BEFORE INSERT OR UPDATE OR DELETE ON public.collection_family + AFTER INSERT OR UPDATE OR DELETE ON public.collection_family FOR EACH ROW EXECUTE PROCEDURE public.update_2_collection_last_modified() """, diff --git a/alembic/versions/0025_fixed_event_trigger_that_was_preventing_.py b/alembic/versions/0025_fixed_event_trigger_that_was_preventing_.py new file mode 100644 index 00000000..2cdf7de6 --- /dev/null +++ b/alembic/versions/0025_fixed_event_trigger_that_was_preventing_.py @@ -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 ###