Skip to content

Commit

Permalink
feat: Always run migrations in cron-mon
Browse files Browse the repository at this point in the history
  • Loading branch information
howamith committed Nov 27, 2024
1 parent 0c241ea commit d8de7fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion api/src/bin/cron_mon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use clap::{Args, Parser, Subcommand};
use cron_mon_api::application::services::{
get_create_monitor_service, get_process_late_jobs_service,
};
use cron_mon_api::infrastructure::database::create_connection_pool;
use cron_mon_api::infrastructure::database::{create_connection_pool, run_migrations};
use cron_mon_api::infrastructure::logging::init_logging;

/// The cron-mon CLI.
Expand Down Expand Up @@ -62,6 +62,7 @@ struct CreateMonitorArgs {
#[tokio::main]
async fn main() {
init_logging();
run_migrations();

let cli = Cli::parse();
match cli.command {
Expand Down
4 changes: 1 addition & 3 deletions api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ use rocket::{routes, Build, Rocket};
use crate::application::routes::{api_keys, health, jobs, monitors};
use crate::infrastructure::auth::jwt::{Jwk, JwtAuthService};
use crate::infrastructure::auth::JwtAuth;
use crate::infrastructure::database::{create_connection_pool, run_migrations};
use crate::infrastructure::database::create_connection_pool;
use crate::infrastructure::middleware::fairings::{cors::CORS, default_json::DefaultJSON};

#[rocket::launch]
pub fn rocket() -> Rocket<Build> {
run_migrations();

let db_pool = create_connection_pool().expect("Failed to create DB connection pool.");

rocket::build()
Expand Down

0 comments on commit d8de7fd

Please sign in to comment.