Bug 16565: Drop additional_fields and additional_field_values before creating them
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 23 May 2016 11:19:46 +0000 (12:19 +0100)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Fri, 3 Jun 2016 08:56:44 +0000 (08:56 +0000)
These 2 tables should be dropped before trying to create them

Test plan:
From the SQL CLI, source the kohastructure.sql file
source it again
=> Without this patch you get 2 warnings
ERROR 1050 (42S01) at line 3580 in file:
'installer/data/mysql/kohastructure.sql': Table
'additional_fields' already exi
sts
ERROR 1050 (42S01) at line 3596 in file:
'installer/data/mysql/kohastructure.sql': Table
'additional_field_values' alrea
dy exists

=> With this patch, you won't get them

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

installer/data/mysql/kohastructure.sql

index 42bff46..c5a3f4a 100644 (file)
@@ -3577,6 +3577,7 @@ CREATE TABLE discharges (
 -- This table add the ability to add new fields for a record
 --
 
+DROP TABLE IF EXISTS additional_fields;
 CREATE TABLE `additional_fields` (
   `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
   `tablename` varchar(255) NOT NULL DEFAULT '', -- tablename of the new field
@@ -3593,6 +3594,7 @@ CREATE TABLE `additional_fields` (
 -- This table store values for additional fields
 --
 
+DROP TABLE IF EXISTS additional_field_values;
 CREATE TABLE `additional_field_values` (
   `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
   `field_id` int(11) NOT NULL, -- foreign key references additional_fields(id)