Replies: 2 comments
-
Going through the code, one could add a new config to This could passed into the function here: diesel/diesel_cli/src/infer_schema_internals/foreign_keys.rs Lines 39 to 50 in 7629365 Which would then check that if the table doesn't exist, but is in the That wouldn't be enough to make it work yet, as the |
Beta Was this translation helpful? Give feedback.
-
As you already noticed that's something that is currently not supported by diesel cli. I'm open to add something there, but it's unclear for me how exactly that would look like to keep it general and usable. Unfortunately I do not have any capacity for such design work at the moment so such a proposal would need to be written by someone else. That written: There is one other approach you could try: Putting the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Heya! 👋
I'm currently trying to refactor an application I am building into multiple pieces. One of those pieces can be shared with other apps I am writing.
So I was hoping I could do the naive thing of:
I did run into some problems though, mostly related to generating the schema.
I was hoping I could:
diesel migration run --migration-dir ../common/migrations
diesel.toml
the generation of tables that come from thecommon
crateBut this also causes the
join!
and related macros to not be generated. Which makes sense, they don't have the needed tables.I was able to still get it working by manually writing those join lines and adding a
pub(crate) use common::schema::*
at the top of the file.My question to the community/maintainers is then, am I missing something here that could make this a bit less manual?
I was hoping I could say 'exclude generation of the
table!
but keep the joins', but its either/or. Similarly, adding the use at the of the file. I was hoping that 'import-types' would do the trick, but that seems to be mostly for SQLTypes-related things.I was thinking of some additions that wouldn't be just for my specific usecase (and would offer help implementing them) akin to:
The latter is not suuper important, as patch files are fairly robust about inserting things at the top. So that's not a biggie. But allowing generation of join macros would be a big help in reducing patch mismatches and otherwise confusing messages.
Beta Was this translation helpful? Give feedback.
All reactions