ODM2DataSharingPortal
ODM2DataSharingPortal copied to clipboard
Unsafe deletions from database
So.. it's possible to delete an instrument_output_variable that is currently in use at a site. It is also possible to create a new result with an instrument_output_variable that doesn't exist. These are not good thing.
Back story: Someone requested that they be able to add Decagon CTD temperature in Fahrenheit. I was pretty sure that was already an option, but decided to check the instrument_output_variables table on the "Admin" page just to be sure but did not see any CTD output in F in that table. But I've created LOTS of sites with CTD's and I knew I'd been picking between C and F in the drop down so I tried to add a new sensor and, low and behold, I get the option of Fahrenheit - which shouldn't exist!
It's happening because of the separated "dataloader" and "odm2" databases. The options for filling out the dataloader tables are derived from the odm2 database, but not actually in sync with them. There is a command (generate sensor outputs) that adds options to for possible results in the dataloader table - but there's no "deletion" that happens. If you delete from the ODM2 side (as in, with the Admin page) that delete is never promulgated down the chain. In the case of the CTD, I'd gotten sick of having to choose C or F so I'd deleted F as an option, but only on the ODM2 side. At the time when F still appeared, I just grumbled but didn't think much of it.
Anyway, now that I'm looking into it, there need to be safe deletion rules and better checking of links between the two databases.