Donders-Institute / data-streamer

A service and web UI for managing lab data flowing to the DCCN project storage and the Donders Repository
https://uploader.dccn.nl
MIT License
1 stars 3 forks source link

As an administrator I want to purge the old data in the streamer UI database #214

Closed aardkronkel closed 4 years ago

aardkronkel commented 4 years ago

so I have the data of last week still available to me. Currently, the purge command wipes all tabular data, using the following SQL statement:

TRUNCATE TABLE uploadsession, uploadfile

Implement the following end points:

/api/purge/all   (wipe all table data, i.e. using the SQL statement above)
/api/purge        (wipe old data, i.e. using the SQL statement below)

The following SQL statement is proposed to remove the old data:

DELETE FROM uploadsession WHERE DATE_TRUNC('day', start_time) = CURRENT_DATE - interval '7 days'; 
DELETE FROM uploadfile WHERE upload_session_id NOT IN (SELECT id FROM uploadsession);
aardkronkel commented 4 years ago

Fixed in release 3.0.2