mwi/laravel-refactor

This package is abandoned and no longer maintained. No replacement package was suggested.

Package to help refactor data in staging and production environments.

dev-master 2020-03-04 22:29 UTC

This package is auto-updated.

Last update: 2023-10-16 19:55:00 UTC


README

Package to help refactor data in staging and production environments.

Installation

composer require mwi/laravel-refactor
php artisan migrate

Service Provider

If you're on laravel 5.5 or later the service provider will be automatically loaded and you can skip this step, if not, add to your config/app.php providers

'providers' => [
    // ...
    MWI\LaravelRefactor\ServiceProvider::class,
    // ...
],

Usage

Once you have the package setup and migrations ran

php artisan make:refactor convert_relationship_to_many_to_many

Instruct the up and down methods

<?php

class ConvertRelationshipToManyToMany
{
    /**
     * Run the refactor.
     *
     * @return void
     */
    public function up()
    {
        //
    }

    /**
     * Reverse the refactor.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}

Run the refactor command

php artisan refactor

Rollback

You can roll all migrations back

php artisan refactor --rollback

Steps

You can also run a certain number of steps

php artisan refactor --steps=2
php artisan refactor --rollback --steps=1