Parameterized migration templates for database multi-tenancy customization #3772
kriswuollett
started this conversation in
Ideas
Replies: 1 comment
-
There is no need to include this feature into diesel itself, as |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If something like multiple migration tables is possible as asked about in #3771, then it is possible to run multiple copies of an database application on a single instance. This can greatly help with development ease and cost savings to do things like multi-tenancy for clients or ephemeral instances.
Maybe be implemented with a devex as simple as having files with extension
.sql.hbs
in the migrations dir that are auto-detected to be processed withhandlebars-rust
. The cli and api would then need a parameter to pass in the structured data (HashMap<String, serde_json::Value)
). And probably some contributed handlebars helpers with database identifiers may be useful.It could be argued that the checked in code is no longer the source of truth of the migrations, but it isn't even guaranteed that one is using source code control properly in the first place. Just like it is developers responsibility for roles and access control in #3771.
I'd imagine developers would want to build more on top of this by using
.env
file overlays and use their CI/CD to populate them.Beta Was this translation helpful? Give feedback.
All reactions