Skip to content

Getting Started

Requirements

  • PHP 8.2+
  • PDO
  • A supported PDO database driver

Installation

composer require eril/migraw

Initialize

For MySQL/MariaDB:

php vendor/bin/migraw init

or:

php vendor/bin/migraw init:mysql

For PostgreSQL:

php vendor/bin/migraw init:pgsql

For SQLite:

php vendor/bin/migraw init:sqlite

This creates migraw.php and, when necessary, the migrations directory. you can also use --force to overwrite the current migraw.php file.

Create your first migration

php vendor/bin/migraw make create_users_table

By default Migraw generates the template configured in migraw.php.

To run migrations:

php vendor/bin/migraw migrate

You can also use:

php vendor/bin/migraw up

Check status

php vendor/bin/migraw status

Roll back

php vendor/bin/migraw rollback

or:

php vendor/bin/migraw down

Preview SQL

php vendor/bin/migraw migrate --dry-run

--pretend is also supported.

Next