jamesfreeman/laravel-data-migrations

An extension to allow you to separate data migrations from structure migrations
2,779
Install
composer require jamesfreeman/laravel-data-migrations
Latest Version:2.0.0
PHP:^8.1
Laravel:8 · 9 · 10
License:MIT
Last Updated:Sep 16, 2023
Links: GitHub  ·  Packagist
Maintainer: JamesFreeman

Data Migrations for Laravel

This extension allows you to separate data migrations from structure migrations.

Installation

The preferred way to install this extension is through composer.

With Composer installed, you can then install the extension using the following commands:

composer require jamesfreeman/laravel-data-migrations

or add

...
    "require": {
        "jamesfreeman/laravel-data-migrations": "^2.0"
    }

to the require section of your composer.json file.

Configuration

  1. Register the ServiceProvider in your config/app.php service provider list. This step can be skipped in Laravel 5.5+

config/app.php

return [
    //other stuff
    'providers' => [
        \JamesFreeman\DataMigrations\DataMigrationsServiceProvider::class,
    ];
];
  1. Publish the new assets.
php artisan vendor:publish --tag=data-migrations

This will create the default migrations directory and the config/data-migrations.php file.

Usage

By default, the table used to store the data migrations is "migrations_data" table. You can change the table on the config/data-migrations.php file.

The data migrations will be stored in the migrations_data folder of the database path if no path is specified in the command execution.

The available commands of the package are:

Create migration command

php artisan make:data-migration [name] [--path=]

The first time you use it the data migrations table will be created.

Run migration command

php artisan migrate-data [--path=]

Rollback migration command

php artisan migrate-data:rollback [--path=]

The behavior of the migrations is the same as the regular migrations.

License

Copyright © 2021 José Lorente Martín jose.lorente.martin@gmail.com, Eran Machiels dev@eranmachiels.nl.

Licensed under the MIT license. See LICENSE.txt for details.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

644,549,754 9,698
laravel/framework

The Laravel Framework.

598,760,099 34,966
laravel/tinker

Powerful REPL for the Laravel framework.

507,193,856 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

423,477,751 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

403,217,078 4,664

Version History

Version Released PHP Laravel License
2.0.0 ^8.1 ^8.0|^9.0|^10.0 MIT
1.2.1 ^7.4|^8.0 ^8.0|^9.0 MIT
1.2.0 ^7.4|^8.0 ^8.0|^9.0 MIT
1.0.1 ^7.4|^8.0 ^8.0 MIT
1.0.0 ^7.4|^8.0 ^8.0 MIT