From 1b47b38c03a2cbca86f7028bd739d6849151b01e Mon Sep 17 00:00:00 2001 From: Ben White Date: Mon, 13 Nov 2023 22:53:41 +1100 Subject: [PATCH] mod: decimal values --- src/migrator/m20230730_000002_customer.rs | 6 +++++- src/migrator/m20230730_000003_transactions.rs | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/migrator/m20230730_000002_customer.rs b/src/migrator/m20230730_000002_customer.rs index d963171..7c266eb 100644 --- a/src/migrator/m20230730_000002_customer.rs +++ b/src/migrator/m20230730_000002_customer.rs @@ -26,7 +26,11 @@ impl MigrationTrait for Migration { .col(ColumnDef::new(Customer::TenantId).string().not_null()) .col(ColumnDef::new(Customer::Contact).json().not_null()) .col(ColumnDef::new(Customer::CustomerNotes).json().not_null()) - .col(ColumnDef::new(Customer::Balance).float().not_null()) + .col( + ColumnDef::new(Customer::Balance) + .decimal_len(24, 8) + .not_null(), + ) .col(ColumnDef::new(Customer::SpecialPricing).json().not_null()) .col( ColumnDef::new(Customer::AcceptsMarketing) diff --git a/src/migrator/m20230730_000003_transactions.rs b/src/migrator/m20230730_000003_transactions.rs index ba94ac4..eaab957 100644 --- a/src/migrator/m20230730_000003_transactions.rs +++ b/src/migrator/m20230730_000003_transactions.rs @@ -31,7 +31,11 @@ impl MigrationTrait for Migration { .not_null(), ) .col(ColumnDef::new(Transactions::Products).json().not_null()) - .col(ColumnDef::new(Transactions::OrderTotal).float().not_null()) + .col( + ColumnDef::new(Transactions::OrderTotal) + .decimal_len(24, 8) + .not_null(), + ) .col(ColumnDef::new(Transactions::Payment).json().not_null()) .col( ColumnDef::new(Transactions::OrderDate) @@ -41,8 +45,16 @@ impl MigrationTrait for Migration { .col(ColumnDef::new(Transactions::OrderNotes).json().not_null()) .col(ColumnDef::new(Transactions::Salesperson).text().not_null()) .col(ColumnDef::new(Transactions::Kiosk).text().not_null()) - .col(ColumnDef::new(Transactions::CreatedAt).date_time().not_null()) - .col(ColumnDef::new(Transactions::UpdatedAt).date_time().not_null()) + .col( + ColumnDef::new(Transactions::CreatedAt) + .date_time() + .not_null(), + ) + .col( + ColumnDef::new(Transactions::UpdatedAt) + .date_time() + .not_null(), + ) .to_owned(), ) .await