sea-orm icon indicating copy to clipboard operation
sea-orm copied to clipboard

sea-orm-cli migrate up can only apply 1 migration

Open ringrid opened this issue 3 years ago • 2 comments

sea-orm-cli version: 0.9.2 sea-orm-cli migrate up can only apply 1 pending migration, how does it apply all ?

ringrid avatar Aug 30 '22 09:08 ringrid

I think the sea-orm-cli migrate up only applies 1 pending migration. The source code of the up command has a default value 1 for the num option:

#[clap(about = "Apply pending migrations")]
Up {
    #[clap(
        value_parser,
        short,
        long,
        default_value = "1",
        help = "Number of pending migrations to apply"
    )]
    num: u32,
},
#[clap(value_parser, about = "Rollback applied migrations")]
 Down {
    #[clap(
        value_parser,
        short,
        long,
        default_value = "1",
        help = "Number of applied migrations to be rolled back"
    )]
    num: u32,
},

The documentation is wrong on this one. As it stands, I think there is no way to migrate all pending migrations using the cli.

ctfdavis avatar Aug 31 '22 13:08 ctfdavis

Hey @ringrid @ctfdavis, the intended behaviour is that sea-orm-cli migrate up should apply all pending migration. While sea-orm-cli migrate up -n 1 only apply the first pending migration.

As a temporary workaround: execute sea-orm-cli migrate on your migration crate. It will apply all pending migration at once.

billy1624 avatar Sep 01 '22 09:09 billy1624