PHPackages                             luongolabs/block-migrate - 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. luongolabs/block-migrate

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

luongolabs/block-migrate
========================

Run straight code blocks during laravel migrations.

v1.0.3(2w ago)0841↓66.7%[1 PRs](https://github.com/luongolabs/block-migrate/pulls)MITPHPPHP ^8.1CI passing

Since Feb 5Pushed 1w ago1 watchersCompare

[ Source](https://github.com/luongolabs/block-migrate)[ Packagist](https://packagist.org/packages/luongolabs/block-migrate)[ Docs](https://github.com/luongolabs/block-migrate)[ GitHub Sponsors]()[ RSS](/packages/luongolabs-block-migrate/feed)WikiDiscussions main Synced yesterday

READMEChangelog (4)Dependencies (27)Versions (10)Used By (0)

Run code blocks during laravel migrations.
==========================================

[](#run-code-blocks-during-laravel-migrations)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e12f5706c30dfc8d10c01ec97d62533070f840273a0b037a5b1d720f54f98e9f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c756f6e676f6c6162732f626c6f636b2d6d6967726174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/luongolabs/block-migrate)[![GitHub Tests Action Status](https://camo.githubusercontent.com/6ec6a1f7d309d10396449ce2214869881cfa016f6ea2bc3beb1776704df7c56f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c756f6e676f6c6162732f626c6f636b2d6d6967726174652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/luongolabs/block-migrate/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/864d9168ae6f62b2de7450908446bf1e2bc4feea52749319cf48c895bf90d3b6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c756f6e676f6c6162732f626c6f636b2d6d6967726174652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/luongolabs/block-migrate/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/110148f4b888ad437987490ecc6ff5ccdbae9d02a5b04381408e4f3a7477d171/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c756f6e676f6c6162732f626c6f636b2d6d6967726174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/luongolabs/block-migrate)

Does what it says on the tin. Run code blocks during laravel migrations with the ability to roll them back, this is based on [spatie/laravel-settings](spatie/laravel-settings) mainly the migration creation part.

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

[](#installation)

You can install the package via composer:

```
composer require luongolabs/block-migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="block-migrate-config"
```

This is the contents of the published config file:

```
return [
    'migrations_paths' => [
        database_path('blocks'),
    ],
];
```

Usage
-----

[](#usage)

Let's say you need to rotate the auth tokens in the application due to a change in your new code, run `php artisan make:block-migration RotateAuthTokens` to create the migration.

This would create the file `database/blocks/2021_08_01_000000_rotate_auth_tokens.php` with the following contents:

```
