Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add last modified field for all entities #187

Merged
merged 17 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
""",
Expand All @@ -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()
""",
Expand All @@ -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()
""",
Expand Down
102 changes: 102 additions & 0 deletions alembic/versions/0025_fixed_event_trigger_that_was_preventing_.py
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 ###
Loading