Update database structure to prevent duplicate variables 

- Fix measurements 
Add tools for automatic conversion and rebuild