-
-
Notifications
You must be signed in to change notification settings - Fork 528
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
Insert with Custom column Id
doesn't work
#621
Comments
Hey @itsbalamurali, welcome! I can't reproduce your error. Can you show me your entity file? use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "metadata")]
pub struct Model {
#[sea_orm(primary_key, column_name = "Uuid", auto_increment = false)]
pub uuid: Uuid,
#[sea_orm(column_name = "type", enum_name = "Type")]
pub ty: String,
pub key: String,
pub value: String,
pub bytes: Vec<u8>,
pub date: Option<Date>,
pub time: Option<Time>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
impl ActiveModelBehavior for ActiveModel {} let metadata = metadata::Model {
uuid: Uuid::new_v4(),
ty: "Type".to_owned(),
key: "markup".to_owned(),
value: "1.18".to_owned(),
bytes: vec![1, 2, 3],
date: Some(Date::from_ymd(2021, 9, 27)),
time: Some(Time::from_hms(11, 32, 55)),
};
let result = metadata.clone().into_active_model().insert(db).await?; INSERT INTO "metadata" ("Uuid", "type", "key", "value", "bytes", "date", "time")
VALUES ('0b2e6e69-7d2b-43ad-968e-8eb60dd54a26', 'Type', 'markup', '1.18', '010203', '2021-09-27', '11:32:55')
RETURNING "Uuid", "type", "key", "value", "bytes", "date", "time" |
Your column name is not "Id", so you're not even testing the same bug. Perhaps there is accidentally some special case handling for "id" columns? |
This sounds like a bug in how we handle the |
Can I pick this issue if it's free? |
@KaviiSuri sure, that'd definitely be appreciated |
Thanks, can you tell me where should I start looking? Would love a little guidance! |
Well I think reproducing the issue in a test case would be the first step |
Fixed on #694 |
Description
Insert with Custom column
Id
doesn't work.I have an entity with a custom column name
Id
instead ofid
.Steps to Reproduce
Expected Behavior
The above should generate
Actual Behavior
Causing:
Reproduces How Often
Always.
Versions
OS: MacOSx.
Database: PostgreSQL 13.
The text was updated successfully, but these errors were encountered: