Bug 8480: Add constraint on auth_subfield_structure.authtypecode
authorJonathan Druart <jonathan.druart@biblibre.com>
Tue, 31 Mar 2015 11:18:21 +0000 (13:18 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 18 May 2015 14:15:58 +0000 (11:15 -0300)
commitbf23224c999d6a99d0c23e84bebb59415b4ad28d
tree89e94f160d628b96c5e253f747da85d338471744
parentecc9eb33b7f2f7b0b770135633390e00244921c6
Bug 8480: Add constraint on auth_subfield_structure.authtypecode

In order not to have useless entries in the auth_subfield_structure
table, this patch modifies the DB structure to add a foreign key on the
authtypecode column.
Note that the auth_tag_structure already has this constraint.

Test plan:
0/ Don't apply this patch
1/ Create a now authority type 'RM_ME'
2/ Look at the MARC structure, to create the subfield structure and
populate the auth_subfield_structure table.
3/ Delete the authority type
4/ Using your SQL cli:
 SELECT COUNT(*) FROM auth_subfield_structure WHERE authtypecode='RM_ME';
=> The data are still in this table.
5/ Apply this patch
6/ Execute the updatedb entry
7/ Confirm the entries in the auth_subfield_structure table related to
RM_ME have been deleted
8/ Repeat 1, 2 and 3 and verify the auth_subfield_structure entries have
been correctly removed.

Signed-off-by: Frederic Demians <f.demians@tamil.fr>
- Works exactly as described in the (very good) test plan.
- After authority type deletion, auth_subfield_structure still contains
  entries for deleted authority type. Applying the patch clean the
  previously undeleted records in auth_subfield_strucute. Now deleting a
  authority type cleans propertly all appropriate records in
  auth_subfield_structure.
- Fix a merge conflict

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
installer/data/mysql/kohastructure.sql
installer/data/mysql/updatedatabase.pl