PHPackages                             maxim-oleinik/blade-migrations-laravel - 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. maxim-oleinik/blade-migrations-laravel

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

maxim-oleinik/blade-migrations-laravel
======================================

An intelligent alternative version of Laravel Database Migrations - uses raw-sql syntax, transactions, auto-rollback, UP-DOWN-UP testing

0.2.3(4y ago)242.3k↓68%1MITPHPPHP &gt;=7.0

Since Jul 16Pushed 4y ago1 watchersCompare

[ Source](https://github.com/maxim-oleinik/blade-migrations-laravel)[ Packagist](https://packagist.org/packages/maxim-oleinik/blade-migrations-laravel)[ RSS](/packages/maxim-oleinik-blade-migrations-laravel/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (2)Versions (6)Used By (0)

Database Migrations - Laravel
=============================

[](#database-migrations---laravel)

[rus](./README.rus.md) / [![Latest Stable Version](https://camo.githubusercontent.com/7f77608c5fa3a1a8e843ee380e56b4fb40b32393d9bf665b5f1d6c79ba4aacab/68747470733a2f2f706f7365722e707567782e6f72672f6d6178696d2d6f6c65696e696b2f626c6164652d6d6967726174696f6e732d6c61726176656c2f762f737461626c65)](https://packagist.org/packages/maxim-oleinik/blade-migrations-laravel)[![Total Downloads](https://camo.githubusercontent.com/519d89bc85450292af6e2933329e64cea2abaaff3217a9679bd822b06d5c71f4/68747470733a2f2f706f7365722e707567782e6f72672f6d6178696d2d6f6c65696e696b2f626c6164652d6d6967726174696f6e732d6c61726176656c2f642f746f74616c2e737667)](https://packagist.org/packages/maxim-oleinik/blade-migrations-laravel)[![License](https://camo.githubusercontent.com/88cf5f853ba19d2d3cabafe2aac64d0345494acbf9d98ce5408b9b1191b5999c/68747470733a2f2f706f7365722e707567782e6f72672f6d6178696d2d6f6c65696e696b2f626c6164652d6d6967726174696f6e732d6c61726176656c2f6c6963656e73652e737667)](https://packagist.org/packages/maxim-oleinik/blade-migrations-laravel)

An intelligent alternative version of **Laravel 5 Database Migrations**

[![](https://camo.githubusercontent.com/70c5a9980ad06c1856a2679e3ff0484004d9f95dbcd69a0f663b9da04328aef9/68747470733a2f2f686162726173746f726167652e6f72672f776562742f39772f686d2f31692f3977686d316963777467377065722d3135766668796a656a6378382e706e67)](https://camo.githubusercontent.com/70c5a9980ad06c1856a2679e3ff0484004d9f95dbcd69a0f663b9da04328aef9/68747470733a2f2f686162726173746f726167652e6f72672f776562742f39772f686d2f31692f3977686d316963777467377065722d3135766668796a656a6378382e706e67)

Features
--------

[](#features)

- **Using raw SQL queries**
    - you can use all the capabilities of your database to describe the structure and changes
    - easy work with procedures and functions
    - safe data migrations (INSERT/UPDATE)
    - IDE native syntax support
- **Running migrations within a transaction** with automatic rollback in case of an error (if your database supports it, PostgreSQL for example)
- **Dynamic output running the SQL-queries**
- **Automatic rollback** after switching the branch (for reviewing, testing, demo, building at permanent/staging database)
- **Auto-update the migration after editing** (version change in the name of the migration file)
- **Apply with rollback testing** - `UD-DOWN-UP`
- **Rollback or Reload any selected migration**

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

[](#requirements)

- PHP &gt;= 7.0
- Laravel &gt;= 5.1 (supports all versions 5.1 - 8.X)

Syntax
------

[](#syntax)

- `--TRANSACTION` - if specified, the migration will be launched within a transaction
- Instructions are separated by `--UP` and` --DOWN` tags.
- The SQL queries are separated by `";"` (the last character at the end of the line)

```
--TRANSACTION
--UP
ALTER TABLE authors ADD COLUMN code INT;
ALTER TABLE posts   ADD COLUMN slug TEXT;

--DOWN
ALTER TABLE authors DROP COLUMN code;
ALTER TABLE posts   DROP COLUMN slug;

```

**If you need to change the delimiter** (when in SQL you have to use `";"`)

```
--SEPARATOR=@
--UP
    ... some sql ...@
    ... some sql ...@

--DOWN
    ... some sql ...@
    ... some sql ...@

```

Install
-------

[](#install)

1. Require this package with **composer** using the following command:

    ```
        composer require maxim-oleinik/blade-migrations-laravel

    ```
2. Update `config/database.php`

    ```
        'migrations' => [
            // migrations table name
            'table' => 'migrations',

            // path to migrations dir
            'dir'   => __DIR__ . '/../database/migrations',
        ],

    ```
3. Register ServiceProvider at `config/app.php`
    for Laravel &lt; 5.5

    ```
       'providers' => [
            ...
            Blade\Migrations\Laravel\MigrationsServiceProvider::class,
        ],

    ```

    for Laravel 6/7/8.X

    ```
    replace
        Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class
    with
        Illuminate\Foundation\Providers\ComposerServiceProvider::class,
        Illuminate\Foundation\Providers\ArtisanServiceProvider::class
    do disable original mirgations

    ```
4. Create migration table

    ```
        php artisan migrate:install

    ```

Usage
-----

[](#usage)

### Create Migration file

[](#create-migration-file)

```
    php artisan make:migration NAME

```

### Status

[](#status)

```
    php artisan migrate:status

    +---+----+---------------------+------------------------+
    |   | ID | Date                | Name                   |
    +---+----+---------------------+------------------------+
    | Y | 6  | 28.08.2018 20:17:01 | 20180828_195348_M1.sql |
    | D | 7  | 28.08.2018 20:17:21 | 20180828_201639_M3.sql |
    | A |    |                     | 20180828_200950_M2.sql |
    +---+----+---------------------+------------------------+

```

- **Y** - applied migration
- **D** - have to rollback (no this migration in the current branch/revision)
- **A** - not applied yet, next to be run

### Migrate

[](#migrate)

```
    # Apply next А-migration
    php artisan migrate

    # Apply the migration without a prompt
    php artisan migrate -f

    # Apply with rollback testing: UP-DOWN-UP
    php artisan migrate -t

    # Auto-migrate all - rollback all D-migrations and appply all А-migrations
    php artisan migrate --auto

    # Apply migration from the specified file
    php artisan migrate FILE_NAME

```

### Rollback

[](#rollback)

The migrate file with SQL-commands is saved to DB after applying the migration. So the rollback is processing from this saved instructions. This is done to be able to rollback the migration when project switches to another branch which does not contains this file.

```
    # Rollback the latest Y-migration
    php artisan migrate:rollback

    # To force the rollback without a prompt
    php artisan migrate:rollback -f

    # Rollback migration by its ID
    php artisan migrate:rollback --id=N

    # Rollback migration with commands taken from migration file, not from DB (if saved version contains error)
    php artisan migrate:rollback --load-file

```

### Reload

[](#reload)

Rollback migration and run it again

```
    php artisan migrate:reload

    # the same options as rollback
    php artisan migrate:reload -f --id=N --load-file

```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

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

Total

5

Last Release

1739d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/df55f28e06f2a06012eaea10010c8b14fda8ce1fa04e66a548def287d925a798?d=identicon)[maxim.oleinik](/maintainers/maxim.oleinik)

---

Top Contributors

[![maxim-oleinik](https://avatars.githubusercontent.com/u/75860?v=4)](https://github.com/maxim-oleinik "maxim-oleinik (48 commits)")

---

Tags

artisandatabase-migrationslaravellaravel-packagelaravel5laravel6-packagelaravelmigrationdatabaseartisanlaravel5laravel6

### Embed Badge

![Health badge](/badges/maxim-oleinik-blade-migrations-laravel/health.svg)

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

###  Alternatives

[boaideas/laravel-cli-create-user

An artisan command to create, list and remove users in a laravel application from the cli

1610.7k](/packages/boaideas-laravel-cli-create-user)[codengine/laravel-custom-migrations

Custom Migrations for Laravel

131.3k](/packages/codengine-laravel-custom-migrations)

PHPackages © 2026

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