[Koha-bugs] [Bug 27880] Database migrations in separate files

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Nov 25 11:41:39 CET 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27880

--- Comment #5 from Julian Maurice <julian.maurice at biblibre.com> ---
Created attachment 127998
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127998&action=edit
Bug 27880: Store each database migrations state in database

This patch is the continuation of bug 25078. It improves it by
decorrelating database migrations from Koha version number, which allows
to prevent that a database migration is executed twice, even if present
in two different stable releases.

Database migrations are regular Perl scripts that return migration
metadata and code in a hashref.
Their filename is meaningful. It should always start with a timestamp
(in the form YYYYMMDDHHMMSS), which is used for executing migrations in
the correct order. It should also contain a short description.

Once a migration has been successfully executed, its name is stored into
a new table `executed_migrations`. This is how we avoid executing a
migration twice.

With this new system, the 'Version' system preference becomes useless,
as well as the 4th part of the Koha version. A good part of the patch is
about adapting the code to these changes.

Test plan:
1. Apply patch and restart starman
2. Go to the staff interface, you should be redirected to the installer
3. Enter your credentials, click on "Continue to the next step" until
   you arrive at the "Update database" step
4. You should now see the following message:
   Pending migrations:

     20201002135449-create-executed-migrations-table.pl
   Click on "Update your database"

5. Now you should see
   Update report :

   Migration done:
   20201002135449-create-executed-migrations-table.pl (Create table
executed_migrations)

   Everything went okay. Update done.

6. Log into Koha
7. Verify that the About page shows the correct version
8. Verify that the 'Help' link in the top right corner redirects to the
   correct version of the manual

9. Now, do a fresh install and verify that the executed_migrations table
   exists and is not empty at the end of the install process

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list