Use Diesels MultiConnections Derive #3796
Draft
+1,908
−2,926
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this PR we remove almost all custom macro's to create the multiple database type code. This is now handled by Diesel it self.
This removed the need of the following functions/macro's:
db_object!
::to_db
.from_db()
It is also possible to just use one schema instead of multiple per type.
NOTE: There are just few items which cause some issues with models and schemas having the exact same name, and that causes some ambiguity. I have solved that currently by adding
schema::
in-front of those specific items. But it would be nicer if we didn't need that though.Not sure what the best way is to address this. Probably renaming the tables is the best option i think.
I still want to do some testing with the different database types with an empty database, an existing database which needs migrations etc.. etc..
Also, we probably want to wait until Diesel releases v2.1.1, since there are currently some bugs and missing features which got fixed, but not yet merged.
And if someone else wants to help test, please do!, The more the better.