Repository navigation
Database Migrations
Kubernetes production deployments run an explicit migration Job before application rollout; application startup verifies the expected schema. Revision
20260726_0001 either creates a fresh schema or adopts a complete existing
ServiceOps schema without rewriting operational data.
The baseline downgrade deliberately fails because deleting an adopted database is not a safe rollback. Later schema revisions must provide a reversible one-revision downgrade and verification queries. Removing the baseline requires restoring the validated pre-migration backup.
This additive revision follows 20261009_0117 and adds nullable source_platform fields to comments and task history. Existing activity retains its original content and attribution. New authenticated mobile activity can carry iOS; browser headers do not set this field. Preservation, repeated upgrade and one-revision downgrade checks passed.
Follows 20261011_0118. The unique key on approval-authority group links included the nullable team column, and PostgreSQL treats NULLs as distinct, so a tenant-wide authority (CCB, executive, record approval) could link the same group twice. The revision removes duplicates, keeping the oldest link, and adds a tenant-wide unique index. Approver lists never changed, because group members are resolved as a set.
Follows 20261011_0119. Adds per-field visibility for public profiles on user preferences. Mobile phone and employee ID default to private. PostgreSQL upgrade and rollback were verified.
Follows 20261011_0120. Adds the nullable user.mfa_last_totp_step (bigint): the time step of the last accepted TOTP code, so the same code cannot sign in twice. Existing users start with no recorded step. Verified on PostgreSQL 17 from an empty database to head, then a one-revision downgrade and roll-forward with 20,098 seeded records: data preserved.
Follows 20261012_0121. Adds the web_push_subscription table (per-browser push endpoints, keys encrypted at rest, unique endpoint hash). Additive; the downgrade drops the new table.
Follows 20261013_0122. PostgreSQL only: trigram (GIN) indexes on comment.body, ticket.number and configuration_item.description, so global search no longer reads every comment and ticket (20,000 tickets and 40,000 comments: ticket search query 86–310 ms → 1–2 ms). Other databases skip it. Downgrade drops the indexes; round trip verified.
Follows 20261013_0123. Contract revision (runs after 1.113.40): replaces the installation-wide UNIQUE (asset_tag) with a unique index on (tenant_id, lower(asset_tag)), so two tenants may use the same tag while a tenant still cannot repeat one in any letter case. Earlier application versions keep working (they check tags across all tenants before inserting). On SQLite the table is rebuilt. The downgrade restores the global constraint and fails, as it must, while two tenants share an identical tag. Verified on PostgreSQL and on SQLite with column- and table-level constraints.
Follows 20261013_0124. Additive: tables project, project_member, project_status, work_item, work_item_assignee, work_item_watcher, work_item_label, work_item_comment, work_item_history and work_item_link, plus the nullable file_attachment.work_item_id. Every table carries tenant_id; project keys are unique per tenant and work item numbers unique per project. The downgrade drops them, looking up constraint names so it works on a migrated database and on one built fresh by the baseline revision. Verified on PostgreSQL 17 from both.
Follows 20261014_0125. Additive.
New tables:
-
work_item_resolution,work_item_link_type; -
project_component,project_version; -
work_item_component,work_item_fix_version,work_item_affects_version; -
work_item_worklog,work_item_vote,project_star,work_item_view; -
work_item_comment_reaction,work_item_key_alias.
New columns:
-
project: category, default assignee; -
work_item: remaining and spent time, environment, resolution, flag; -
work_item_comment: visibility.
Resolutions and link types are created with Jira's defaults the first time a tenant needs them. The downgrade drops the tables and columns, looking up constraint names. Verified on PostgreSQL 17 from a migrated and a freshly built schema.
Current head: 20261014_0126.
Take and restore-test a backup before deployment. Run the chart's migration job, then roll out matching application and worker images. Helm upgrades use --wait without --atomic, because committed migrations must not automatically roll back to an incompatible application image. Never manually stamp the schema version. Deployment and recovery records the acceptance process.