Cleanups
This commit is contained in:
parent
894e8b40a4
commit
b9c017b1fa
@ -38,7 +38,8 @@ impl MigrationTrait for Migration {
|
|||||||
PaymentCollectionSession::PaymentSessionId,
|
PaymentCollectionSession::PaymentSessionId,
|
||||||
))
|
))
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
);
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
m.drop_index(
|
m.drop_index(
|
||||||
IndexDropStatement::new()
|
IndexDropStatement::new()
|
||||||
@ -49,7 +50,8 @@ impl MigrationTrait for Migration {
|
|||||||
PaymentCollectionPayment::PaymentId,
|
PaymentCollectionPayment::PaymentId,
|
||||||
))
|
))
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
);
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
self.drop_table(m, PaymentCollectionSession::PaymentCollectionSessions)
|
self.drop_table(m, PaymentCollectionSession::PaymentCollectionSessions)
|
||||||
.await?;
|
.await?;
|
||||||
@ -444,7 +446,8 @@ impl Migration {
|
|||||||
PaymentCollectionPayment::PaymentId,
|
PaymentCollectionPayment::PaymentId,
|
||||||
))
|
))
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
);
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
m.create_foreign_key(
|
m.create_foreign_key(
|
||||||
ForeignKeyCreateStatement::new()
|
ForeignKeyCreateStatement::new()
|
||||||
@ -460,7 +463,8 @@ impl Migration {
|
|||||||
PaymentCollection::Id,
|
PaymentCollection::Id,
|
||||||
))
|
))
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
);
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
use sea_orm_migration::prelude::*;
|
use sea_orm_migration::prelude::*;
|
||||||
|
|
||||||
use crate::constraint::Check;
|
use crate::constraint::Check;
|
||||||
use crate::sea_orm::Iterable;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
auto_uuid_not_null, create_constraint, create_type, drop_type, to_fk_name, to_pk2_name,
|
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)]
|
#[derive(DeriveMigrationName)]
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
use sea_orm_migration::prelude::*;
|
use sea_orm_migration::prelude::*;
|
||||||
|
|
||||||
use crate::sea_orm::Iterable;
|
use crate::{auto_uuid_not_null, ts_def_now_not_null, IntoColumnDef};
|
||||||
use crate::{
|
|
||||||
auto_uuid_not_null, create_type, drop_type, ts_def_now_not_null, DropTable, IntoColumnDef,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(DeriveMigrationName)]
|
#[derive(DeriveMigrationName)]
|
||||||
pub struct Migration;
|
pub struct Migration;
|
||||||
@ -17,6 +14,15 @@ impl MigrationTrait for Migration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn down(&self, m: &SchemaManager) -> Result<(), DbErr> {
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use std::fmt::{Display, Formatter, Pointer};
|
use std::fmt::{Display, Formatter};
|
||||||
|
|
||||||
pub use sea_orm_migration::prelude::*;
|
pub use sea_orm_migration::prelude::*;
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ fn to_snake(s: String) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub mod constraint {
|
pub mod constraint {
|
||||||
use std::fmt::{Display, Formatter, Write};
|
use std::fmt::{Display, Formatter};
|
||||||
|
|
||||||
use crate::{Constraint, Iden};
|
use crate::{Constraint, Iden};
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ pub struct CheckUSize(usize);
|
|||||||
|
|
||||||
impl Iden for CheckUSize {
|
impl Iden for CheckUSize {
|
||||||
fn unquoted(&self, s: &mut dyn Write) {
|
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<T: Iden, C: Into<Constraint>>(
|
|||||||
c.to_name(),
|
c.to_name(),
|
||||||
c
|
c
|
||||||
))
|
))
|
||||||
.await;
|
.await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user