MATIH Platform is in active MVP development. Documentation reflects current implementation status.
18. CI/CD & Build System
Tooling
Database Tools

Database Tools

The database tools manage database creation, schema migrations, privilege grants, and repair operations for all MATIH services across control plane and data plane PostgreSQL instances.


setup-databases.sh

Source: scripts/tools/setup-databases.sh

Creates databases and secrets for all services that require a PostgreSQL database.

Usage

./scripts/tools/setup-databases.sh

Database Definitions

ServiceDatabaseNamespace
config-serviceconfig_dbmatih-control-plane
notification-servicenotification_dbmatih-control-plane
billing-servicebilling_dbmatih-control-plane
audit-serviceaudit_dbmatih-control-plane
iam-serviceiam_dbmatih-control-plane
tenant-servicetenant_dbmatih-control-plane
observability-apiobservability_dbmatih-control-plane
ai-serviceai_dbmatih-data-plane
ml-serviceml_dbmatih-data-plane
data-plane-agentagent_dbmatih-data-plane
pipeline-servicepipeline_dbmatih-data-plane
data-quality-servicequality_dbmatih-data-plane

Operations

  1. Read PostgreSQL admin password from Kubernetes secret
  2. For each service: create database if not exists
  3. For each service: create application user if not exists
  4. For each service: create Kubernetes secret with connection string

flyway-repair.sh

Source: scripts/tools/flyway-repair.sh

Repairs Flyway migration state for Java services that use Flyway for database schema management.

Usage

./scripts/tools/flyway-repair.sh <service-name>

When to Use

ScenarioAction
Failed migration left schema in inconsistent stateRun repair to fix checksum
Migration was manually appliedRun repair to mark as applied
Version conflict after branch mergeRun repair to recalculate checksums

grant-db-schema-privileges.sh

Source: scripts/tools/grant-db-schema-privileges.sh

Grants schema-level privileges to service database users. Used when services need access to schemas created by other services.

Usage

./scripts/tools/grant-db-schema-privileges.sh

Libraries Used

LibraryPurpose
core/logging.shUnified logging
k8s/secrets.shSecret management

Related Pages