Bugzilla – Attachment 177674 Details for
Bug 39075
Fix DB inconsistencies in the usage statistics module
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39075: Fix DB inconsistencies
Bug-39075-Fix-DB-inconsistencies.patch (text/plain), 4.21 KB, created by
Matt Blenkinsop
on 2025-02-10 10:30:27 UTC
(
hide
)
Description:
Bug 39075: Fix DB inconsistencies
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2025-02-10 10:30:27 UTC
Size:
4.21 KB
patch
obsolete
>From 4a373d28433ddbc0ce1e17999d3e3920263b2046 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Mon, 10 Feb 2025 10:07:36 +0000 >Subject: [PATCH] Bug 39075: Fix DB inconsistencies > >This patch fixes DB inconsistencies introduced in bug 34587 > >Test plan: >1) Run 'updatedatabase' >2) There should be no errors >3) Check the database and observe the correct assignment of the following columns >- erm_counter_logs.importdate >- erm_counter_files.date_uploaded >--- > .../atomicupdate/bug_34587-fix_timestamps.pl | 33 +++++++++++++++++++ > installer/data/mysql/db_revs/230600056.pl | 4 +-- > 2 files changed, 35 insertions(+), 2 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_34587-fix_timestamps.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_34587-fix_timestamps.pl b/installer/data/mysql/atomicupdate/bug_34587-fix_timestamps.pl >new file mode 100644 >index 00000000000..d807cb6cd47 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_34587-fix_timestamps.pl >@@ -0,0 +1,33 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "34587", >+ description => "Follow up to fix incorrect default values for timestamps", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ if ( TableExists('erm_counter_files') ) { >+ if ( column_exists( 'erm_counter_files', 'date_uploaded' ) ) { >+ $dbh->do( >+ q{ >+ ALTER TABLE erm_counter_files CHANGE COLUMN date_uploaded date_uploaded timestamp DEFAULT current_timestamp() COMMENT 'counter file upload date' >+ } >+ ); >+ say_success( $out, "Successfully corrected incorrect default value for 'erm_counter_files.date_uploaded" ); >+ } >+ } >+ >+ if ( TableExists('erm_counter_logs') ) { >+ if ( column_exists( 'erm_counter_logs', 'importdate' ) ) { >+ $dbh->do( >+ q{ >+ ALTER TABLE erm_counter_logs CHANGE COLUMN importdate importdate timestamp DEFAULT current_timestamp() COMMENT 'counter file import date' >+ } >+ ); >+ say_success( $out, "Successfully corrected incorrect default value for 'erm_counter_logs.importdate" ); >+ } >+ } >+ }, >+}; >diff --git a/installer/data/mysql/db_revs/230600056.pl b/installer/data/mysql/db_revs/230600056.pl >index 89cb9029130..aed47cd5992 100755 >--- a/installer/data/mysql/db_revs/230600056.pl >+++ b/installer/data/mysql/db_revs/230600056.pl >@@ -43,7 +43,7 @@ return { > `type` varchar(80) DEFAULT NULL COMMENT 'type of counter file', > `filename` varchar(80) DEFAULT NULL COMMENT 'name of the counter file', > `file_content` longblob DEFAULT NULL COMMENT 'content of the counter file', >- `date_uploaded` timestamp DEFAULT NULL DEFAULT current_timestamp() COMMENT 'counter file upload date', >+ `date_uploaded` timestamp DEFAULT current_timestamp() COMMENT 'counter file upload date', > PRIMARY KEY (`erm_counter_files_id`), > CONSTRAINT `erm_counter_files_ibfk_1` FOREIGN KEY (`usage_data_provider_id`) REFERENCES `erm_usage_data_providers` (`erm_usage_data_provider_id`) ON DELETE CASCADE ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >@@ -61,7 +61,7 @@ return { > `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key to borrowers', > `counter_files_id` int(11) DEFAULT NULL COMMENT 'foreign key to erm_counter_files', > `usage_data_provider_id` int(11) DEFAULT NULL COMMENT 'foreign key to erm_usage_data_providers', >- `importdate` timestamp DEFAULT NULL DEFAULT current_timestamp() COMMENT 'counter file import date', >+ `importdate` timestamp DEFAULT current_timestamp() COMMENT 'counter file import date', > `filename` varchar(80) DEFAULT NULL COMMENT 'name of the counter file', > `logdetails` longtext DEFAULT NULL COMMENT 'details from the counter log', > PRIMARY KEY (`erm_counter_log_id`), >-- >2.48.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39075
:
177674
|
177727
|
177728