use sea_orm_migration::prelude::*; use crate::m20230618_163416_recipe::Recipe; #[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(Recipe::Table) .add_column( ColumnDef::new(Recipe::PersonCount) .integer() .not_null() .default(1), ) .to_owned(), ) .await } async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { manager .alter_table( Table::alter() .table(Recipe::Table) .drop_column(Recipe::PersonCount) .to_owned(), ) .await } }