PHPackages                             drago-ex/migration - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. drago-ex/migration

ActiveLibrary[CLI &amp; Console](/categories/cli)

drago-ex/migration
==================

A simple CLI tool for running SQL migrations.

v2.0.6(2w ago)01432MITPHPPHP &gt;=8.3 &lt;9CI passing

Since Dec 30Pushed 2w agoCompare

[ Source](https://github.com/drago-ex/migration)[ Packagist](https://packagist.org/packages/drago-ex/migration)[ RSS](/packages/drago-ex-migration/feed)WikiDiscussions main Synced today

READMEChangelog (8)Dependencies (30)Versions (10)Used By (2)

Drago Migration
===============

[](#drago-migration)

A simple CLI tool for running SQL migrations. Drago Migration is a lightweight CLI tool built on Nette, Dibi and Symfony Console. It allows you to run SQL migrations from files or directories with checksum validation, transactional execution and database-level locking.

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://github.com/drago-ex/migration/blob/main/license)[![PHP version](https://camo.githubusercontent.com/732c0d3857e03fa46e39a7a8c50a9400151518cdd0e4cbf3c97ae7c3c2772066/68747470733a2f2f62616467652e667572792e696f2f70682f647261676f2d65782532466d6967726174696f6e2e737667)](https://badge.fury.io/ph/drago-ex%2Fmigration)[![Coding Style](https://github.com/drago-ex/migration/actions/workflows/coding-style.yml/badge.svg)](https://github.com/drago-ex/migration/actions/workflows/coding-style.yml)

Requirements
------------

[](#requirements)

- PHP &gt;= 8.3
- Nette Framework
- Symfony Console
- dibi
- Composer

Installation
------------

[](#installation)

```
composer require drago-ex/migration
```

Examples
--------

[](#examples)

Run migrations using the Composer-installed binary:

```
php vendor/bin/migration db:migrate
```

Path to a single SQL file or a directory containing multiple .sql files.

```
# Run all migrations in a folder
php vendor/bin/migration db:migrate migrations

# Run a single migration file
php vendor/bin/migration db:migrate migrations/001_example.sql
```

Export SQL Migrations
---------------------

[](#export-sql-migrations)

Export migration SQL files from installed Composer packages:

```
php vendor/bin/sql-export
```

By default, SQL files are copied into the `migrations` directory.

Use an optional target directory argument to export files elsewhere:

```
php vendor/bin/sql-export db
php vendor/bin/sql-export temp/sql
```

Existing files are skipped, so the command can be safely run repeatedly.

Automated Package Setup
-----------------------

[](#automated-package-setup)

Projects using [drago-ex/project-tools](https://github.com/drago-ex/project-tools) can run package-defined migration commands through:

```
php vendor/bin/drago-setup
```

Packages expose their setup commands in `composer.json` under `extra.drago-tools.commands`. The migration package provides the migration runner; `drago-setup` only discovers and executes commands defined by installed packages.

Register Migration Extension in Nette
-------------------------------------

[](#register-migration-extension-in-nette)

```
extensions:
    migration: Drago\Migration\DI\MigrationExtension(%consoleMode%)
    console: Contributte\Console\DI\ConsoleExtension(%consoleMode%)

# Symfony Console
console:
	name: Symfony Console
	version: '1.0'
```

Make sure the %consoleMode% parameter is available (usually already present in Nette CLI setups).

Database Setup
--------------

[](#database-setup)

The migrations table is created automatically on the first migration run. The table is created from the package SQL file `migrations/000_migrations.sql`:

```
CREATE TABLE IF NOT EXISTS migrations (
    id INT AUTO_INCREMENT PRIMARY KEY,
    package VARCHAR(255) NOT NULL,
    migration_file VARCHAR(255) NOT NULL,
    checksum CHAR(40) NOT NULL,
    executed_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    CONSTRAINT uq_migrations_package_file
        UNIQUE (package, migration_file)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_unicode_ci;
```

Features
--------

[](#features)

- Checksum validation - detects modified migrations
- Transactional execution - safe rollback on failure
- Database locking - prevents concurrent runs
- Package-aware migrations - supports vendor-based migrations
- Automatic migrations table setup on first run
- Symfony Console integration - clean CLI output

Notes
-----

[](#notes)

- This package is designed for Nette Framework projects.
- The provided CLI binary expects a Nette project structure with app/Bootstrap.php.
- For non-Nette projects, a custom bootstrap script is required.

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance98

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~21 days

Recently: every ~4 days

Total

9

Last Release

14d ago

Major Versions

v1.0.1 → v2.0.02026-05-25

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5998929?v=4)[Zdeněk Papučík](/maintainers/accgit)[@accgit](https://github.com/accgit)

---

Top Contributors

[![accgit](https://avatars.githubusercontent.com/u/5998929?v=4)](https://github.com/accgit "accgit (42 commits)")

### Embed Badge

![Health badge](/badges/drago-ex-migration/health.svg)

```
[![Health](https://phpackages.com/badges/drago-ex-migration/health.svg)](https://phpackages.com/packages/drago-ex-migration)
```

###  Alternatives

[illuminate/console

The Illuminate Console package.

13046.0M6.5k](/packages/illuminate-console)[filegator/filegator

Filegator

3.0k1.1k](/packages/filegator-filegator)[winbox/args

Windows command-line formatter

20720.9k21](/packages/winbox-args)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
