Aside from schema changes, modules may also require certain records to exist in the database for proper functionality.
This is considered 'required data' or 'required seed data'.
Examples of this include permissions/scopes in AuthenticationServices, or admin menu items in AdminNavigationServices.
If the module needs 'required data', it will be introduced via changelogs following the naming convention db/changelog/{service-name}.tmforum.required.data.changelog.xml
.
For example, a changelog for AuthenticationServices would be defined in the TMForum Authentication Services Extension module, and would be named db/changelog/auth.tmforum.required.data.changelog.xml
.
Similar to what’s discussed in the Schema Changes section, the META-INF/extension.changelogs
file is also used to drive when these 'required data' changelogs apply.
The file will assign required data changelogs a higher precedence to ensure that they run after the base framework changelogs and base starter required data changelogs, but before all other changelogs (such as those from client extensions).
The end result should be that in client projects, after flex:generate
is run, src/main/resources/db/changelog/{service-name}.flex.{db-platform}.changelog-master.yaml
may look something like this:
Example AuthenticationServices src/main/resources/db/changelog/auth.flex.postgresql.changelog-master.yaml
file
databaseChangeLog:
- changeSet:
id: schema-auth
author: broadleaf-changelog-generation-plugin
changes:
- sql:
sql: create schema if not exists "auth"
- include: # Applies the base framework schema changelog
file: db/changelog/auth.flexdemo.postgresql.changelog-master.yaml
author: broadleaf-changelog-generation-plugin
- include: # Applies the base starter required data changelog
file: db/changelog/auth.starter.required.data.changelog.xml
author: broadleaf-changelog-generation-plugin
- include: # Applies the TMForum required data changelog
file: db/changelog/auth.tmforum.required.data.changelog.xml
author: broadleaf-changelog-generation-plugin
# Other extension changelogs appear here to apply afterward...