Bugzilla – Attachment 87208 Details for
Bug 22607
Default value in issues.renewals should be '0' not null
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22607: Change default value in issues.renewals to '0'.
Bug-22607-Change-default-value-in-issuesrenewals-t.patch (text/plain), 3.67 KB, created by
Martin Renvoize (ashimema)
on 2019-03-29 14:04:29 UTC
(
hide
)
Description:
Bug 22607: Change default value in issues.renewals to '0'.
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-03-29 14:04:29 UTC
Size:
3.67 KB
patch
obsolete
>From ca8eaafe465bc0a85afa500fe1778ad96f4ab895 Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Fri, 29 Mar 2019 08:13:48 +0000 >Subject: [PATCH] Bug 22607: Change default value in issues.renewals to '0'. > >This patch change renewals column of issues and old_issues tables. > >Now it is NOT NULL default 0. It does not make sense when number of >renewals is undefined, it is always integer with value zero or more > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > ...ug22607_set_issues_renewals_default_to_zero.perl | 13 +++++++++++++ > installer/data/mysql/kohastructure.sql | 4 ++-- > 2 files changed, 15 insertions(+), 2 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/Bug22607_set_issues_renewals_default_to_zero.perl > >diff --git a/installer/data/mysql/atomicupdate/Bug22607_set_issues_renewals_default_to_zero.perl b/installer/data/mysql/atomicupdate/Bug22607_set_issues_renewals_default_to_zero.perl >new file mode 100644 >index 0000000000..be7157fff6 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/Bug22607_set_issues_renewals_default_to_zero.perl >@@ -0,0 +1,13 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ >+ $dbh->do( "UPDATE issues SET renewals = 0 WHERE renewals IS NULL" ); >+ $dbh->do( "UPDATE old_issues SET renewals = 0 WHERE renewals IS NULL" ); >+ >+ $dbh->do( "ALTER TABLE issues MODIFY COLUMN renewals tinyint(4) NOT NULL default 0"); >+ $dbh->do( "ALTER TABLE old_issues MODIFY COLUMN renewals tinyint(4) NOT NULL default 0"); >+ >+ # Always end with this (adjust the bug info) >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug XXXXX - Set default value of issues.renewals to 0)\n"; >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 012804a0ec..6d7a4d28e1 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1727,7 +1727,7 @@ CREATE TABLE `issues` ( -- information related to check outs or issues > `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out > `returndate` datetime default NULL, -- date the item was returned, will be NULL until moved to old_issues > `lastreneweddate` datetime default NULL, -- date the item was last renewed >- `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed >+ `renewals` tinyint(4) NOT NULL default 0, -- lists the number of times the item was renewed > `auto_renew` BOOLEAN default FALSE, -- automatic renewal > `auto_renew_error` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, -- automatic renewal error > `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched >@@ -1759,7 +1759,7 @@ CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r > `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out > `returndate` datetime default NULL, -- date the item was returned > `lastreneweddate` datetime default NULL, -- date the item was last renewed >- `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed >+ `renewals` tinyint(4) NOT NULL default 0, -- lists the number of times the item was renewed > `auto_renew` BOOLEAN default FALSE, -- automatic renewal > `auto_renew_error` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, -- automatic renewal error > `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched >-- >2.20.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 22607
:
87154
| 87208