From 379910081aec86e541079250d3bb825adbab1e58 Mon Sep 17 00:00:00 2001 From: eraden Date: Thu, 8 Jun 2023 17:28:57 +0200 Subject: [PATCH] Add another checkout table --- .../checkouts/m20230603_120814_checkouts.rs | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/migration/src/checkouts/m20230603_120814_checkouts.rs b/migration/src/checkouts/m20230603_120814_checkouts.rs index 38a1e7f..67cae25 100644 --- a/migration/src/checkouts/m20230603_120814_checkouts.rs +++ b/migration/src/checkouts/m20230603_120814_checkouts.rs @@ -45,6 +45,7 @@ impl MigrationTrait for Migration { drop_type!(m, crate::types::OrderItemChangeType); drop_type!(m, crate::types::PaymentCollectionType); drop_type!(m, crate::types::OrderFulfillmentStatus); + drop_type!(m, crate::types::PaymentCollectionStatus); Ok(()) } } @@ -56,6 +57,7 @@ impl Migration { create_type!(m, crate::types::OrderItemChangeType); create_type!(m, crate::types::PaymentCollectionType); create_type!(m, crate::types::OrderFulfillmentStatus); + create_type!(m, crate::types::PaymentCollectionStatus); Ok(()) } /// ```sql @@ -316,12 +318,26 @@ impl Migration { .col(ts_def_now_not_null!(PaymentCollection::CreatedAt)) .col(ts_def_now_not_null!(PaymentCollection::UpdatedAt)) .col(PaymentCollection::DeletedAt.col().timestamp()) - .col(PaymentCollection::Type.col().enumeration(crate::types::PaymentCollectionType::PaymentCollectionTypes, crate::types::PaymentCollectionType::iter().skip(1))) - //////// - //////// TODO - //////// TODO - //////// TODO - //////// + .col(PaymentCollection::PaymentCollectionType.col().enumeration( + crate::types::PaymentCollectionType::PaymentCollectionTypes, + crate::types::PaymentCollectionType::iter().skip(1), + )) + .col( + PaymentCollection::Status + .col() + .enumeration( + crate::types::PaymentCollectionStatus::PaymentCollectionStatuses, + crate::types::PaymentCollectionStatus::iter().skip(1), + ) + .not_null(), + ) + .col(PaymentCollection::Description.col().string()) + .col(PaymentCollection::Amount.col().integer().not_null()) + .col(PaymentCollection::AuthorizedAmount.col().integer()) + .col(PaymentCollection::RegionId.col().uuid().not_null()) + .col(PaymentCollection::CurrencyCode.col().string().not_null()) + .col(PaymentCollection::Metadata.col().json_binary()) + .col(PaymentCollection::CreatedBy.col().uuid().not_null()) .to_owned(), ) .await?; @@ -530,7 +546,7 @@ pub enum PaymentCollection { CreatedAt, UpdatedAt, DeletedAt, - Type, + PaymentCollectionType, Status, Description, Amount,