diff --git a/migration/src/checkouts/m20230603_120814_checkouts.rs b/migration/src/checkouts/m20230603_120814_checkouts.rs index de1a393..98a4fd0 100644 --- a/migration/src/checkouts/m20230603_120814_checkouts.rs +++ b/migration/src/checkouts/m20230603_120814_checkouts.rs @@ -38,7 +38,8 @@ impl MigrationTrait for Migration { PaymentCollectionSession::PaymentSessionId, )) .to_owned(), - ); + ) + .await?; m.drop_index( IndexDropStatement::new() @@ -49,7 +50,8 @@ impl MigrationTrait for Migration { PaymentCollectionPayment::PaymentId, )) .to_owned(), - ); + ) + .await?; self.drop_table(m, PaymentCollectionSession::PaymentCollectionSessions) .await?; @@ -444,7 +446,8 @@ impl Migration { PaymentCollectionPayment::PaymentId, )) .to_owned(), - ); + ) + .await?; m.create_foreign_key( ForeignKeyCreateStatement::new() @@ -460,7 +463,8 @@ impl Migration { PaymentCollection::Id, )) .to_owned(), - ); + ) + .await?; Ok(()) } diff --git a/migration/src/checkouts/m20230603_120815_items.rs b/migration/src/checkouts/m20230603_120815_items.rs index 31b0abb..1b32817 100644 --- a/migration/src/checkouts/m20230603_120815_items.rs +++ b/migration/src/checkouts/m20230603_120815_items.rs @@ -1,10 +1,9 @@ use sea_orm_migration::prelude::*; use crate::constraint::Check; -use crate::sea_orm::Iterable; use crate::{ auto_uuid_not_null, create_constraint, create_type, drop_type, to_fk_name, to_pk2_name, - ts_def_now_not_null, AsIden, DropTable, IntoColumnDef, + ts_def_now_not_null, AsIden, }; #[derive(DeriveMigrationName)] diff --git a/migration/src/discounts/m20230603_120815_gift_carts.rs b/migration/src/discounts/m20230603_120815_gift_carts.rs index a5aebda..c895edc 100644 --- a/migration/src/discounts/m20230603_120815_gift_carts.rs +++ b/migration/src/discounts/m20230603_120815_gift_carts.rs @@ -1,9 +1,6 @@ use sea_orm_migration::prelude::*; -use crate::sea_orm::Iterable; -use crate::{ - auto_uuid_not_null, create_type, drop_type, ts_def_now_not_null, DropTable, IntoColumnDef, -}; +use crate::{auto_uuid_not_null, ts_def_now_not_null, IntoColumnDef}; #[derive(DeriveMigrationName)] pub struct Migration; @@ -17,6 +14,15 @@ impl MigrationTrait for Migration { } async fn down(&self, m: &SchemaManager) -> Result<(), DbErr> { + m.drop_table(Table::drop().table(GiftCard::GiftCards).to_owned()) + .await?; + m.drop_table( + Table::drop() + .table(GiftCardTransaction::GiftCardTransactions) + .to_owned(), + ) + .await?; + Ok(()) } } diff --git a/migration/src/lib.rs b/migration/src/lib.rs index b6d1964..8b1d806 100644 --- a/migration/src/lib.rs +++ b/migration/src/lib.rs @@ -1,4 +1,4 @@ -use std::fmt::{Display, Formatter, Pointer}; +use std::fmt::{Display, Formatter}; pub use sea_orm_migration::prelude::*; @@ -115,7 +115,7 @@ fn to_snake(s: String) -> String { } pub mod constraint { - use std::fmt::{Display, Formatter, Write}; + use std::fmt::{Display, Formatter}; use crate::{Constraint, Iden}; @@ -195,7 +195,7 @@ pub struct CheckUSize(usize); impl Iden for CheckUSize { fn unquoted(&self, s: &mut dyn Write) { - s.write_str(&format!("{}", self.0)); + s.write_str(&format!("{}", self.0)).ok(); } } @@ -248,6 +248,6 @@ async fn create_constraint>( c.to_name(), c )) - .await; + .await?; Ok(()) }