Create and seed databases

Prev Next

There are several databases involved in your Nexus setup. This guide will show you how to create them, create schema and seed them.

Database schema creation and patching

Each Nexus service that uses a database handles the creation and patching of the schema itself, so that it is always in sync with the code. This means that you should not try to create the schema yourself, but rather make sure they are seed properly with configuration.

When Nexus makes queries in a database, it first checks which version it has from the table DbVersion that it creates if it doesn't exists. If the version is lower than the current level needed by the service, one or more patch files will be run in the database and the DbVersion table updated.

Below is the bootstrap order you should follow to get going for a new tenant.

1. Create databases

Create empty databases:

Database Collation Comment
configurations Case insensitive, e.g. Finnish_Swedish_CI_AS
authentication Case insensitive, e.g. Finnish_Swedish_CI_AS If you use Nexus Authentication as a service
businessevents Case insensitive, e.g. Finnish_Swedish_CI_AS If you use Nexus Business Events
valuetranslations Case sensitive, e.g. Finnish_Swedish_CS_AS If you use Nexus Value Translator
match Case insensitive, e.g. Finnish_Swedish_CI_AS If you use Nexus Data Sync

2. Create database schemas and seed

First, handle the configurations database. Then you can take the others in any order.

First: configurations

Option A, script based

  1. Make a request to the Health endpoint in Fundamentals for your tenant: PRDSIM Swagger. This will create the schema in the configurations database.
  2. Seed the database for the services (Fundamentals, Business Events, Value Translator, etc) you use, by sql script. Guide to seeding configurations database

Option B, api based

Use the Configurations api methods in Nexus Fundamentals to create configuration for your services Fundamentals, Business Events, Value Translator, etc. The database will be automatically patched.

authentication

Option A, script based

  1. The configuration for Fundamentals will point to the authentication database. Make a request to the Health endpoint in Fundamentals for your tenant: PRDSIM Swagger. This will create the schema in the authentication database.
  2. Run the authentication seed script in the authentication database. Guide to seeding authentication database

Option B, api based

Use the AuthenticationAdministration api methods in Nexus Fundamentals to create Roles and Clients (the database will be automatically patched)

businessevents

  1. Make a request to the ServiceHealth endpoint in Nexus Business Events for your tenant: PRDSIM Swagger. This will create the schema in the businessevents database.
  2. Seed the database with an sql script. Guide to seeding businessevents database

valuetranslations

  1. Make a request to the ServiceHealth endpoint in Nexus Value translator for your tenant: PRDSIM Swagger. This will create the schema in the valuetranslations database.
  2. Seed the database with an sql script. Guide to seeding valuetranslations database

match

  1. Make a request to the ServiceHealth endpoint in Nexus Data Syncservice for your tenant: PRDSIM Swagger. This will create the schema in the match database.
  2. Seed the database with an sql script. Guide to seeding match database