Creating Postgres Database

MyBatis Migrations

MyBatis migrations(http://www.mybatis.org/migrations)   is used to create or migrate the database and to manage migrations. 

Its is used to create the database objects i.e schema, tablespaces, tables, indexes in the postgres database.

Manual Installation of MyBatis Migrations

  1. Download the latest MyBatis Migrations from Github https://github.com/mybatis/migrations/releases
  2. Unzip the downloaded file.
  3. Set the PATH environment variable to include the bin folder in unzipped folder
  4. Type migrate info on the terminal to confirm migrate command has been set up successfully. You should see something similar to the below

Creating the OpenSRP database

  1. Create the OpenSRP user and database
  2. Create the OpenSRP tablespaces locations. These locations are in the .properties of the environment 

    core_tablespace_location='/opt/postgres/core'

    error_tablespace_location ='/opt/postgres/error'

    schedule_tablespace_location='/opt/postgres/schedule'

    feed_tablespace_location='/opt/postgres/feed'

    form_tablespace_location='/opt/postgres/form'

  3. To set up the database objects just run the command below(Make sure to update the username,password and database in .properties to reflect the details used in step 1)

      migrate up  --path=assets/migrations


This will set the database and create the prerequisite database objects e.g schema, tables, etc.

Edit context.xml and update the postgres user, password and database name




 


Related pages