testmonitor / laravel-nested-migrations
Organize Laravel migration files into subfolders
Installs: 6 561
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 1
Open Issues: 2
Requires
- php: ^7.4|^8.0
- illuminate/contracts: ^6.0|^7.0|^8.0
- illuminate/database: ^6.0|^7.0|^8.0
- illuminate/support: ^6.0|^7.0|^8.0
Requires (Dev)
- orchestra/testbench: ^4.0|^5.0|^6.0
- phpunit/phpunit: ^8.0|^9.0
- squizlabs/php_codesniffer: 3.*
This package is auto-updated.
Last update: 2023-01-25 13:54:02 UTC
README
With Nested Migrations, you can organize your migration files into subfolders, keeping things a bit cleaner.
Table of Contents
Installation
This package can be installed through Composer:
$ composer require testmonitor/laravel-nested-migrations
The package will automatically register itself.
Usage
Once loaded, you can start organizing your migration files into folders. You might want to take a look at the examples section to get a better picture.
Please note that nesting is limited to one level deep. This avoids any recursive mess.
Examples
Imagine a migration file layout like this:
database/migrations/
- 2018_09_01_180000_create_projects_table.php
- 2018_11_11_180000_create_users_table.php
- 2019_01_20_180000_create_settings_table.php
- 2019_11_12_180000_create_teams_table.php
Nothing out of the ordinary, right? But what if this list gets bigger? Like a 100 migration files? Things tend to get difficult at that stage. Usually, you'd want to categorize these files into folders and that's exactly where this package comes in.
Now, you can do this:
database/migrations/1.0
- 2018_09_01_180000_create_projects_table.php
- 2018_11_11_180000_create_users_table.php
database/migrations/1.1
- 2019_01_20_180000_create_settings_table.php
database/migrations/2.0
- 2019_11_12_180000_create_teams_table.php
A version-based migration folder layout is a great way to handle bigger apps, but you can use any name or number you'd like. Just keep in mind that the folders are sorted alphanumerically and migration files are ran through accordingly.
Tests
The package contains integration tests. You can run them using PHPUnit.
$ vendor/bin/phpunit
Changelog
Refer to CHANGELOG for more information.
Contributing
Refer to CONTRIBUTING for contributing details.
Credits
License
The MIT License (MIT). Refer to the License for more information.