Refactoed psql schema creation