use sea_orm_migration::prelude::*;
#[derive(DeriveMigrationName)]
pub struct Migration;
const UP: &str = r#"
ALTER TABLE durable.task ADD COLUMN IF NOT EXISTS recovery_count INT NOT NULL DEFAULT 0;
ALTER TABLE durable.task ADD COLUMN IF NOT EXISTS max_recovery_attempts INT NOT NULL DEFAULT 100;
"#;
const DOWN: &str = r#"
ALTER TABLE durable.task DROP COLUMN IF EXISTS max_recovery_attempts;
ALTER TABLE durable.task DROP COLUMN IF EXISTS recovery_count;
"#;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager.get_connection().execute_unprepared(UP).await?;
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager.get_connection().execute_unprepared(DOWN).await?;
Ok(())
}
}