add setup command
This commit is contained in:
parent
466c4e5636
commit
9d60a9701a
1 changed files with 9 additions and 1 deletions
|
@ -4,6 +4,7 @@ use std::{fs, path::PathBuf};
|
|||
use crate::config::Config;
|
||||
use crate::error::Error;
|
||||
use crate::migrator::Migrator;
|
||||
use crate::setup::Initializer;
|
||||
|
||||
pub async fn run_cli() -> Result<(), Error> {
|
||||
let cli = Cli::parse();
|
||||
|
@ -29,7 +30,10 @@ pub async fn run_cli() -> Result<(), Error> {
|
|||
|
||||
match cli.subcommand {
|
||||
MigrationCommand::Up { num } => {
|
||||
Migrator::new(migration_dir, &scylla_conf).await?.up(num).await?
|
||||
Migrator::new(migration_dir, &scylla_conf)
|
||||
.await?
|
||||
.up(num)
|
||||
.await?
|
||||
}
|
||||
MigrationCommand::Down { num } => {
|
||||
Migrator::new(migration_dir, &scylla_conf)
|
||||
|
@ -37,6 +41,10 @@ pub async fn run_cli() -> Result<(), Error> {
|
|||
.down(num)
|
||||
.await?
|
||||
}
|
||||
MigrationCommand::Setup => {
|
||||
let initializer = Initializer::new(&scylla_conf, &config.db).await?;
|
||||
initializer.setup().await?;
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue