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

How do you seed data in migrations using ActiveModels? #522

Closed
billy1624 opened this issue Feb 13, 2022 Discussed in #519 · 0 comments · Fixed by SeaQL/sea-schema#49
Closed

How do you seed data in migrations using ActiveModels? #522

billy1624 opened this issue Feb 13, 2022 Discussed in #519 · 0 comments · Fixed by SeaQL/sea-schema#49
Assignees

Comments

@billy1624
Copy link
Member

Discussed in #519

Originally posted by Drakota February 13, 2022
I'm trying to seed data directly inside a migration, but I'm unable to get a DatabaseConnection handle to be able to do it.

let db = manager.get_connection();

let board = board::ActiveModel {
    name: Set("Test Board".to_owned()),
    ..Default::default()
};

board.save(db).await?;

I tried something like this, but I'm getting:
the size for values of type 'dyn sea_schema::migration::sea_orm::ConnectionTrait' cannot be known at compilation time the trait 'std::marker::Sized' is not implemented for 'dyn sea_schema::migration::sea_orm::ConnectionTrait'.

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