karlerss / laravel-db-script-manager
Manage database views, stored procedures etc with Laravel
Installs: 1 381
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 3
Open Issues: 3
Requires
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ~5.0
- phpunit/phpunit: ~8.0
- sempro/phpunit-pretty-print: ^1.0
This package is auto-updated.
Last update: 2024-10-30 00:11:30 UTC
README
Managing database objects in a version controlled application is hard. Laravel's migrate functionality gets us half way there. Managing your views, triggers and stored procedures with Laravel's migrations is error-prone or really verbose (try modifying a table which is used for a view).
This package modifies php artisan migrate
command so that:
- All script-defined database objects are removed
- Your migrations are executed
- All script-defined database objects are added again
Installation
Via Composer
$ composer require karlerss/laravel-db-script-manager
Usage
Create a new script:
php artisan make:db-script add_active_users_view
A file similar to a migration file is created in database/scripts.
Implement the up()
and down()
methods. The down mehtod sql script should check
if the database object exists (DROP VIEW IF EXISTS active_users
).
Testing
$ vendor/bin/phpunit
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
License
MIT. Please see the license file for more information.