From cb191157ee319a21df44bf038f527d0413515432 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sat, 7 Oct 2017 12:16:52 +0200 Subject: [PATCH] Housekeeping to FinancialTransactionRows --- Database/Configuration.cs | 2 +- Database/Database-Financials.cs | 2 +- Database/Schemata/revisions.txt | 3 ++- Database/Schemata/upgrade-0043.sql | 34 ++++++++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 Database/Schemata/upgrade-0043.sql diff --git a/Database/Configuration.cs b/Database/Configuration.cs index 662a00fe..d4547ad2 100644 --- a/Database/Configuration.cs +++ b/Database/Configuration.cs @@ -14,7 +14,7 @@ namespace Swarmops.Database /// public static int DbVersionExpected { - get { return 42; } + get { return 43; } } diff --git a/Database/Database-Financials.cs b/Database/Database-Financials.cs index 3eb6a4f8..6803c7f8 100644 --- a/Database/Database-Financials.cs +++ b/Database/Database-Financials.cs @@ -990,7 +990,7 @@ namespace Swarmops.Database { connection.Open(); - DbCommand command = GetDbCommand ("CreateFinancialTransactionRowPrecise", connection); + DbCommand command = GetDbCommand ("CreateFinancialTransactionRow", connection); command.CommandType = CommandType.StoredProcedure; AddParameterWithName (command, "financialTransactionId", financialTransactionId); diff --git a/Database/Schemata/revisions.txt b/Database/Schemata/revisions.txt index 7e9d13a0..e354ec7b 100644 --- a/Database/Schemata/revisions.txt +++ b/Database/Schemata/revisions.txt @@ -39,4 +39,5 @@ 0039 - VatReport.Guid added [RF] 0040 - Document.HiresStatus added [RF] 0041 - InboundInvoice housekeeping; added OrgSeqId [RF] -0042 - Bugfix to SetInboundInvoiceOrganizationSequenceId [RF] \ No newline at end of file +0042 - Bugfix to SetInboundInvoiceOrganizationSequenceId [RF] +0043 - FinancialTransactionRows housekeeping [RF] diff --git a/Database/Schemata/upgrade-0043.sql b/Database/Schemata/upgrade-0043.sql new file mode 100644 index 00000000..d3ef5d4e --- /dev/null +++ b/Database/Schemata/upgrade-0043.sql @@ -0,0 +1,34 @@ +ALTER TABLE `FinancialTransactionRows` +DROP COLUMN `Amount` + + +# + + +DROP PROCEDURE IF EXIST `CreateFinancialTransactionRow` + + +# + + +DROP PROCEDURE IF EXIST `CreateFinancialTransactionRowPrecise` + + +# + + +CREATE PROCEDURE `CreateFinancialTransactionRow`( + IN financialTransactionId INTEGER, + IN financialAccountId INTEGER, + IN amountCents BIGINT, + IN dateTime DATETIME, + IN personId INTEGER +) +BEGIN + + INSERT INTO FinancialTransactionRows (FinancialAccountId, FinancialTransactionId, AmountCents, CreatedDateTime, CreatedByPersonId) + VALUES (financialAccountId, financialTransactionid, amountCents, dateTime, personId); + + SELECT LAST_INSERT_ID() AS Identity; + +END