Upgrading the Senzing Repository Schema to v4
When upgrading from Senzing v3 to Senzing v4, there are changes made to the entity repository database schema. The database(s) used by Senzing must be updated accordingly.
This is the first of two steps. After the schema is upgraded, continue to Upgrade ER Config to v4 .
Database upgrade SQL scripts
Upgrade scripts for the Senzing entity repository are provided as part of the SDK packages. They provide the SQL statements needed to upgrade the database and are named with the database type and SDK version numbers, for example:
szcore-schema-postgresql-upgrade-3.0-to-4.0.sql
Each SQL script file contains the SQL statements needed to update the database from one major version to the next, for a specific database vendor.
Generating complete scripts
The sz_dbtool utility, available in bin/, performs the repository schema upgrade.
The tool locates the repository from the first of these it finds:
-c <INI file>, an explicitsz_engine_config.ini. Use when the engine configuration you want is not the one the environment already points at.SENZING_ENGINE_CONFIGURATION_JSON.SENZING_ROOT, set by a project’ssetupEnv, which resolves to that project’s ownsz_engine_config.ini.
Example syntax:
sz_dbtool upgrade -o <outputDirectory>
Example syntax with example parameters:
sz_dbtool upgrade -o ~/outputDir
This command generates the SQL upgrade script file from the current repository version to the current Senzing v4 engine version.
Review the generated script, then have your DBA run it against the database. For a v3 repository the plan reports 3.0 -> 4.0, and once the script has run the repository schema version becomes 4.0.
sz_dbtool also reports schema drift, such as a missing index, against a live database:
sz_dbtool analyze
The sz_dbupgrade utility, available in <project_path>/bin, is used to compute full database update scripts; even when crossing several versions or using multiple database types.
Example syntax:
sz_dbupgrade -c <INI file> -o <outputDirectory>
Example syntax with example parameters:
sz_dbupgrade -c ~/senzing/etc/sz_engine_config.ini -o ~/outputDir
This command generates the SQL upgrade script file from the current repository version to the current Senzing v4 engine version.
Precautions
sz_dbtool defaults to a dry run, writing the generated SQL to stdout or to -o <outputDirectory>. It applies changes to the database only when passed --apply.
sz_dbupgrade can perform the database update itself with the -a argument and no -o argument.
Next step
With the schema at 4.0, continue to Upgrade ER Config to v4
to upgrade the entity resolution configuration.
If you have any questions, contact Senzing Support. Support is 100% FREE!