ipv detection

This commit is contained in:
4cuck committed 2023-10-16 23:32:09 +02:00
1 parent daee7e6277
commit 280b955236
10 files changed
+108 -12

No files matched your search

+2
View File
@@ -5,6 +5,7 @@ mod m20230729_010231_datetime_rowid;
mod m20230729_230909_datetime_int_host;
mod m20230803_154714_version_url;
mod m20230829_201916_country;
mod m20230914_231514_connectivity;
pub struct Migrator;
@@ -18,6 +19,7 @@ impl MigratorTrait for Migrator {
Box::new(m20230729_230909_datetime_int_host::Migration),
Box::new(m20230803_154714_version_url::Migration),
Box::new(m20230829_201916_country::Migration),
Box::new(m20230914_231514_connectivity::Migration),
]
}
}
@@ -0,0 +1,22 @@
use sea_orm_migration::prelude::*;
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let cmd = r#"ALTER TABLE "host" ADD COLUMN "connectivity" INT;"#;
let db = manager.get_connection();
db.execute_unprepared("BEGIN EXCLUSIVE").await?;
tracing::info!("adding connectivity column..");
db.execute_unprepared(cmd).await?;
db.execute_unprepared("COMMIT TRANSACTION").await?;
db.execute_unprepared("VACUUM").await?;
Ok(())
}
async fn down(&self, _manager: &SchemaManager) -> Result<(), DbErr> {
panic!("Can't migrate down");
}
}