add environment variable to skip copying antenna
This commit is contained in:
parent
94014e029d
commit
04ac723a5f
1 changed files with 6 additions and 2 deletions
|
@ -10,13 +10,16 @@ pub struct Migration;
|
||||||
impl MigrationTrait for Migration {
|
impl MigrationTrait for Migration {
|
||||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||||
let cache_url = env::var("CACHE_URL").unwrap();
|
let cache_url = env::var("CACHE_URL").unwrap();
|
||||||
|
let skip_copy = env::var("ANTENNA_MIGRATION_SKIP").unwrap_or_default();
|
||||||
let copy_limit = env::var("ANTENNA_MIGRATION_LIMIT").unwrap_or_default();
|
let copy_limit = env::var("ANTENNA_MIGRATION_LIMIT").unwrap_or_default();
|
||||||
let copy_limit: i64 = match copy_limit.parse() {
|
let copy_limit: i64 = match copy_limit.parse() {
|
||||||
Ok(limit) => limit,
|
Ok(limit) => limit,
|
||||||
Err(_) => 0,
|
Err(_) => 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
if cache_url != "no" {
|
if skip_copy == "true" {
|
||||||
|
println!("Skipped antenna migration");
|
||||||
|
} else {
|
||||||
let prefix = env::var("CACHE_PREFIX").unwrap();
|
let prefix = env::var("CACHE_PREFIX").unwrap();
|
||||||
|
|
||||||
let db = manager.get_connection();
|
let db = manager.get_connection();
|
||||||
|
@ -102,8 +105,9 @@ impl MigrationTrait for Migration {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
println!("Migrating antenna [100.00%]");
|
println!("Migrating antenna [100.00%]");
|
||||||
|
}
|
||||||
|
|
||||||
manager
|
manager
|
||||||
.drop_table(
|
.drop_table(
|
||||||
|
|
Loading…
Reference in a new issue