From 4bde187096a802acf995daf5c469aac226710ae2 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Wed, 4 Oct 2017 20:24:42 +0200 Subject: [PATCH] Added VatReport.Guid field --- Basic/Basic.csproj | 2 ++ Database/Configuration.cs | 2 +- Database/Database.csproj | 1 + Database/Schemata/revisions.txt | 3 ++- Database/Schemata/upgrade-0039.sql | 32 ++++++++++++++++++++++++++++++ 5 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 Database/Schemata/upgrade-0039.sql diff --git a/Basic/Basic.csproj b/Basic/Basic.csproj index 56edb315..8384d965 100644 --- a/Basic/Basic.csproj +++ b/Basic/Basic.csproj @@ -59,6 +59,8 @@ + + diff --git a/Database/Configuration.cs b/Database/Configuration.cs index 2d037e58..674a1090 100644 --- a/Database/Configuration.cs +++ b/Database/Configuration.cs @@ -14,7 +14,7 @@ namespace Swarmops.Database /// public static int DbVersionExpected { - get { return 38; } + get { return 39; } } diff --git a/Database/Database.csproj b/Database/Database.csproj index 14b19aa7..f6d601ca 100644 --- a/Database/Database.csproj +++ b/Database/Database.csproj @@ -124,6 +124,7 @@ + diff --git a/Database/Schemata/revisions.txt b/Database/Schemata/revisions.txt index 6a34cdad..02dce7db 100644 --- a/Database/Schemata/revisions.txt +++ b/Database/Schemata/revisions.txt @@ -35,4 +35,5 @@ 0035 - Added OrganizationSequenceId on FinancialTransactions, VatCents setter on invoices [RF] 0036 - Added support for VatCents on ExpenseClaims [RF] 0037 - Added Suppliers, ExternalContacts tables; no procs for them yet [RF] -0038 - VAT Report tables and functions [RF] \ No newline at end of file +0038 - VAT Report tables and functions [RF] +0039 - VatReport.Guid added [RF] \ No newline at end of file diff --git a/Database/Schemata/upgrade-0039.sql b/Database/Schemata/upgrade-0039.sql new file mode 100644 index 00000000..84c78abd --- /dev/null +++ b/Database/Schemata/upgrade-0039.sql @@ -0,0 +1,32 @@ +ALTER TABLE `VatReports` +ADD COLUMN `Guid` VARCHAR(128) NOT NULL AFTER `OrganizationId`, +ADD INDEX `Ix_Guid` (`Guid` ASC) + +# + + +DROP PROCEDURE IF EXISTS `CreateVatReport` + + +# + + +CREATE DEFINER=`swarmops-live-a`@`%` PROCEDURE `CreateVatReport`( + organizationId INT, + guid VARCHAR(128), + createdDateTime DATETIME, + yearMonthStart BIGINT, + monthCount INT +) +BEGIN + INSERT INTO VatReports + (OrganizationId,Guid,CreatedDateTime,YearMonthStart,MonthCount,Open,TurnoverCents,VatInboundCents,VatOutboundCents,UnderConstruction) + VALUES + (organizationId,guid,createdDateTime,yearMonthStart,monthCount,1,0,0,0,1); + + SELECT LAST_INSERT_ID() AS Identity; +END + + + +