migrations

Manage OrangeHRM forward-only database migrations using Doctrine DBAL SchemaHelper and helper classes.

1.1k|746|Updated Jan 5, 2017
One-click install
npx skills add https://github.com/orangehrm/orangehrm --skill migrations-orangehrm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrations
Source: https://github.com/orangehrm/orangehrm/tree/main/.agents/skills/migrations
Command: npx skills add https://github.com/orangehrm/orangehrm --skill migrations-orangehrm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the risk of broken OrangeHRM database upgrades, failed schema changes, and inconsistent version states by providing a complete reference for the project's custom migration system, covering both fresh installs and existing instance upgrades.

Core Features & Use Cases

  • Migration System Reference: Covers the installer vs upgrader entry points, the MIGRATIONS_MAP registry, and the AbstractMigration contract for authoring new migrations.
  • Helper Class Guidance: Documents SchemaHelper for Doctrine DBAL schema changes, LangStringHelper for i18n string updates, ConfigHelper for hs_hr_config writes, and DataGroupHelper for permission seeding.
  • Use Cases: Use this Skill when writing new migrations for a release, bumping the product version, debugging failed migration runs, recovering half-applied schema changes, or answering questions about how install vs upgrade processes select which migrations to execute.

Quick Start

Use the migrations skill to create a new forward-only database migration for the next OrangeHRM release that adds a custom column to the employee table and updates the associated language strings.

Frequently Asked Questions about migrations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a new database schema migration for an OrangeHRM product upgrade?

To write a new database schema migration for OrangeHRM, you implement the AbstractMigration contract and register the migration in the MIGRATIONS_MAP registry to ensure the upgrader executes it during version bumps.

How does the OrangeHRM migration system decide which schema changes to execute during a fresh install versus an existing upgrade?

The OrangeHRM migration system uses separate installer and upgrader entry points that reference the MIGRATIONS_MAP registry to select and execute the correct forward-only schema changes based on the current product version.

Can I use Doctrine DBAL directly when authoring database schema changes in OrangeHRM?

Yes, you use Doctrine DBAL for DDL operations through the project's SchemaHelper class, which provides a consistent wrapper for applying schema modifications during OrangeHRM database migration workflows.

What is the best way to recover a half-applied database schema change after a failed migration execution in OrangeHRM?

Recovering a half-applied schema change after a failed migration execution involves debugging the specific migration run through the OrangeHRM upgrader entry point and correcting the incomplete database state before re-running.

How do I update language strings and configuration values during an OrangeHRM database migration?

You update language strings and configuration values during a migration by leveraging the built-in LangStringHelper for i18n updates and ConfigHelper for writing to the hs_hr_config table.

Why do I need to bump the product release version when adding new migrations to OrangeHRM?

Bumping the product release version is required because the OrangeHRM migration registry uses versioning conventions to track which forward-only schema changes have been applied to an existing instance during upgrades.