Bug 25078: Put db revs into different files to handle them better
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 29 Jan 2021 11:50:27 +0000 (12:50 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 16 Aug 2021 09:55:56 +0000 (11:55 +0200)
commit8c07ba4c80415d579779ddb0b1f344f07d15b169
treedfde0bdb49eb071839a1d784237c07a6b9c36e0a
parent64ccbdb8f223cc7f8320dd09262ecd6724da4266
Bug 25078: Put db revs into different files to handle them better

This patch suggests to stop using updatedatabase.pl to add new DB revs.
Each DB rev will be in a separate pl files (installer/data/mysql/db_revs).

The switch should ideally be done from 21.06.00.000.

Each DBrev is executed in a try block and a transaction. If something
went wrong, the whole DB rev is rolled back.

Why do /var/log/koha/kohadev/updatedatabase_*.log (not -error) contain
    Status: 500
    Content-type: text/html

    <h1>Software error:</h1>
etc.

Test plan:
- git checkout c4b4db21d25 (master on 2021-07-08)
- Set the version syspref to 21.0500000:
    > update systempreferences set value="21.0500000" where variable="version";
- Apply "Bug 25078: [DO NOT PUSH] DB revs for testing" (restart_all)
- Read the different DBrevs created as examples
- Make sure the different use cases are covered
- execute the updatedatabase script (CLI)
- Set the version syspref to 21.0500000
- Update the DB from the UI
- Set the version syspref to 21.0500000
- execute the updatedatabase script with the --force parameter (for
testing purpose)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/Installer.pm
installer/data/mysql/db_revs/210600000.pl [new file with mode: 0644]
installer/data/mysql/db_revs/skeleton.pl [new file with mode: 0644]
installer/data/mysql/updatedatabase.pl
installer/install.pl
koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt