Skip to content

Commit

Permalink
fix: set_from_json does not set primary key
Browse files Browse the repository at this point in the history
  • Loading branch information
jondot committed Oct 23, 2024
1 parent fa84d60 commit 72b2fca
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@ where
let seed_data: Vec<serde_json::Value> = serde_yaml::from_reader(File::open(path)?)?;

for row in seed_data {
let mut model = <A as ActiveModelTrait>::default();
model.set_from_json(row)?;
let model = <A as ActiveModelTrait>::from_json(row)?;
<A as ActiveModelTrait>::Entity::insert(model)
.exec(db)
.await?;
Expand Down

0 comments on commit 72b2fca

Please sign in to comment.