PHPackages                             franzl/laravel-easy-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. franzl/laravel-easy-migrations

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

franzl/laravel-easy-migrations
==============================

Simple, reversible migrations for Laravel

1.0.1(10y ago)92352[1 issues](https://github.com/franzliedke/laravel-easy-migrations/issues)MITPHPPHP &gt;=5.5.9

Since Mar 28Pushed 10y ago1 watchersCompare

[ Source](https://github.com/franzliedke/laravel-easy-migrations)[ Packagist](https://packagist.org/packages/franzl/laravel-easy-migrations)[ RSS](/packages/franzl-laravel-easy-migrations/feed)WikiDiscussions master Synced 2mo ago

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

laravel-easy-migrations
=======================

[](#laravel-easy-migrations)

**Simple, reversible migrations for Laravel.**

This package makes it easy to create automatically reversible database migrations for common operations. This way, you don't have to deal with the time-consuming and error-prone (not to mention stupid and boring) task of manually writing the `down` logic for your migrations.

- [Installation](#installation)
- [Usage](#usage)
- [Documentation](#documentation)
    - [Creating tables](#creating-tables)
    - [Renaming tables](#renaming-tables)
    - [Dropping tables](#dropping-tables)
    - [Renaming columns](#renaming-columns)
    - [Adding columns](#adding-columns)
    - [Dropping columns](#dropping-columns)

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

[](#installation)

Run `composer require franzl/laravel-easy-migrations` and you're good to go.

Please note that - just like with Laravel - you will need to install the `doctrine/dbal` package if you want to rename columns and/or drop SQLite columns.

Usage
-----

[](#usage)

To create a reversible migration, extend your migration class from the `Franzl\EasyMigrations\EasyMigration` base class. Your task: Overwrite the `change` method, which needs to return another migration instance. Luckily, this package already provides implementations for the most common migration operations.

For example, to add a new `users` table:

```
use Franzl\EasyMigrations\Easy;
use Franzl\EasyMigrations\EasyMigration;
use Illuminate\Database\Schema\Blueprint;

class CreateUsersTable extends EasyMigration
{
    public function change()
    {
        return Easy::createTable('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
        });
    }
}
```

Based on the parameters passed to `Easy::createTable()`, this method will return a migration instance with the `up` and `down` methods already implemented for you.

Documentation
-------------

[](#documentation)

This package currently implements the following four operations:

- Creating tables
- Renaming tables
- Dropping tables
- Renaming columns
- Adding columns
- Dropping columns

More will likely be implemented soon. Feel free to suggest a new operation type by creating an issue.

### Creating tables

[](#creating-tables)

```
public function change()
{
    return Easy::createTable('users', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
    });
}
```

### Renaming tables

[](#renaming-tables)

```
public function change()
{
    return Easy::renameTable('old_users', 'new_users');
}
```

### Dropping tables

[](#dropping-tables)

```
public function change()
{
    return Easy::dropTable('users', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
    });
}
```

Note that, for the migration to be reversible, you will need to pass in a blueprint to restore the table completely. This would be executed when the migration is rolled back.

### Renaming columns

[](#renaming-columns)

```
public function change()
{
    return Easy::renameColumn('users', 'name', 'username');
}
```

### Adding columns

[](#adding-columns)

```
public function change()
{
    return Easy::addColumns('users', [
        'password' => ['string'],
        'registered_at' => ['dateTime', 'nullable' => true]
    ]);
}
```

The second parameter is an array of column definitions, with the key being the column name. The value of each item is an array with the column definitions, as understood by Laravel's `Illuminate\Database\Schema\Blueprint::addColumn()` method. The first option is the column type, any other keyed option is passed through to `addColumn`.

The following options are supported for all column types:

- `nullable`: Whether the column allows `NULL` values, boolean, defaults to `false`
- `default`: Column default value, mixed
- `unique`: Creates a UNIQUE index for the column, boolean, defaults to `false`
- `first`: Insert the column as the first in the table, boolean, defaults to `false`, MySQL only
- `after`: Insert the column directly after the specified existing column, string, MySQL only

In the following, all supported types, along with custom options, are listed:

#### char, string

[](#char-string)

- `length`: Column size, integer

#### text, mediumText, longText

[](#text-mediumtext-longtext)

*No special options*

#### integer, tinyInteger, smallInteger, mediumInteger, bigInteger

[](#integer-tinyinteger-smallinteger-mediuminteger-biginteger)

- `autoIncrement`: Set to `true` to mark this column as sequence
- `unsigned`: Set to `true` to mark this column as unsigned integer

#### float, decimal

[](#float-decimal)

- `total`: Number of decimal digits, integer, defaults to `8`
- `places`: Number of digits after the decimal point, integer, defaults to `2`

#### double

[](#double)

- `total`: Number of decimal digits, integer
- `places`: Number of digits after the decimal point, integer

#### boolean

[](#boolean)

*No special options*

#### enum

[](#enum)

- `allowed`: An array of possible values that the column can have

#### json, jsonb

[](#json-jsonb)

*No special options*

#### date, dateTime, dateTimeTz, time, timeTz, timestamp, timestampTz

[](#date-datetime-datetimetz-time-timetz-timestamp-timestamptz)

*No special options*

#### binary

[](#binary)

*No special options*

#### uuid

[](#uuid)

*No special options*

### Dropping columns

[](#dropping-columns)

```
public function change()
{
    return Easy::dropColumns('users', [
        'password' => ['string'],
        'registered_at' => ['dateTime', 'nullable' => true]
    ]);
}
```

Again, just like when dropping tables, you should specify the full column definitions so that the migration can be rolled back cleanly.

For a reference of column types and their respective options, please take a look at the documentation for [adding columns](#adding-columns).

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

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

Total

2

Last Release

3685d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a8620604a1f4094fee4ab1c3d2f6fccb6583293daf5f866c804d155c05b2e13?d=identicon)[franzliedke](/maintainers/franzliedke)

---

Top Contributors

[![franzliedke](https://avatars.githubusercontent.com/u/249125?v=4)](https://github.com/franzliedke "franzliedke (14 commits)")

---

Tags

databaselaravelmigrationslaravelmigrations

### Embed Badge

![Health badge](/badges/franzl-laravel-easy-migrations/health.svg)

```
[![Health](https://phpackages.com/badges/franzl-laravel-easy-migrations/health.svg)](https://phpackages.com/packages/franzl-laravel-easy-migrations)
```

###  Alternatives

[dragon-code/laravel-data-dumper

Adding data from certain tables when executing the `php artisan schema:dump` console command

3418.6k](/packages/dragon-code-laravel-data-dumper)[orptech/laravel-migration-partition

Laravel extensions that extends Illuminate to enable partitioned table creation within Laravel migrations.

3426.7k](/packages/orptech-laravel-migration-partition)[stidges/laravel-fk-migration

Helpful base migration for creating all your foreign key without worrying about the order of your migrations.

394.2k](/packages/stidges-laravel-fk-migration)[elimuswift/db-exporter

Export your database quickly and easily as a Laravel Migration and all the data as a Seeder class.

364.7k](/packages/elimuswift-db-exporter)[proai/laravel-super-migrations

This Laravel package is useful for big databases for a better migrations structure.

112.5k](/packages/proai-laravel-super-migrations)

PHPackages © 2026

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