Closed LBeaulaton closed 2 years ago
Here is a solution to implement a check in the db: first we change the type of a value from Spain (check with Esti first) and then remove data that were aquaculture for restocking, and finally add a check on eel_typ_id!=12
--to be checked with Esti, I think that the type is aquaculture_kg not aquaculture_number (anyway, it is declared at the emu scale not at the country scale so no valid)
update datawg.t_eelstock_eel set eel_typ_id =11, eel_qal_id=20,
eel_comment ='type corrected in 2020' where eel_typ_id =12 and eel_year=2014 and eel_emu_nameshort ='ES_Vale' and eel_lfs_code='OG' and eel_hty_code='MO'
--other data correspond to restocking so should not be in the db
delete from datawg.t_eelstock_eel where eel_typ_id=12;
ALTER TABLE datawg.t_eelstock_eel ADD CONSTRAINT ck_removed_typid CHECK (eel_typ_id != 12);
In loading_functions, we have
to highlight such problem. Do we need to add a constraint in the db?