fleet/changes/21654-install-details
Ian Littman bbac39f22a
Ensure software installs aren't deleted, and have enough info to display, even if associated installer or title are deleted (#22996)
#21654 #22087

Also persists title/installer filename/version to the install record in
case those are edited, though we'll continue showing the current title
name when pulling the install record at this point, and don't expose
installed version anywhere for now.

# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files)
for more information.
- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] Added/updated tests
- [x] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [x] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [x] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects. (**force-set updated_at to avoid**)
- [x] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [x] Manual QA for all new/changed functionality
2024-10-21 17:46:50 -05:00

14 lines
No EOL
989 B
Text

* Ensure details for a software installation run are available and accurate even after the corresponding installer has been edited or deleted
NOTE: The database migration included with this update backfills installer data into installation details based on the currently uploaded installer. To backfill data from activities (which will be more comprehensive and accurate than the migration default, but may take awhile as the entire activities table will be scanned), run this database query _after_ running database migrations:
```sql
UPDATE host_software_installs i
JOIN activities a ON a.activity_type = 'installed_software'
AND i.execution_id = a.details->>"$.install_uuid"
SET i.software_title_name = COALESCE(a.details->>"$.software_title", i.software_title_name),
i.installer_filename = COALESCE(a.details->>"$.software_package", i.installer_filename),
i.updated_at = i.updated_at
```
The above query is optional, and is unnecessary if no software installers have been edited.