-
Notifications
You must be signed in to change notification settings - Fork 55
Database upgrade from version 2.X
In GeoFence 3 changes to the database schema has been introduced. In order to migrate your database from GeoFence 2.X to GeoFence 3 you will have to upgrade GeoFence database as follows:
Take a backup of the database first. Then edit your geofence-datasource-ovr.properties and set the following configuration parameter to update
:
geofenceEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=update
Now Start GeoFence 3.X . GeoFence will automatically update the database schema. Stop GeoFence again and run the following update statements to update the entries of your database for users and roles:
Users update:
update gf_rule r
set username = (select u.name from gf_gsuser u where r.gsuser_id=u.id)
where username is null and r.gsuser_id is not null
Roles update:
update gf_rule r
set rolename = (select g.name from gf_usergroup g where r.usergroup_id=g.id)
where r.usergroup_id is not null and rolename is null
Finally set the configuration parameter back to validate
in your geofence-datasource-ovr.properties
geofenceEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=validate
That's it. you can optionally remove the old gsuser_id
and usergroup_id
columns from the gf_rule
table since are not being used anymore
ALTER TABLE gf_rule DROP COLUMN gsuser_id
ALTER TABLE gf_rule DROP COLUMN usergroup_id