new feature: order by reference times.
This commit is contained in:
@@ -2,6 +2,7 @@ pub use sea_orm_migration::prelude::*;
|
||||
|
||||
mod m20220101_000001_create_table;
|
||||
mod m20220625_222908_message_unique;
|
||||
mod m20220630_195724_for_hot;
|
||||
|
||||
pub struct Migrator;
|
||||
|
||||
@@ -11,6 +12,7 @@ impl MigratorTrait for Migrator {
|
||||
vec![
|
||||
Box::new(m20220101_000001_create_table::Migration),
|
||||
Box::new(m20220625_222908_message_unique::Migration),
|
||||
Box::new(m20220630_195724_for_hot::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
37
migration/src/m20220630_195724_for_hot.rs
Normal file
37
migration/src/m20220630_195724_for_hot.rs
Normal file
@@ -0,0 +1,37 @@
|
||||
use models::prelude::Record;
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
pub struct Migration;
|
||||
|
||||
impl MigrationName for Migration {
|
||||
fn name(&self) -> &str {
|
||||
"m20220630_195724_for_hot"
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.alter_table(
|
||||
Table::alter()
|
||||
.table(Record)
|
||||
.add_column_if_not_exists(
|
||||
ColumnDef::new(Alias::new("hot")).big_integer().default(0),
|
||||
)
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.alter_table(
|
||||
Table::alter()
|
||||
.table(Record)
|
||||
.drop_column(Alias::new("hot"))
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user