Download the PHP package sympress/migration without Composer
On this page you can find all versions of the php package sympress/migration. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sympress/migration
More information about sympress/migration
Files in sympress/migration
Package migration
Short Description MU plugin for handling migrations on website level
License GPL-2.0-or-later
Informations about the package migration
Database Migration System
Standalone WordPress MU-plugin for versioned database migrations with Doctrine-style runtime and metadata management.
Requirements
- WordPress 6.9
- PHP 8.5
- Composer autoloading inside the package directory
The package now targets a real PHP 8.5 baseline and uses modern language features that are stable in the current runtime and QA toolchain, including typed class constants, read-only get-hook properties, readonly classes, #[\Override], and selective #[\NoDiscard].
Quality Gates
friendsofphp/php-cs-fixerhandles deterministic PSR-12-oriented formatting.inpsyde/php-coding-standardshandles the WordPress, VIP, PHPCompatibility, and security-oriented PHPCS audit formigration.phpandsrc/.phpstan/phpstanand PHPUnit cover the full package, including the PHP 8.5 get-hook value objects that PHPCS cannot parse reliably yet.
Installation
- Place the package in
wp-content/mu-plugins/database-migration-system/. - Run
composer installinside the package directory. - Add a root MU loader file because WordPress does not autoload subdirectories.
A ready-to-copy loader example lives in docs/example/mu-loader.php.
Registering Migrations
Use MigrationSystem::getInstance()->createMigrationManager('orders-plugin') when you want to run migrations from an activation hook, deploy hook, admin workflow, or custom release pipeline.
When the project boots SymPress\Kernel\App, the MU plugin also registers its CoreProvider and CliProvider through kernel.
Metadata Storage
The plugin keeps two tables, both shared across all registered plugins:
{$wpdb->prefix}migrationsTracks the current migrated state per plugin slug and migration class.{$wpdb->prefix}migration_historyTracks every execution and metadata-only change for full up/down history.
The history table stores:
- plugin slug
- migration FQCN
- version
- direction
- execution timestamp
Directions are persisted as:
updownmark_upmark_down
This gives you a persistent history for:
- migrating up
- rolling back down
- marking versions as migrated without SQL execution
- marking versions as rolled back without SQL execution
sync-metadata-storage creates both tables. Auto-cleanup only removes them when explicitly enabled and when both current state and history are empty.
See docs/architecture.md for the ordered lifecycle,
state/history model, failure boundary, and SQL executor contract.
SQL Execution Rules
CREATE TABLEstatements run throughdbDelta().- All other statements run through
$wpdb->query(). up()anddown()may return a single SQL string or a list of SQL statements.
This keeps schema creation WordPress-safe while still allowing explicit ALTER TABLE, UPDATE, DELETE, INSERT, DROP, or cleanup statements.
Doctrine-Style Runtime Features
The package focuses on the operational parts that matter in production, similar to Doctrine Migrations:
- migrate to latest
- migrate to a target version
- execute a single migration
upordown - mark a version as migrated or rolled back without executing SQL
- inspect current version
- inspect latest available version
- inspect status and pending versions
- check whether a plugin is up to date
- sync metadata storage
- inspect execution history
Migration targets can be addressed by:
- semantic version, for example
1.0.2 - fully qualified migration class name
- short class name, for example
CreateOrdersTableMigration
WP-CLI
Runtime Commands
Inspection Commands
Metadata Command
Programmatic Usage
Development
License
This package is licensed under GPL-2.0-or-later.