Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@tyt2y3
Copy link
Member

@tyt2y3 tyt2y3 commented Nov 11, 2025

@tyt2y3
Copy link
Member Author

tyt2y3 commented Nov 11, 2025

@ctron can you try this and see if it works for you?

use crate::common::migration::*;
use sea_orm_migration::{MigratorTraitSelf, prelude::*};

pub struct Migrator {
    pub i: i32,
}

#[async_trait::async_trait]
impl MigratorTraitSelf for Migrator {
    fn migrations(&self) -> Vec<Box<dyn MigrationTrait>> {
        vec![
            Box::new(m20220118_000001_create_cake_table::Migration),
            Box::new(m20220118_000002_create_fruit_table::Migration),
        ]
    }
}
[patch.crates-io]
sea-orm-migration = { git = "https://github.com/SeaQL/sea-orm", branch = "migrator-self" }

@ctron
Copy link

ctron commented Nov 12, 2025

I won't be able to actually try it out this week. But taking a quick look, that looks very promising. As the MigrationTrait already uses self, I should be able to pass in arguments to the actual migration. And so that should work!

@tyt2y3
Copy link
Member Author

tyt2y3 commented Nov 12, 2025

thanks, please give it a try and let me know. want to have some user feedback before merging this in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants