Merge branch 'fix/migration-build' into 'develop'
fix: remove native-utils from migration's dependencies See merge request firefish/firefish!10581
This commit is contained in:
commit
749a2aa3a0
1
packages/backend/native-utils/Cargo.lock
generated
1
packages/backend/native-utils/Cargo.lock
generated
@ -1305,6 +1305,7 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
||||
name = "migration"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"basen",
|
||||
"futures",
|
||||
"indicatif",
|
||||
"native-utils",
|
||||
|
@ -10,11 +10,11 @@ path = "src/lib.rs"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
convert = ["dep:indicatif", "dep:futures"]
|
||||
convert = ["dep:native-utils", "dep:indicatif", "dep:futures"]
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0.96"
|
||||
native-utils = { path = "../" }
|
||||
native-utils = { path = "../", optional = true }
|
||||
indicatif = { version = "0.17.4", features = ["tokio"], optional = true }
|
||||
tokio = { version = "1.28.2", features = ["full"] }
|
||||
futures = { version = "0.3.28", optional = true }
|
||||
@ -24,6 +24,7 @@ urlencoding = "2.1.2"
|
||||
redis = { version = "0.23.0", features = ["tokio-rustls-comp"] }
|
||||
sea-orm = "0.11.3"
|
||||
url = { version = "2.4.0", features = ["serde"] }
|
||||
basen = "0.1.0"
|
||||
|
||||
[dependencies.sea-orm-migration]
|
||||
version = "0.11.0"
|
||||
|
@ -1,5 +1,7 @@
|
||||
pub use sea_orm_migration::prelude::*;
|
||||
|
||||
use basen::BASE36;
|
||||
|
||||
mod m20230531_180824_drop_reversi;
|
||||
mod m20230627_185451_index_note_url;
|
||||
mod m20230709_000510_move_antenna_to_cache;
|
||||
@ -18,3 +20,12 @@ impl MigratorTrait for Migrator {
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_timestamp(id: &str) -> i64 {
|
||||
const TIME_2000: i64 = 946_684_800_000;
|
||||
let n: Option<u64> = BASE36.decode_var_len(&id[0..8]);
|
||||
match n {
|
||||
None => -1,
|
||||
Some(n) => n as i64 + TIME_2000,
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
use std::env;
|
||||
|
||||
use native_utils::util::id;
|
||||
use redis::Commands;
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
use crate::get_timestamp;
|
||||
|
||||
#[derive(DeriveMigrationName)]
|
||||
pub struct Migration;
|
||||
|
||||
@ -31,7 +32,7 @@ impl MigrationTrait for Migration {
|
||||
let all_elems: Vec<Vec<Vec<String>>> = redis_conn.xrange_all(key).unwrap(); // Get all post IDs in stream
|
||||
let stream_ids = all_elems
|
||||
.iter()
|
||||
.map(|v| format!("{}-*", id::get_timestamp(&v[1][1]))); // Get correct stream id with timestamp
|
||||
.map(|v| format!("{}-*", get_timestamp(&v[1][1]))); // Get correct stream id with timestamp
|
||||
redis_conn.del::<_, ()>(key).unwrap();
|
||||
for (j, v) in stream_ids.enumerate() {
|
||||
redis_conn
|
||||
|
Loading…
Reference in New Issue
Block a user