From a67e5edf657c8b4410dbabd2b413625b7bae9b4a Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Wed, 28 Aug 2024 13:59:34 +0200 Subject: [PATCH 1/2] Db: Fix current week timeframe end --- schema/mysql-upgrades/1.1.0.sql | 1 + schema/mysql.schema.sql | 2 +- schema/pgsql-upgrades/1.1.0.sql | 1 + schema/pgsql.schema.sql | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 schema/mysql-upgrades/1.1.0.sql create mode 100644 schema/pgsql-upgrades/1.1.0.sql diff --git a/schema/mysql-upgrades/1.1.0.sql b/schema/mysql-upgrades/1.1.0.sql new file mode 100644 index 0000000..21fb430 --- /dev/null +++ b/schema/mysql-upgrades/1.1.0.sql @@ -0,0 +1 @@ +UPDATE timeframe SET end = 'now' WHERE name = 'Current Week'; diff --git a/schema/mysql.schema.sql b/schema/mysql.schema.sql index bd231bc..2167668 100644 --- a/schema/mysql.schema.sql +++ b/schema/mysql.schema.sql @@ -28,7 +28,7 @@ INSERT INTO timeframe (name, title, start, end, ctime, mtime) VALUES ('One Year', null, '-1 year', 'now', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000), ('Current Day', null, 'midnight', 'now', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000), ('Last Day', null, 'yesterday midnight', 'yesterday 23:59:59', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000), - ('Current Week', null, 'monday this week midnight', 'sunday this week 23:59:59', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000), + ('Current Week', null, 'monday this week midnight', 'now', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000), ('Last Week', null, 'monday last week midnight', 'sunday last week 23:59:59', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000), ('Current Month', null, 'first day of this month midnight', 'now', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000), ('Last Month', null, 'first day of last month midnight', 'last day of last month 23:59:59', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000), diff --git a/schema/pgsql-upgrades/1.1.0.sql b/schema/pgsql-upgrades/1.1.0.sql new file mode 100644 index 0000000..21fb430 --- /dev/null +++ b/schema/pgsql-upgrades/1.1.0.sql @@ -0,0 +1 @@ +UPDATE timeframe SET end = 'now' WHERE name = 'Current Week'; diff --git a/schema/pgsql.schema.sql b/schema/pgsql.schema.sql index d20289c..02254cc 100644 --- a/schema/pgsql.schema.sql +++ b/schema/pgsql.schema.sql @@ -31,7 +31,7 @@ INSERT INTO timeframe (name, title, start, "end") VALUES ('One Year', null, '-1 year', 'now'), ('Current Day', null, 'midnight', 'now'), ('Last Day', null, 'yesterday midnight', 'yesterday 23:59:59'), - ('Current Week', null, 'monday this week midnight', 'sunday this week 23:59:59'), + ('Current Week', null, 'monday this week midnight', 'now'), ('Last Week', null, 'monday last week midnight', 'sunday last week 23:59:59'), ('Current Month', null, 'first day of this month midnight', 'now'), ('Last Month', null, 'first day of last month midnight', 'last day of last month 23:59:59'), From 1525f444dc30650e1bf056191f4fe61cced60e3a Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Thu, 26 Sep 2024 10:04:48 +0200 Subject: [PATCH 2/2] DbMigration: Insert new schema version and description --- library/Reporting/ProvidedHook/DbMigration.php | 3 ++- schema/mysql-upgrades/1.1.0.sql | 3 +++ schema/pgsql-upgrades/1.1.0.sql | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/library/Reporting/ProvidedHook/DbMigration.php b/library/Reporting/ProvidedHook/DbMigration.php index 27830a0..345e66d 100644 --- a/library/Reporting/ProvidedHook/DbMigration.php +++ b/library/Reporting/ProvidedHook/DbMigration.php @@ -25,7 +25,8 @@ public function providedDescriptions(): array . ' engine of some tables.' ), '0.10.0' => $this->translate('Creates the template table and adjusts some column types'), - '1.0.0' => $this->translate('Migrates all your configured report schedules to the new config.') + '1.0.0' => $this->translate('Migrates all your configured report schedules to the new config.'), + '1.1.0' => $this->translate('Fix the `end` time of preconfigured `Current Week` timeframe.'), ]; } diff --git a/schema/mysql-upgrades/1.1.0.sql b/schema/mysql-upgrades/1.1.0.sql index 21fb430..5b0d94e 100644 --- a/schema/mysql-upgrades/1.1.0.sql +++ b/schema/mysql-upgrades/1.1.0.sql @@ -1 +1,4 @@ UPDATE timeframe SET end = 'now' WHERE name = 'Current Week'; + +INSERT INTO reporting_schema (version, timestamp, success, reason) + VALUES ('1.1.0', unix_timestamp() * 1000, 'y', NULL); diff --git a/schema/pgsql-upgrades/1.1.0.sql b/schema/pgsql-upgrades/1.1.0.sql index 21fb430..5b0d94e 100644 --- a/schema/pgsql-upgrades/1.1.0.sql +++ b/schema/pgsql-upgrades/1.1.0.sql @@ -1 +1,4 @@ UPDATE timeframe SET end = 'now' WHERE name = 'Current Week'; + +INSERT INTO reporting_schema (version, timestamp, success, reason) + VALUES ('1.1.0', unix_timestamp() * 1000, 'y', NULL);