uselagoon / lagoon

Lagoon, the developer-focused application delivery platform
https://docs.lagoon.sh/
Apache License 2.0
552 stars 149 forks source link

Clean up insights data on environment deletion #3630

Closed bomoko closed 6 months ago

bomoko commented 7 months ago

Right now, when deleting an environment, there is nothing to clean up facts and problems that have been registered against that environment.

The really big problem here (beyond the fact that we're not cleaning up data) is with multiple PR/ephemeral environments, if they're running insights, there is potentially a lot of insights information that is not even of any historical value.

This PR adds two things

  1. Calls to queries that will clean up the appropriate facts and problems entries.
  2. Adds a migration to remove any existing data that should be removed from the DB.

General Checklist

Database Migrations