Bug 20175

Summary: Set a correct default value for club_enrollments.date_created
Product: Koha Reporter: Julian Maurice <julian.maurice>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Julian Maurice <julian.maurice>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, katrin.fischer, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20144
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 17258    
Attachments: Bug 20175: [sql_modes] Set a correct default value for club_enrollments.date_created
Bug 20175: [sql_modes] (follow-up) Set a correct default value for club_enrollments.date_created
Bug 20175: [sql_modes] Set a correct default value for club_enrollments.date_created
Bug 20175: [sql_modes] (follow-up) Set a correct default value for club_enrollments.date_created

Description Julian Maurice 2018-02-12 13:16:18 UTC
This bug is a continuation of bug 20144
Comment 1 Julian Maurice 2018-02-12 13:18:58 UTC
Created attachment 71464 [details] [review]
Bug 20175: [sql_modes] Set a correct default value for club_enrollments.date_created

0000-00-00 00:00:00 is not a valid timestamp.

It will fix the installer and upgrade process

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 2 Julian Maurice 2018-02-12 13:19:01 UTC
Created attachment 71465 [details] [review]
Bug 20175: [sql_modes] (follow-up) Set a correct default value for club_enrollments.date_created

From comment 6:
"""
Can't recreate database, when creating table structure, I got:
there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT
or ON UPDATE clause

I am on mysql 5.5.59, which is still default in jessie, more timestamp
columns are possible from mysql 5.6.5:
https://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-5.html
"""

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 3 Julian Maurice 2018-02-12 13:23:42 UTC
Not sure about this one. Shouldn't date_created be set to "now" in Koha::Club::Enrollment->store ?
Comment 4 Jonathan Druart 2018-02-12 13:31:15 UTC
It is set in svc/club/enroll

 50             date_enrolled  => \'NOW()',
 51             date_created   => \'NOW()',

Which it weird and wrong. 
I considered it as out of the scope if there is no regression.
Comment 5 Julian Maurice 2018-02-12 14:38:21 UTC
Created attachment 71477 [details] [review]
Bug 20175: [sql_modes] Set a correct default value for club_enrollments.date_created

0000-00-00 00:00:00 is not a valid timestamp.

It will fix the installer and upgrade process

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 6 Julian Maurice 2018-02-12 14:38:25 UTC
Created attachment 71478 [details] [review]
Bug 20175: [sql_modes] (follow-up) Set a correct default value for club_enrollments.date_created

From comment 6:
"""
Can't recreate database, when creating table structure, I got:
there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT
or ON UPDATE clause

I am on mysql 5.5.59, which is still default in jessie, more timestamp
columns are possible from mysql 5.6.5:
https://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-5.html
"""

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 7 Jonathan Druart 2018-02-12 21:09:15 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 8 Katrin Fischer 2018-07-11 15:23:03 UTC
Maybe we should consider backporting this or at least fixing kohastructure in the other branches. We ran into the problem updating an instance to 17.11 today.
Comment 9 Katrin Fischer 2018-07-11 15:23:39 UTC
Also it came up on the mailing list a few times now.
Comment 10 Fridolin Somers 2018-07-12 06:28:02 UTC
(In reply to Katrin Fischer from comment #8)
> Maybe we should consider backporting this or at least fixing kohastructure
> in the other branches. We ran into the problem updating an instance to 17.11
> today.

Same for us, we have patched our 17.11 with this for our upgrades.
Comment 11 Fridolin Somers 2018-07-12 06:29:18 UTC
Pushed to 17.11.x for 17.11.08.

The db update can be run even if already applied.