To run this, you'll need a postgres user with perms to create schema, perhaps using the following (as postgres user)
CREATE DATABASE spttest;
CREATE USER spttest WITH PASSWORD 'spttest' SUPERUSER CREATEDB INHERIT LOGIN; GRANT ALL PRIVILEGES ON DATABASE spttest to spttest;
I'm running in a linux environment, which seems to have some separate issues with case sensitivity around schema names in the interaction between SchemaHandler and groovy.org.grails.orm.hibernate.HibernateDatastore . The test app works around that by providing a custom SchemaHandler that sets up 2 explicit schemas/tenants (test1 and test2) instead of enumerating the schemas via JDBC.
What I'm seeing is that the app starts up, but creates the book table only in the public schema, rather than 2 separate tables in each schema. My implementation of SchemaHandler is overriding useSchema to use the postgres variant
useSchemaStatement = "SET search_path TO %s,public"
I'm wondering if
(a) anyone can see what I'm doing wrong?
(b) suggest a way of fixing it (I'm happy to help) and
(c) I'd actually like to try and dig into this a little myself - are there any guides to setting up a tool like intellij to be able to breakpoint / debug step into the framework code. Going to have a play with this, but any shortcuts would be most welcome.
(d) I've put the MultiTenant trait on the domain class - not sure this is needed for Schema per tenant?
 Currently Line 407 https://github.com/grails/gorm-hibernate5/blob/master/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/HibernateDatastore.java - I think