mirror of
https://github.com/amtoaer/bili-sync.git
synced 2026-09-05 07:28:04 +08:00
chore: 为 video sources 添加 enabled 字段 (#362)
This commit is contained in:
@@ -14,6 +14,7 @@ pub struct Model {
|
|||||||
pub path: String,
|
pub path: String,
|
||||||
pub created_at: String,
|
pub created_at: String,
|
||||||
pub latest_row_at: DateTime,
|
pub latest_row_at: DateTime,
|
||||||
|
pub enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ pub struct Model {
|
|||||||
pub path: String,
|
pub path: String,
|
||||||
pub created_at: String,
|
pub created_at: String,
|
||||||
pub latest_row_at: DateTime,
|
pub latest_row_at: DateTime,
|
||||||
|
pub enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ pub struct Model {
|
|||||||
pub path: String,
|
pub path: String,
|
||||||
pub created_at: String,
|
pub created_at: String,
|
||||||
pub latest_row_at: DateTime,
|
pub latest_row_at: DateTime,
|
||||||
|
pub enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ pub struct Model {
|
|||||||
pub path: String,
|
pub path: String,
|
||||||
pub created_at: String,
|
pub created_at: String,
|
||||||
pub latest_row_at: DateTime,
|
pub latest_row_at: DateTime,
|
||||||
|
pub enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ mod m20240505_130850_add_collection;
|
|||||||
mod m20240709_130914_watch_later;
|
mod m20240709_130914_watch_later;
|
||||||
mod m20240724_161008_submission;
|
mod m20240724_161008_submission;
|
||||||
mod m20250122_062926_add_latest_row_at;
|
mod m20250122_062926_add_latest_row_at;
|
||||||
|
mod m20250612_090826_add_enabled;
|
||||||
|
|
||||||
pub struct Migrator;
|
pub struct Migrator;
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ impl MigratorTrait for Migrator {
|
|||||||
Box::new(m20240709_130914_watch_later::Migration),
|
Box::new(m20240709_130914_watch_later::Migration),
|
||||||
Box::new(m20240724_161008_submission::Migration),
|
Box::new(m20240724_161008_submission::Migration),
|
||||||
Box::new(m20250122_062926_add_latest_row_at::Migration),
|
Box::new(m20250122_062926_add_latest_row_at::Migration),
|
||||||
|
Box::new(m20250612_090826_add_enabled::Migration),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
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(WatchLater::Table)
|
||||||
|
.add_column(ColumnDef::new(WatchLater::Enabled).boolean().not_null().default(false))
|
||||||
|
.to_owned(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
manager
|
||||||
|
.alter_table(
|
||||||
|
Table::alter()
|
||||||
|
.table(Submission::Table)
|
||||||
|
.add_column(ColumnDef::new(Submission::Enabled).boolean().not_null().default(false))
|
||||||
|
.to_owned(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
manager
|
||||||
|
.alter_table(
|
||||||
|
Table::alter()
|
||||||
|
.table(Favorite::Table)
|
||||||
|
.add_column(ColumnDef::new(Favorite::Enabled).boolean().not_null().default(false))
|
||||||
|
.to_owned(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
manager
|
||||||
|
.alter_table(
|
||||||
|
Table::alter()
|
||||||
|
.table(Collection::Table)
|
||||||
|
.add_column(ColumnDef::new(Collection::Enabled).boolean().not_null().default(false))
|
||||||
|
.to_owned(),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||||
|
manager
|
||||||
|
.alter_table(
|
||||||
|
Table::alter()
|
||||||
|
.table(WatchLater::Table)
|
||||||
|
.drop_column(WatchLater::Enabled)
|
||||||
|
.to_owned(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
manager
|
||||||
|
.alter_table(
|
||||||
|
Table::alter()
|
||||||
|
.table(Submission::Table)
|
||||||
|
.drop_column(Submission::Enabled)
|
||||||
|
.to_owned(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
manager
|
||||||
|
.alter_table(
|
||||||
|
Table::alter()
|
||||||
|
.table(Favorite::Table)
|
||||||
|
.drop_column(Favorite::Enabled)
|
||||||
|
.to_owned(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
manager
|
||||||
|
.alter_table(
|
||||||
|
Table::alter()
|
||||||
|
.table(Collection::Table)
|
||||||
|
.drop_column(Collection::Enabled)
|
||||||
|
.to_owned(),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(DeriveIden)]
|
||||||
|
enum WatchLater {
|
||||||
|
Table,
|
||||||
|
Enabled,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(DeriveIden)]
|
||||||
|
enum Submission {
|
||||||
|
Table,
|
||||||
|
Enabled,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(DeriveIden)]
|
||||||
|
enum Favorite {
|
||||||
|
Table,
|
||||||
|
Enabled,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(DeriveIden)]
|
||||||
|
enum Collection {
|
||||||
|
Table,
|
||||||
|
Enabled,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user