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 function for deleting an event (and all it's related information) #166

Open
evamaxfield opened this issue Feb 17, 2022 · 3 comments
Open
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@evamaxfield
Copy link
Member

Feature Description

A clear and concise description of the feature you're requesting.

Add a function and script that will remove all of a single events details

Use Case

Please provide a use case to help us understand your request in context.

If an event processes incorrectly (or just from bad data) it would be useful to remove it easily.
An example of where I personally have made a mistake on uploading of events with bad data can be seen here: http://councildataproject.org/self/#/events/8ce513a84175

That event should actually be two events, each with a single session but because I uploaded two meetings with the same body name and the exact same datetime, the second event was added to the first event as a second session.

Solution

Please describe your ideal solution.

A function (and bin script) that will delete a provided event id and all related info under conditions:

  • for each session related to the event
    • delete the transcripts for each session (and the files in storage)
  • delete the event body (if it isn't used by any other event)
  • delete thumbnail file references (and the files in storage)
  • for each event minutes items related to the event
    • delete the referenced minutes item if it isn't used in any other event
    • delete the referenced matter if it isn't used in any other event
    • delete all the matter files if matter / minutes item was used in any other event
    • delete all event minutes item files
    • delete any matter status updates that are referenced to the event minutes item
    • for each vote related to the event minutes item:
      • delete any people (and their roles) that do not have votes on any other event
      • delete the picture file in db and the stored picture file
      • for each role:
        • delete the seat if it is not used by any other person
        • delete the seat image ref and the store image file from storage
      • delete any votes that link to the event / event minutes item
    • delete the event minutes item itself
  • delete any indexed event grams linked to event
  • delete any matter sponsers for matter refs OR people that no longer exist after all of the above
  • delete the event itself

I think I got everything??? schema here

Alternatives

Please describe any alternatives you've considered, even if you've dismissed them.

@evamaxfield evamaxfield added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed and removed good first issue Good for newcomers labels Feb 17, 2022
@isaacna
Copy link
Collaborator

isaacna commented Feb 18, 2022

Seeing this makes me think that a top down database structure would make this a lot easier... But I think bottom-up makes it easier to just move this layout to a RDBMS in the future if we want to do that?

@evamaxfield
Copy link
Member Author

Yea I mean, a lot of this would just be handled if we used postgres or something because of "actual" foreign keys instead of our weird hacked together relational model. But it's the best we got for now 🤷‍♀️

@conantp
Copy link
Contributor

conantp commented Mar 4, 2023

I'm going to work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants