Bug 13380: Follow-up - only run database update, when it hasn't been run already
authorKatrin Fischer <Katrin.Fischer.83@web.de>
Mon, 23 Mar 2015 20:42:14 +0000 (21:42 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Wed, 8 Apr 2015 14:08:20 +0000 (11:08 -0300)
commitab326b368b1eb715b3a203dcb0edc88de59a0fac
tree68a00dcd623fefa5e18e12185a12bac203a51ffc
parent56a147da32492954a2a417a5e4f3766ae734f45a
Bug 13380: Follow-up - only run database update, when it hasn't been run already

As the ORDER_CANCELLATION_REASON authorised value has been
backported to 3.18.5, we need to make sure that the database
update is only run once.

This patch adds a check for the existance of the authorised
value in order to decide if the databaes update can be run.

To test:
- Create a branch 3.19.00.016
- Make sure you have a few orders where the cancellationreason
  is set (cancel an order, enter a reason)
- Update your branch to master + this patch
- Run the web installer
- ORDER_CANCELLATION_REASON authorised value category is created
- Reset your system preference Version to 3.19.00.015
- Run database update again - no changes are made, all is fine

Or:
- Create a branch 3.18.04 with cancelled orders
- Update to latest 3.18.x
- Make sure ORDER_CANCELLATION_REASON has been created
- Dump database
- Switch to master without this patch
- Run update - verify more O_C_R were created (bad)
- Load database
- Update to master with this patch
- All should be fine

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
installer/data/mysql/updatedatabase.pl