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

Add Bulk Anchor Delete Functions #712

Merged
merged 1 commit into from
Mar 14, 2023

Conversation

Mythicaeda
Copy link
Contributor

Description

Added Hasura functions that accept an array of activity_ids and a plan_id and deletes all of the activities one at a time while handling their anchors with the specified resolution. Created so that the UI only needs to send a maximum of 4 requests when a user bulk deletes activity directives: one for each anchor resolution type and the default delete.

Having the validate_anchors_update_trigger run immediately during the function has it run per-statement instead of per-transaction, which avoids a foreign key violation that occurs if an activity is both updated and deleted during a function (ie, the input is {anchor, activity} to delete_activity_by_pk_reanchor_plan_start_bulk. activity will be updated when anchor is processed and then deleted when it is processed.)

Note regarding what these functions return: If an activity is both updated and deleted, or updated multiple times, there will be a row returned for each change.

Verification

Manually tested the functions and had no issues with running them or with the Hasura metadata.

@Mythicaeda Mythicaeda added the database Anything related to the database label Mar 3, 2023
@Mythicaeda Mythicaeda requested a review from a team as a code owner March 3, 2023 20:43
@Mythicaeda Mythicaeda self-assigned this Mar 3, 2023
@Mythicaeda Mythicaeda requested review from camargo and mattdailis March 3, 2023 20:43
@Mythicaeda Mythicaeda temporarily deployed to e2e-test March 3, 2023 20:43 — with GitHub Actions Inactive
@Mythicaeda Mythicaeda requested a review from duranb March 3, 2023 20:43
@Mythicaeda Mythicaeda force-pushed the feat/add-bulk-anchor-resolution-fns branch from 742c54d to 947cf29 Compare March 4, 2023 00:31
@Mythicaeda Mythicaeda temporarily deployed to e2e-test March 4, 2023 00:31 — with GitHub Actions Inactive
@Mythicaeda Mythicaeda temporarily deployed to e2e-test March 4, 2023 00:31 — with GitHub Actions Inactive
@Mythicaeda Mythicaeda temporarily deployed to e2e-test March 4, 2023 00:31 — with GitHub Actions Inactive
@Mythicaeda Mythicaeda force-pushed the feat/add-bulk-anchor-resolution-fns branch from 947cf29 to 2694e7a Compare March 14, 2023 18:16
@Mythicaeda Mythicaeda temporarily deployed to e2e-test March 14, 2023 18:16 — with GitHub Actions Inactive
@Mythicaeda Mythicaeda temporarily deployed to e2e-test March 14, 2023 18:16 — with GitHub Actions Inactive
@Mythicaeda Mythicaeda temporarily deployed to e2e-test March 14, 2023 18:16 — with GitHub Actions Inactive
@Mythicaeda Mythicaeda merged commit 847770e into develop Mar 14, 2023
@Mythicaeda Mythicaeda deleted the feat/add-bulk-anchor-resolution-fns branch March 14, 2023 18:41
@camargo camargo added the refactor A code change that neither fixes a bug nor adds a feature label Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Anything related to the database refactor A code change that neither fixes a bug nor adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add bulk deletion versions of the existing queries for activity directives with anchors
2 participants