alexandruflorea / quick-laravel-migrations
A package made for importing database dumps faster than the laravel classic migration system.
Requires
- laravel/framework: ^5.6|6.*|7.*
Requires (Dev)
- mockery/mockery: ^1.0
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2025-02-19 18:08:59 UTC
README
A composer package made for importing database dumps faster than the laravel classic migration system.
It can be used to replace the rather slow
$this->runDatabaseMigrations()
$this->seed()
artisan migrate:fresh
artisan migrate:fresh --seed
What you can do after installation
php artisan db:dump php artisan db:load {--seed}
You can also replace
use Illuminate\Foundation\Testing\DatabaseMigrations;
with
use QuickDatabaseMigrations\QuickDatabaseMigrations;
It makes migrations for tests as fast as db:load at the cost of manually running db:dump after a migration|seed change (and no rollbacks after tests)
Documentation & Installation
Installation
composer require alexandruflorea/quick-laravel-migrations
Add these into your /app/Console/Kernel.php
this enables db:dump and db:load
use QuickDatabaseMigrations;
/** * The Artisan commands provided by your application. * * @var array */ protected $commands = [ \QuickDatabaseMigrations\MySqlDump::class, \QuickDatabaseMigrations\MySqlLoad::class ];
To benefit from faster migrations during tests, replace:
use Illuminate\Foundation\Testing\DatabaseMigrations;
with
use QuickDatabaseMigrations\QuickDatabaseMigrations;
Documentation
3 utility classes are provided under the same namespace
QuickDatabaseMigrations
defines hooks to migrate the database
it requires a db:dump beforehand
Paste this at the top of the file
use QuickDatabaseMigrations\QuickDatabaseMigrations;
And this at the top of the class
use QuickDatabaseMigrations;
Migrate using
$this->runDatabaseMigrations(); //fast migrate:fresh $this->runDatabaseSeedMigrations(); //fast migrate:fresh --seed
$this->baseRunDatabaseMigrations(); //default migrate:fresh $this->baseRunDatabaseSeedMigrations(); //default migrate:fresh --seed
MySqlDump
a fast way to generate dump files
you can totally ignore this and manually place the dump files in
/QuickMigration/sql.dump
or/QuickSeedMigration/sql.dump
php artisan db:dump
MySqlLoad
a fast way to load a dump file
you can totally ignore this as well if you want to manually import it every time
php artisan db:load
Supported versions
Laravel 5.6+
Credits
👑 @GaussianWonder - Main Developer
License
The MIT License (MIT). Please see License File for more information.