correctly handle updated alerts
This commit is contained in:
parent
a8c0be2c05
commit
ac0ac8a10d
34 changed files with 775 additions and 114 deletions
|
@ -6,42 +6,28 @@ pub struct Migration;
|
|||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
// Replace the sample below with your own migration scripts
|
||||
todo!();
|
||||
|
||||
manager
|
||||
.create_table(
|
||||
Table::create()
|
||||
.table(Post::Table)
|
||||
.table(Alerts::Table)
|
||||
.if_not_exists()
|
||||
.col(
|
||||
ColumnDef::new(Post::Id)
|
||||
.integer()
|
||||
.not_null()
|
||||
.auto_increment()
|
||||
.primary_key(),
|
||||
)
|
||||
.col(ColumnDef::new(Post::Title).string().not_null())
|
||||
.col(ColumnDef::new(Post::Text).string().not_null())
|
||||
.col(ColumnDef::new(Alerts::Id).string().not_null().primary_key())
|
||||
.col(ColumnDef::new(Alerts::PublishDate).date_time().not_null())
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
// Replace the sample below with your own migration scripts
|
||||
todo!();
|
||||
|
||||
manager
|
||||
.drop_table(Table::drop().table(Post::Table).to_owned())
|
||||
.drop_table(Table::drop().table(Alerts::Table).to_owned())
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(DeriveIden)]
|
||||
enum Post {
|
||||
enum Alerts {
|
||||
Table,
|
||||
Id,
|
||||
Title,
|
||||
Text,
|
||||
PublishDate,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue