Child pages
  • Execute Database Updates Module (Design Page)
Skip to end of metadata
Go to start of metadata

Overview

Database updates are packaged into the war file in the liquibase-update-to-latest.xml file. When the user starts openmrs all necessary updates are run.

The problem is that if the user has a large database, some of the changesets take a really long time to run and so could keep users from (re)starting their system for several days. The goal of this module is to allow some changesets to be run before actually installing the new war file and therefore halting the system.

Some changesets can be run before doing the actual update (like adding indexes, adding columns, etc). Some changesets cannot be run unless the user is also starting to use the new war file (like renaming columns, removing columns, changing column types).

Changesets can be run in any order, they do not have to be sequential. Some changesets depend on the database being in a certain state, so some should require that others be already run. Whether or not a changeset has been run is stored by liquibase in the liquibasechangelog table.

Design

Add a page to the administration screen that allows the user to upload a war file. Your page should pull the liquibase file and find all the unrun changesets. See the DatabaseUpdater class for some helpful methods to use or copy.

Allow the user to choose which changesets to run on their database now to try and get ahead of the update. Changesets that add or modify a column should not be allowed to run.

Bonus points for allowing users to "unrun" a changeset. Liquibase has a method for doing this.

Assigned Developer(s)

  • Achyuth Ram Bukkapattanam
  • Jyothi Reddy Anumula
  • David Fleischhauer

Interested Parties

Output / Documentation

Overview and Design Goals:

The goal of this project is to extract the changesets from an xml file called 'liquibase-update-to-latest.xml' which has to be extracted from the uploaded WAR file. Then, the user can manage the running of the changesets. That is, the user can choose which changesets to run ahead of the update. For instance, changesets like CreateIndexChange, CreateProcedureChange, CreateSequenceChange, CreateTableChange, CreateViewChange, AddChangeChange etc., can be considered as safe and the user can run such changesets ahead of the update.

Design Goals:

  1. The major goal of the project is to reduce the number of chagesets to be run, each time we restart the system. 
  2. To create a page for the user to upload the WAR file.
  3. To extract the WAR file and identify the 'liquibase-update-to-latest.xml' present in it and identify the changesets present in this xml file.
  4. To allow user to run safe changesets ahead of the update.

Road-map:

  1. Firstly, we need to click on the link 'Click here to upload the WAR file' which will take us to a new page where we can upload the WAR file.
  2. We have to then select the WAR file to be uploaded and click on the upload button.
  3. The WAR file will then be extracted and all the changesets will be identified and will be run. A notification about whether the file was uploaded, whether the WAR file uploaded contains the 'liquibase-update-to-latest.xml' will be displayed in the next page. Also the changesets which were run ahead of the update will also be displayed.
  • No labels

3 Comments

  1. Please make sure to be strict about only letting people run changesets that we're sure are safe. E.g. create index, add column. We don't want to let people screw up their databases.

    1. ya we are allowing only safe changesets to run.

      We identified the following as safe.

      CreateIndexChange;

      CreateProcedureChange;

      CreateSequenceChange;

      CreateTableChange;

      CreateViewChange;

      AddColumnChange;

  2. Where did the outcome of this project end up? Do we have the code somewhere that we can release as an omod?