Upgrading from 1.0 to 1.1 - AtlasOfLivingAustralia/image-service Wiki

Database

Image service 1.1 uses Flyway for database migration. However, due to differences in pre-1.1 setup methods, these migrations may fail so some additional steps may be required. Please review the following steps and apply to your installation.

DB objects owner

Image Service 1.1 removes the reliance on the database user being a PostgreSQL superuser. When upgrading using the ala-install ansible playbook, you may find that some database objects are owned by the postgres superuser role. To ensure that all database objects belong to the correct user, run the following just prior to upgrading:

sudo -u postgres -s
export IMAGES_USER=images
psql -c "ALTER DATABASE images OWNER TO $IMAGES_USER"
for tbl in `psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" images` ; do psql -c "alter table \"$tbl\" owner to $IMAGES_USER" images ; done
for tbl in `psql -qAt -c "select sequence_name from information_schema.sequences where sequence_schema = 'public';" images` ; do  psql -c "alter sequence \"$tbl\" owner to $IMAGES_USER" images ; done
for tbl in `psql -qAt -c "select table_name from information_schema.views where table_schema = 'public';" images` ; do  psql -c "alter view \"$tbl\" owner to $IMAGES_USER" images ; done
psql -c "alter function if exists "export_images" owner to $IMAGES_USER;" images
psql -c "alter function if exists "export_index" owner to $IMAGES_USER;" images