karlerss/laravel-db-script-manager

Manage database views, stored procedures etc with Laravel
1,383 1
Install
composer require karlerss/laravel-db-script-manager
Latest Version:v1.0.2
License:MIT
Last Updated:Feb 1, 2023
Links: GitHub  ·  Packagist
Maintainer: lehter

Laravel Database Script Manager

Total Downloads Build Status StyleCI

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:

  1. All script-defined database objects are removed
  2. Your migrations are executed
  3. 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.

Related Packages

anyeloamt/phinx-sugar

Write your phinx migrations as sweet as laravel eloquent.

10
maxim-oleinik/blade-migrations

Raw SQL database migration tool for PHP apps

2,323 0
doctrine/dbal

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

637,827,751 9,703
laravel/framework

The Laravel Framework.

589,172,971 34,950

Version History

Version Released Laravel License
v1.0.2 ~7 MIT
v1.0.1 ~6 MIT
v1.0.0 ~5 MIT