Make migrations optional and change the table name to not conflict with other applications
All checks were successful
Build and Publish Docker Container / build (push) Successful in 7m33s
All checks were successful
Build and Publish Docker Container / build (push) Successful in 7m33s
This commit is contained in:
parent
f7c48b6924
commit
550b4758b2
@ -6,6 +6,10 @@ pub struct Migrator;
|
|||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl MigratorTrait for Migrator {
|
impl MigratorTrait for Migrator {
|
||||||
|
fn migration_table_name() -> sea_orm::DynIden {
|
||||||
|
Alias::new("monzo_ingestion_seaql_migrations").into_iden()
|
||||||
|
}
|
||||||
|
|
||||||
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
|
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
|
||||||
vec![Box::new(m20230904_141851_create_monzo_tables::Migration)]
|
vec![Box::new(m20230904_141851_create_monzo_tables::Migration)]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,8 @@ use crate::ingestion::routes::{monzo_batched_csv, monzo_batched_json, monzo_upda
|
|||||||
|
|
||||||
#[derive(Debug, clap::Parser)]
|
#[derive(Debug, clap::Parser)]
|
||||||
struct Config {
|
struct Config {
|
||||||
|
#[clap(short, long, env, default_value_t = true)]
|
||||||
|
migrate: bool,
|
||||||
#[clap(short, long, env, default_value = "0.0.0.0:3000")]
|
#[clap(short, long, env, default_value = "0.0.0.0:3000")]
|
||||||
addr: SocketAddr,
|
addr: SocketAddr,
|
||||||
#[clap(short, long = "db", env)]
|
#[clap(short, long = "db", env)]
|
||||||
@ -31,7 +33,10 @@ async fn health_check(
|
|||||||
async fn main() -> anyhow::Result<()> {
|
async fn main() -> anyhow::Result<()> {
|
||||||
let config: Config = Config::parse();
|
let config: Config = Config::parse();
|
||||||
let connection = sea_orm::Database::connect(&config.database_url).await?;
|
let connection = sea_orm::Database::connect(&config.database_url).await?;
|
||||||
Migrator::up(&connection, None).await?;
|
|
||||||
|
if config.migrate {
|
||||||
|
Migrator::up(&connection, None).await?;
|
||||||
|
}
|
||||||
|
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user