-
-
Notifications
You must be signed in to change notification settings - Fork 552
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
sea-orm-cli: Entity generation fails if column name is a reserved keyword #217
Milestone
Comments
Example included in https://www.sea-ql.org/SeaORM/blog#rename-column-name--column-enum-variant mod my_entity {
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "my_entity")]
pub struct Model {
#[sea_orm(primary_key, enum_name = "IdentityColumn", column_name = "id")]
pub id: i32,
#[sea_orm(column_name = "type")]
pub type_: String,
}
//...
}
assert_eq!(my_entity::Column::IdentityColumn.to_string().as_str(), "id");
assert_eq!(my_entity::Column::Type.to_string().as_str(), "type"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I am very excited by this project, and I think the work you're doing is amazing.
I encountered a problem, when I was trying to use
sea-orm-cli
to generate entities. I got an error as one of the columns in my database was namedtype
which is a reserved keyword.rustc
suggest fixing it by writingr#type
instead in the generated code.Keep up the great work!
The text was updated successfully, but these errors were encountered: