3 saved_track_data
Anna Schumaker edited this page 2023-10-23 10:19:03 -04:00

The saved_track_data table is used to preserve track data when tracks are deleted and restore the values if a track with the same mbid is later added. This lets us handle renaming files without losing the user's playback statistics. Note that this only works for tracks that have an MBID.

Columns

The added column was added to the table in schema version 2.

Name Type Default Description
mbid TEXT The MusicBrainz ID of the track
favorite BOOLEAN FALSE The favorite status of the track
playcount INTEGER 0 The playcount of the track
lastplayed TIMESTAMP NULL The last played timestamp of the track
laststarted TIMESTAMP NULL The last started timestamp of the track
added DATE NULL The date the track was originally added to the database

Triggers

Name When Description
tracks_delete_save Before delete Insert the appropriate fields into the saved_tracks_data table
tracks_insert_restore After insert Update the tracks table with fields from the saved_tracks_data