webparking / laravel-db-rebuild
A laravel package that allows for quick database rebuilds with presets.
Installs: 8 787
Dependents: 0
Suggesters: 0
Security: 0
Stars: 44
Watchers: 5
Forks: 0
Open Issues: 0
Requires
- php: >=7.1.0
- illuminate/console: ^5.5|^6.0|^7.0|^8.0
- illuminate/database: ^5.5|^6.0|^7.0|^8.0
- illuminate/support: ^5.5|^6.0|^7.0|^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.12
- orchestra/database: ^3.5|^4.0|^5.0|dev-6.x
- orchestra/testbench: ^3.5|^4.0|^5.0|dev-6.x
- phpmd/phpmd: ^2.6
- phpstan/phpstan: ^0.12
- phpunit/phpunit: ^6.0|^7.0|^8.0
This package is auto-updated.
Last update: 2024-10-10 19:27:52 UTC
README
Laravel DB Rebuild
This package is meant to provide an easy way of resetting your development database to a certain state.
In addition to php artisan migrate:fresh
this package also allows you to backup tables (for example sessions and admin_users, to stay logged in) and run custom seeders or commands based on presets.
This allows you to easily seed different information for local development, your tests and staging.
Installation
Add this package to composer.
composer require webparking/laravel-db-rebuild
Publish the config:
php artisan vendor:publish --provider="Webparking\DbRebuild\ServiceProvider"
Usage
The default usage is the following, this will use the default preset. It will also ask you if you're sure you want to reset the db.
php artisan db:rebuild
You an skipp the question by adding the --f
flag. You can change the preset by adding --preset=test
php artisan db:rebuild --preset=test --f
Config
return [ 'presets' => [ 'default' => [ 'database' => 'local_database', 'backup' => [ 'sessions', 'admin_users', ], 'commands' => [ 'db:seed', ], 'seeds' => [ ], ], 'test' => [ 'database' => 'testing_database', 'backup' => [ 'sessions', ], 'commands' => [ 'db:seed', ], 'seeds' => [ TestSeeder::class ], ], ], ];
Licence and Postcardware
This software is open source and licensed under the MIT license.
If you use this software in your daily development we would appreciate to receive a postcard of your hometown.
Please send it to: Webparking BV, Cypresbaan 31a, 2908 LT Capelle aan den IJssel, The Netherlands