Currently an order of the object’s generation for Postgresql is incorrect. I work with Postgresql 9.2 but the same issue will exist for other versions. The roles are generated almost at the end of the script, but schema is generated at the very beginning. The problem is that schema may require an authorization associated with the role like
CREATE SCHEMA “test_schema” AUTHORIZATION "test_application_admin"
This statement will fail because role “test_application_admin” wasn’t yet created. I suggest to create roles first, but to leave a section that grants permissions to the roles at the end of the DDL script.
The second problem is that script tries to create without pre-existence check even standard and pre-defined schemas and roles like
CREATE SCHEMA “public” AUTHORIZATION “postgres”
CREATE SCHEMA “pg_catalog”
CREATE ROLE “postgres” LOGIN
These statements will just generate error messages.