https://github.com/webparking/laravel-db-rebuild
  
  
    A laravel package that allows for quick db rebuilds with presets. 
    https://github.com/webparking/laravel-db-rebuild
  
        Last synced: 7 months ago 
        JSON representation
    
A laravel package that allows for quick db rebuilds with presets.
- Host: GitHub
- URL: https://github.com/webparking/laravel-db-rebuild
- Owner: webparking
- License: mit
- Created: 2019-02-22T12:31:27.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-10T10:24:15.000Z (about 5 years ago)
- Last Synced: 2025-03-24T08:21:13.288Z (7 months ago)
- Language: PHP
- Size: 90.8 KB
- Stars: 44
- Watchers: 4
- Forks: 0
- Open Issues: 0
- 
            Metadata Files:
            - Readme: README.md
- License: LICENSE.md
 
Awesome Lists containing this project
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
```PHP
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](LICENSE.md).
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
        
 
