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
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] chmod 755 on new dbrev
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 50ef9576d2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
9f081a212d
commit
d3e892fa7c
|
|
@ -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" );
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
@ -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`),
|
||||
|
|
|
|||
Loading…
Reference in New Issue