Fix issues in schema, clean up shell scripts a little

Schema fixes and commenting out of some constraints to make it run successfully on new database.

Updated db-*.sh scripts to use PG* environment variables for settings.