Bug 22634

Summary: Standardize table creation for stockrotation* tables in kohacstructure.sql
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: DatabaseAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: lucas, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.05.00, 18.11.05
Circulation function:
Bug Depends on: 11897    
Bug Blocks:    
Attachments: Bug 22634: Standardize table creation for stockrotation* tables in kohastructure.sql
Bug 22634: Standardize table creation for stockrotation* tables in kohastructure.sql
Bug 22634: Standardize table creation for stockrotation* tables in kohastructure.sql

Description Katrin Fischer 2019-04-03 20:33:43 UTC
(In reply to Jonathan Druart from comment #373)
> CREATE TABLE statements do not follow the usual pattern:
> 
>   CREATE TABLE IF NOT EXISTS stockrotationitems
> vs
>  DROP TABLE IF EXISTS `circulation_rules`;
>  CREATE TABLE `circulation_rules` (
Comment 1 Katrin Fischer 2019-04-03 20:38:54 UTC
Created attachment 87373 [details] [review]
Bug 22634: Standardize table creation for stockrotation* tables in kohastructure.sql

The existing pattern is:
DROP TABLE IF EXISTS ...
CRATE TABLE

Stockrotation was using:
CREATE TABLE IF NOT EXISTS ...
which would not recreate the table in a database it's already
existing in possibly causing mismatches in table structure.

To test:
- Drop your database
- Run through the web installer
- Make sure there are no Database/SQL errors
- Makse sure the 4 stockrotation tables have been created
Comment 2 Frédéric Demians 2019-04-07 06:47:34 UTC
Created attachment 87482 [details] [review]
Bug 22634: Standardize table creation for stockrotation* tables in kohastructure.sql

The existing pattern is:
DROP TABLE IF EXISTS ...
CRATE TABLE

Stockrotation was using:
CREATE TABLE IF NOT EXISTS ...
which would not recreate the table in a database it's already
existing in possibly causing mismatches in table structure.

To test:
- Drop your database
- Run through the web installer
- Make sure there are no Database/SQL errors
- Makse sure the 4 stockrotation tables have been created

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Comment 3 Katrin Fischer 2019-04-07 09:54:09 UTC
Thanks Frederic!
Comment 4 Martin Renvoize (ashimema) 2019-04-08 11:56:44 UTC
Created attachment 87507 [details] [review]
Bug 22634: Standardize table creation for stockrotation* tables in kohastructure.sql

The existing pattern is:
DROP TABLE IF EXISTS ...
CRATE TABLE

Stockrotation was using:
CREATE TABLE IF NOT EXISTS ...
which would not recreate the table in a database it's already
existing in possibly causing mismatches in table structure.

To test:
- Drop your database
- Run through the web installer
- Make sure there are no Database/SQL errors
- Makse sure the 4 stockrotation tables have been created

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize (ashimema) 2019-04-08 11:57:06 UTC
Thanks for beating me to this Katrin and Frederic.. PQA
Comment 6 Nick Clemens (kidclamp) 2019-04-11 13:58:38 UTC
Awesome work all!

Pushed to master for 19.05
Comment 7 Martin Renvoize (ashimema) 2019-04-15 17:46:37 UTC
Pushed to 18.11.x for 18.11.05
Comment 8 Lucas Gass (lukeg) 2019-04-19 16:03:36 UTC
missing dependency, wont backport to 18.05.x