PHPackages                             8ctopus/nano-migrations - 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. [Database &amp; ORM](/categories/database)
4. /
5. 8ctopus/nano-migrations

ActiveLibrary[Database &amp; ORM](/categories/database)

8ctopus/nano-migrations
=======================

Automate database migrations

2.0.2(7mo ago)093MITPHPPHP &gt;=8.0CI passing

Since May 10Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/8ctopus/nano-migrations)[ Packagist](https://packagist.org/packages/8ctopus/nano-migrations)[ Docs](https://github.com/8ctopus/migration)[ RSS](/packages/8ctopus-nano-migrations/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (8)Versions (6)Used By (0)

nano migrations
===============

[](#nano-migrations)

[![packagist](https://camo.githubusercontent.com/316416b7080b35be2b03ffa44bfa9bfe565d9f887d8bb6a55d6be4b01a4e7e27/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f6e616e6f2d6d6967726174696f6e732f76)](https://packagist.org/packages/8ctopus/nano-migrations)[![downloads](https://camo.githubusercontent.com/60f11d4a83cd549719665ceaa1eb2369c955838fa6b969ae73188cc7186d3e00/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f6e616e6f2d6d6967726174696f6e732f646f776e6c6f616473)](https://packagist.org/packages/8ctopus/nano-migrations)[![min php version](https://camo.githubusercontent.com/15f28c35c752c6b1d3fc0851038c7262756874659529c4718f9539caa2170690/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f6e616e6f2d6d6967726174696f6e732f726571756972652f706870)](https://packagist.org/packages/8ctopus/nano-migrations)[![license](https://camo.githubusercontent.com/8cec507c8cf920c9eb2f19165188e8bd8e61641ce8f26c4e19d84aaa1ad96aa2/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f6e616e6f2d6d6967726174696f6e732f6c6963656e7365)](https://packagist.org/packages/8ctopus/nano-migrations)[![tests](https://github.com/8ctopus/nano-migrations/actions/workflows/tests.yml/badge.svg)](https://github.com/8ctopus/nano-migrations/actions/workflows/tests.yml)[![code coverage badge](https://raw.githubusercontent.com/8ctopus/nano-migrations/image-data/coverage.svg)](https://raw.githubusercontent.com/8ctopus/nano-migrations/image-data/coverage.svg)[![lines of code](https://raw.githubusercontent.com/8ctopus/nano-migrations/image-data/lines.svg)](https://raw.githubusercontent.com/8ctopus/nano-migrations/image-data/lines.svg)

A tiny database migrations package

Migrations are used to manage database schema changes over time. The rationale behind migrations is to make it easier to maintain and evolve the database schema as the application evolves. This package makes it easy to deal with migrations in small projects not using a framework.

demo
----

[](#demo)

- git clone the repository
- run `composer install`
- create the migrations file `touch demo/migrations.txt`
- start Docker Desktop and `docker-compose up &`
- to migrate

    `php demo/index.php migrate []`
- to rollback

    `php demo/index.php rollback `

install
-------

[](#install)

```
composer require 8ctopus/nano-migrations

```

You will need to extend `AbstractPDOMigration` class if you use php `PDO`. Extending the class requires implementing the `up` and `down` migration methods and the potential safety check. Refer to the demo directory example.

```
use Oct8pus\Migration\AbstractPDOMigration;

final class Migration extends AbstractPDOMigration
{
    protected function up1() : string
    {
        return logger?->info('migrations to run:');

        foreach ($methods as $method) {
            $this->logger?->info("- {$method}");
        }

        $this->logger?->warning('Confirm action (y/n): ');
        $input = trim(fgets($stdin));

        fclose($stdin);

        if ($input === 'y') {
            return $this;
        }

        throw new MigrationException('safety check abort');
    }
}
```

For other database engines, extend the `AbstractMigration` class and implement:

- `up` and `down` methods
- database connection
- database query

clean code
----------

[](#clean-code)

```
composer fix(-risky)

```

phpstan
-------

[](#phpstan)

```
composer phpstan

```

phpmd
-----

[](#phpmd)

```
composer phpmd

```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance64

Regular maintenance activity

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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 ~232 days

Total

5

Last Release

219d ago

Major Versions

1.0.1 → 2.0.02023-09-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/4dafd5f7ef8134a5c9b231686c5da3d6416db09139b45aac0b26952178dffb8a?d=identicon)[8ctopus](/maintainers/8ctopus)

---

Top Contributors

[![8ctopus](https://avatars.githubusercontent.com/u/13252042?v=4)](https://github.com/8ctopus "8ctopus (59 commits)")

---

Tags

migrationdatabasepdo

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/8ctopus-nano-migrations/health.svg)

```
[![Health](https://phpackages.com/badges/8ctopus-nano-migrations/health.svg)](https://phpackages.com/packages/8ctopus-nano-migrations)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k605.0M6.8k](/packages/doctrine-dbal)[cakephp/database

Flexible and powerful Database abstraction library with a familiar PDO-like API

9826.4M47](/packages/cakephp-database)[cycle/database

DBAL, schema introspection, migration and pagination

71777.8k53](/packages/cycle-database)[perplorm/perpl

Perpl is an improved and still maintained fork of Propel2, an open-source Object-Relational Mapping (ORM) for PHP.

2411.8k](/packages/perplorm-perpl)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

846.1k](/packages/tommyknocker-pdo-database-class)[bartlett/php-compatinfo-db

Reference Database of all functions, constants, classes, interfaces on PHP standard distribution and about 110 extensions

1185.6k2](/packages/bartlett-php-compatinfo-db)

PHPackages © 2026

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