add integrity constraints to the database and suport to environment vari...

...ables