MOF Database Repository (MOFDB)
Also known as MOF-DB (nr-mof-db).
Repository status: Private, hosted in the
bcgov-cGitHub organization. See Requesting access below to get involved.
What it does
The Ministry of Forests Database repository (nr-mof-db) is the single source of truth for all Oracle database structure (DDL) changes to the Ministry of Forests application databases, in both test and production.
Before this repository existed, database change scripts were spread across dozens of separate SVN repositories, in varying states of accuracy. There was no reliable way to know what was actually deployed, no early warning when two teams were about to change the same objects, and no automated check before a database administrator (DBA) reviewed a deployment package by hand.
MOFDB fixes that. Every change follows the same governed path, with automated checks and a full audit trail.
Who it’s for
| Role | What they do here |
|---|---|
| Developer (staff or contractor) | Writes database change scripts, opens a pull request and responds to automated feedback |
| Database administrator (DBA) | Downloads a ready-made deployment package from the pull request, deploys to test and then production, and records progress with GitHub labels |
| Product owner | Tracks the status of a requested change through the pull request’s audit trail |
How a change is delivered
Every database change moves through these steps in GitHub. There are no email attachments or shared drives, and no doubt about what is deployed where.
- The developer writes a change script and a rollback script, pushes a branch and opens a pull request.
- A change request is raised and scheduled.
- Automated checks validate the SQL rules and structure.
- If the checks pass, automation packages the change and an ordered deployment guide.
- The DBA deploys the package to test.
- The DBA applies the
1-DEPLOYEDlabel. - The developer or tester confirms the change in test and applies the
2-VALIDATEDlabel. - The DBA deploys to production and applies the
3-COMPLETElabel. - The pull request is merged, and migration files are renamed automatically.
What the automation does
- SQL checks on every push: a custom Node.js validator checks schema naming, file naming, folder placement and separation of object types (tables, constraints, foreign keys, views and grants each have their own folder).
- Deployment packages: when SQL under
scripts/changes, the pipeline packages the migration files with an ordered deployment guide for the DBA and attaches it to the pull request. - Label-based approval gates: all three labels (
1-DEPLOYED,2-VALIDATED,3-COMPLETE) must be present before a pull request can be merged. This creates a timestamped record of who approved each stage and when. - Stale approval protection: if new SQL is pushed to an open pull request, the labels are cleared automatically, so an earlier DBA approval cannot carry over to revised scripts.
- Local testing: developers can run a local Oracle database in Docker and apply every migration before opening a pull request, catching errors before they reach the DBA.
Why it matters
- Reducing risk: conflicts are caught before deployment, not during it, and every change can be rolled back
- Efficiency: DBAs receive a complete, ordered package instead of assembling one by hand
- Accountability: every change has a full, timestamped audit trail
- Value for money: less rework and fewer failed deployments across all Ministry of Forests applications
| Before | After |
|---|---|
| Scattered, out-of-date change scripts | One repository and one source of truth for all Ministry of Forests database objects |
| Conflicts found late, at deployment | Developers see each other’s pending changes in open pull requests |
| Unreliable development environments | Any developer can build a complete local database with one command |
| Manual, error-prone delivery | An ordered deployment package attached to every pull request |
| No deployment audit trail | Labels, timestamps and commit history give a full record |
| No version history of the database structure | Every change is versioned and kept |
Technology
| Component | Role |
|---|---|
GitHub (bcgov-c organization) |
Source of truth, pipelines, pull request workflow and audit trail |
| GitHub Actions | SQL checks, packaging and approval gates |
| Alembic (customized) | Runs Flyway-compatible migrations locally and in Docker |
| Docker and Oracle | Local database for testing before a pull request |
| Node.js validators | Custom rule engine with no external dependencies |
SQL files follow Flyway versioning conventions (V{major}.{minor}__description.sql), so migration order is clear and cannot change once merged.
Requesting access
The repository is private and hosted in the bcgov-c GitHub organization. Access is approved by Forestry Digital Services.
- Contact FDS through Microsoft Teams: use the Teams channel for your project. A team member will confirm your role and start the request.
- Confirm your GitHub account: you need an existing GitHub account, linked to your IDIR or business identity if your organization’s policy requires it.
- Access is granted to this repository only: contractors and external developers usually receive write access; DBA reviewers usually receive read access.
Requests for contractors must come from the ministry product owner sponsoring the work.