Bug 22273: Database revision for table article_requests
Column created_on should not be updated. It is filled once by the store method of Koha::ArticleRequest. Column updated_on should be a timestamp, updated by the database. Note: Although higher versions of MySQL and MariaDB support two timestamps (NOT NULL) in one table, I kept on the safe side by allowing NULL on the created_on column. @RM: Don't forget to run DBIx update. Test plan: Run new install or upgrade. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
8dc15ceffd
commit
266bcd554b
|
|
@ -0,0 +1,8 @@
|
|||
$DBversion = 'XXX'; # will be replaced by the RM
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
$dbh->do( q|
|
||||
ALTER TABLE article_requests MODIFY COLUMN created_on timestamp NULL, MODIFY COLUMN updated_on timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
|
||||
|);
|
||||
SetVersion( $DBversion );
|
||||
print "Upgrade to $DBversion done (Bug 22273: Column article_requests.created_on should not be updated)\n";
|
||||
}
|
||||
|
|
@ -3944,8 +3944,8 @@ CREATE TABLE `article_requests` (
|
|||
`patron_notes` MEDIUMTEXT,
|
||||
`status` enum('PENDING','PROCESSING','COMPLETED','CANCELED') NOT NULL DEFAULT 'PENDING',
|
||||
`notes` MEDIUMTEXT,
|
||||
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`updated_on` timestamp NULL DEFAULT NULL,
|
||||
`created_on` timestamp NULL DEFAULT NULL, -- Be careful with two timestamps in one table not allowing NULL
|
||||
`updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `borrowernumber` (`borrowernumber`),
|
||||
KEY `biblionumber` (`biblionumber`),
|
||||
|
|
|
|||
Loading…
Reference in New Issue