Skip to content

1.3.0 database: CI checks that stop drift #126

Open

Description

@fjlopez

Goal

CI fails when the database definition drifts from the code, or when an install or an upgrade breaks.

What changes

  • Fresh install on every database. Apply the 1.3.0 changelog to empty H2, PostgreSQL, Oracle Free 23, and Oracle XE 21 databases, then start the backend. Oracle XE 21 keeps the SQL compatible with Oracle 19c.
  • Upgrade from 1.2.9. Restore 1.2.9 PostgreSQL and Oracle databases, start 1.3.0, and check that a second start changes nothing. This replaces the seven upgrade jobs from 1.2.6, 1.2.7, and 1.2.8 in liquibase-upgrade.yml.
  • Backend tests on all three databases. testPostgres and testOracle run with the same test profile as H2 (test,postgres and test,oracle). Today they skip it, so test-only settings do not apply. Tests that swap in an H2 database while the Oracle profile is active use the real test database instead.
  • Code matches data. CodeListsTest lists every code list value the backend, admin, viewer, and mobile apps depend on, and checks that the database has it.
  • History cannot be edited. The changelog immutability check covers sitmun-backend/src/main/resources/db/changelog/ and compares against the latest v* release tag:
    • files that tag shipped (baseline/ and earlier releases/ files) cannot change;
    • in the open release file, merged changesets cannot change, only new ones can be added at the end;
    • every release file except the open one ends with a tagDatabase changeset matching its name, and the master includes release files in version order.
  • No demo or test data in production. CI lists the changelog files inside the built backend jar and image and fails if any comes from profiles/ or src/test/resources/. A fresh install with the shipped master has no demo applications, territories, services, or test users.
  • Demo still works. The stack starts on PostgreSQL with profiles/development-postgres.env unchanged and the root E2E suites that use demo data pass.
  • Retire the old drift scripts. compare-schema-drift.sh and the seed identity checks are no longer needed once only one changelog exists.

These checks need the monorepo (#105). Today the stack's CI cannot see changes inside the backend repository.

Done when

  • A pull request that edits a shipped changelog file, removes a code list value the code uses, puts demo or test data in the jar, or breaks a fresh install or a 1.2.9 upgrade fails CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plannedActive backlog; exempt from stale bot

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions