forked from jmug/stoatchat
fix: add Authifier migration for last_seen
This commit is contained in:
@@ -21,7 +21,7 @@ struct MigrationInfo {
|
|||||||
revision: i32,
|
revision: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const LATEST_REVISION: i32 = 31;
|
pub const LATEST_REVISION: i32 = 32;
|
||||||
|
|
||||||
pub async fn migrate_database(db: &MongoDb) {
|
pub async fn migrate_database(db: &MongoDb) {
|
||||||
let migrations = db.col::<Document>("migrations");
|
let migrations = db.col::<Document>("migrations");
|
||||||
@@ -1128,6 +1128,17 @@ pub async fn run_migrations(db: &MongoDb, revision: i32) -> i32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if revision <= 32 {
|
||||||
|
info!(
|
||||||
|
"Running migration [revision 32 / 12-05-2025]: (Authifier) Add last_seen to sessions."
|
||||||
|
);
|
||||||
|
|
||||||
|
let db = authifier::Database::MongoDb(authifier::database::MongoDb(db.db()));
|
||||||
|
db.run_migration(authifier::Migration::M2025_02_20AddLastSeenToSession)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
// Reminder to update LATEST_REVISION when adding new migrations.
|
// Reminder to update LATEST_REVISION when adding new migrations.
|
||||||
LATEST_REVISION.max(revision)
|
LATEST_REVISION.max(revision)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user