8000 How do you seed data in migrations using ActiveModels? · Issue #522 · SeaQL/sea-orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
How do you seed data in migrations using ActiveModels? #522
Closed
SeaQL/sea-schema
#49
@billy1624

Description

@billy1624

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'.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0