PHPackages                             eril/migraw - 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. eril/migraw

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

eril/migraw
===========

Simple SQL-first migrations for PHP.

v1.1.0(3w ago)02MITPHPPHP ^8.1CI passing

Since Jun 30Pushed 3w agoCompare

[ Source](https://github.com/erilshackle/php-migraw)[ Packagist](https://packagist.org/packages/eril/migraw)[ Docs](https://github.com/erilshackle/php-migraw)[ RSS](/packages/eril-migraw/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Migraw
======

[](#migraw)

SQL-first migrations for PHP.

**Write SQL. Not magic.**

Migraw is a lightweight migration tool that embraces SQL instead of hiding it.

Write raw SQL when you need complete control, generate smart SQL templates to get started quickly, or use the optional schema builder for common table operations.

---

Features
--------

[](#features)

- SQL-first migrations
- Raw SQL support
- Lightweight schema builder
- Smart migration templates
- MySQL, MariaDB, PostgreSQL and SQLite support
- Driver-aware schema helpers
- Migration batches
- Rollback support
- Dry-run mode
- Interactive CLI
- PDO or callable connection
- Framework agnostic
- Zero runtime dependencies

---

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

[](#installation)

```
composer require eril/migraw
```

---

Getting Started
---------------

[](#getting-started)

Generate the default configuration:

```
php vendor/bin/migraw init
```

or choose a specific driver:

```
php vendor/bin/migraw init:mysql
php vendor/bin/migraw init:pgsql
php vendor/bin/migraw init:sqlsrv
php vendor/bin/migraw init:sqlite
```

This creates:

```
migraw.php

database/
└── migrations/

```

---

Configuration
-------------

[](#configuration)

Using a connection array:

```
