mirror of
https://github.com/4cuck/nitter-status.git
synced 2026-10-27 00:57:39 +00:00
1 parent
533cc753db
commit
bc156af23e
17 files changed
+284
-52
No files matched your search
@@ -3,6 +3,7 @@ pub use sea_orm_migration::prelude::*;
|
||||
mod m20220101_000001_create_table;
|
||||
mod m20230729_010231_datetime_rowid;
|
||||
mod m20230729_230909_datetime_int_host;
|
||||
mod m20230803_154714_version_url;
|
||||
|
||||
pub struct Migrator;
|
||||
|
||||
@@ -13,6 +14,7 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20220101_000001_create_table::Migration),
|
||||
Box::new(m20230729_010231_datetime_rowid::Migration),
|
||||
Box::new(m20230729_230909_datetime_int_host::Migration),
|
||||
Box::new(m20230803_154714_version_url::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
use sea_orm_migration::{
|
||||
prelude::*,
|
||||
sea_orm::{prelude::DateTimeUtc, DbBackend, FromQueryResult, Statement},
|
||||
};
|
||||
|
||||
#[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 "version_url" text;"#;
|
||||
let db = manager.get_connection();
|
||||
db.execute_unprepared("BEGIN EXCLUSIVE").await?;
|
||||
tracing::info!("adding version_url 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");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user