Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Warning

Prerequisite for successful flyway run with PostgreSQL:

  • there is user/role (e.g. openhubusr)
  • there is database (e.g. openhubdb)
  • there is schema openhub

See db/migration/postgresql/V1_0_0__schema_init.sql init script for more details. If you need to use not concurrent scheduled jobs with Quartz then you must create database structure manually from GitHub scripts.

There are also tables and functions for archivation of "production" tables. Archivation tables have prefix "archive_", e.g. archive_external_call

Function for archivation is called archive_records(integer) where input is number of months after that the message will be archived.



Enabling/disabling flyway in application.properties

...

For more configuration properties, see application.properties in OpenHub source.

Manual db schema creation/update

Flyway does mainly simplify development. On production deployment you may want to manually create or update schema - for example with more priviliged user than is used running the application. Some options:

Migrate tool from flyway

Flyway provides command-line tool that can be used to perform migration. It does setup metadata table as well, so after migration using this tool, even with enabled flyway it should be perfectly valid like done automatically. See https://flywaydb.org/documentation/commandline/ for more info.

Manual SQL scripts

You can sure just disable flyway and just run OpenHub SQL scripts. Downside would be missing metadata table, so you would have to keep track of applied/not applied scripts by your self. Combined approach is possible: apply all scripts, then setup flyway with baseline (flyway.baseline-on-migrate = true & flyway.baseline-version = XXX) to create metadata table with given version. If any new scripts are added, flyway will migrate only on top of baseline version, or fail trying.

Backups

There are also tables and functions for archivation of "production" tables for PostgreSQL. Archivation tables have prefix "archive_", e.g. archive_external_call

Function for archivation is called archive_records(integer) where input is number of months after that the message will be archived.