mirror of
https://github.com/OMGeeky/twitch_backup.local_db.git
synced 2025-12-26 17:02:39 +01:00
add columns for errors on videos (count & reason)
This commit is contained in:
@@ -22,6 +22,8 @@ pub struct Model {
|
||||
pub youtube_playlist_created_at: Option<String>,
|
||||
pub part_count: i32,
|
||||
pub status: Status,
|
||||
pub fail_count: i32,
|
||||
pub fail_reason: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
|
||||
@@ -9,7 +9,7 @@ use tracing::{info, instrument};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
run().await.unwrap();
|
||||
run().await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
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> {
|
||||
manager
|
||||
.alter_table(
|
||||
Table::alter()
|
||||
.table(Videos::Table)
|
||||
.add_column(
|
||||
ColumnDef::new(Videos::FailCount)
|
||||
.integer()
|
||||
.not_null()
|
||||
.default(0),
|
||||
)
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
manager
|
||||
.alter_table(
|
||||
Table::alter()
|
||||
.table(Videos::Table)
|
||||
.add_column(ColumnDef::new(Videos::FailReason).string().null())
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.alter_table(
|
||||
Table::alter()
|
||||
.table(Videos::Table)
|
||||
.drop_column(Videos::FailCount)
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
manager
|
||||
.alter_table(
|
||||
Table::alter()
|
||||
.table(Videos::Table)
|
||||
.drop_column(Videos::FailReason)
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
}
|
||||
#[derive(Iden)]
|
||||
pub enum Videos {
|
||||
Table,
|
||||
FailCount,
|
||||
FailReason,
|
||||
}
|
||||
@@ -4,6 +4,7 @@ mod m20230916_000001_create_users_table;
|
||||
mod m20230916_000002_create_videos_table;
|
||||
mod m20230916_000003_create_video_upload_table;
|
||||
mod m20230916_000004_add_sample_data;
|
||||
mod m20231015_000005_alter_videos_table_for_errors;
|
||||
|
||||
pub struct Migrator;
|
||||
#[async_trait::async_trait]
|
||||
@@ -14,6 +15,7 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20230916_000002_create_videos_table::Migration),
|
||||
Box::new(m20230916_000003_create_video_upload_table::Migration),
|
||||
// Box::new(m20230916_000004_add_sample_data::Migration),
|
||||
Box::new(m20231015_000005_alter_videos_table_for_errors::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user