Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upFigure out story for dynamically setting PG schemas #1045
Comments
killercup
added
the
postgres
label
Jul 26, 2017
This comment has been minimized.
|
I'm not sure I see much value in doing this over specifying the schema in the |
This comment has been minimized.
skade
commented
Aug 6, 2017
|
The recommended way of sharing a database on many SaaS and multiuser systems where you get one database assigned (such as Heroku) is assigning a schema to each deployed application. This name cannot (reasonably) be picked ahead of time, but can easily be configured as a runtime property. The use case is currently indeed this: sharing a low-tier Heroku database (which costs 50$/month) to multiple mid-traffic applications. In this case, I'd like the user to be able to pick the schema name. To my current understanding, Diesel mostly supports this through the URL trick and could better support it if it did what Rails does ( |
This comment has been minimized.
lthms
commented
Sep 8, 2018
I ran into that exact problem today. Hence, I am wondering: is there any workaround to have |
killercup commentedJul 26, 2017
While
infer_schema!and friends support postgres schemas, they only do so statically; i.e., you specify that for databasefooyou want the tables from schemabarusinginfer_schema!("postgres://foo", "bar").Another use-case for schemas is to run multiple production apps on the same database, using different schemas. And while it is possible to do this with diesel, it requires hacking around with connection URL parameters, as described by @skade in this post. It's not an indented feature, though, and thus doesn't work with
diesel setupfor example.