Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MRE for 1778 #1779

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

MRE for 1778 #1779

wants to merge 4 commits into from

Conversation

junbl
Copy link
Contributor

@junbl junbl commented Jul 24, 2023

@@ -0,0 +1,31 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting. But can you update to the latest sea-orm-cli version and check the result? Preferably 0.12.rc-5

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, yep—I originally did it with 0.11 and regenerated for this example. Will try it with 0.12.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reran with the latest version on master, which was 0.12.rc-4. Couldn't find a branch or anything for rc-5.

I also moved the files around into a separate module per schema (had mistakenly overwritten one mod/prelude with the other so the error looked the same), since that's the way my actual entities are organized, but I'm realizing I don't think that's standardized by sea-orm in any way I know of. Not sure if I got the idea of separating the schemata like that from an example of y'all's or if I just made that up.

If that is the intended organization (entity::schema::table::model), then I was thinking it should just have gone one level up (like super::super::src::src::id) but if it's not then that won't work in general. I guess the only like real danger with the current behavior is if you had a table with the same name in each schema, then the foreign key wouldn't give the compile error since it would resolve, just to the wrong table.

Copy link
Member

@tyt2y3 tyt2y3 Jul 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://crates.io/crates/sea-orm-cli/0.12.0-rc.5 rc.5 was just released a few days ago

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@tyt2y3
Copy link
Member

tyt2y3 commented Jul 25, 2023

Thanks for helping out. A brief investigation says that we currently don't have a concept of "multiple schemas" in the codegen. And actually, inside SeaSchema, we are not capturing the key_column_usage.table_schema either. So we need to take care of this first.

However, a bigger question might be how actually we'd organize a multi-schema entity workspace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants