When I use DATABASE_URL like this: DATABASE_URL="postgres://user@localhost/mydb" #?options=-c search_path%3Dtest" both diesel print-schema and diesel migration run generate empty schema.rs.
When I use default postgres schema (without search_path) it generates normal schema.
We do not parse the database url, we just pass it down to libpq.
For diesel print-schema just use the -s flag to specify the schema, for migrations just specify the target schema as part of the migration.
Dear Weiznich, your solution wrt. print-schema is clear to me, however, what do you mean with 'just specify the target schema as part of the migration?" I do not get it - can you provide an example?
EDIT: After searching around I found it. In the diesel.toml add a new line below the print_schema section:
...
[print_schema]
file = "src/schema.rs"
schema = "MY-SCHEMA"
Details are here: http://diesel.rs/guides/configuring-diesel-cli/
Most helpful comment
Dear Weiznich, your solution wrt. print-schema is clear to me, however, what do you mean with 'just specify the target schema as part of the migration?" I do not get it - can you provide an example?
EDIT: After searching around I found it. In the diesel.toml add a new line below the print_schema section:
...
[print_schema]
file = "src/schema.rs"
schema = "MY-SCHEMA"
Details are here: http://diesel.rs/guides/configuring-diesel-cli/