lastdragon-ru / lara-asp-migrator
The Awesome Set of Packages for Laravel - The Migrator.
Requires
- php: ^8.2|^8.3
- ext-json: *
- ext-mbstring: *
- illuminate/conditionable: ^10.34.0|^11.0.0
- illuminate/console: ^10.34.0|^11.0.0
- illuminate/container: ^10.34.0|^11.0.0
- illuminate/contracts: ^10.34.0|^11.0.0
- illuminate/database: ^10.34.0|^11.0.0
- illuminate/filesystem: ^10.34.0|^11.0.0
- illuminate/support: ^10.34.0|^11.0.0
- lastdragon-ru/lara-asp-core: 7.0.0
- symfony/console: ^6.3.0|^7.0.0
- symfony/finder: ^6.3.0|^7.0.0
- symfony/polyfill-php83: ^1.28
Requires (Dev)
- ext-pdo_sqlite: *
- illuminate/config: ^10.34.0|^11.0.0
- lastdragon-ru/lara-asp-testing: 7.0.0
- mockery/mockery: ^1.6.5
- orchestra/testbench: ^8.0.0|^9.0.0
- phpunit/phpunit: ^10.1.0|^11.0.0
- dev-main
- 7.0.0
- 6.x-dev
- 6.4.2
- 6.4.1
- 6.4.0
- 6.3.0
- 6.2.0
- 6.1.0
- 6.0.0
- 5.x-dev
- 5.6.0
- 5.5.0
- 5.4.0
- 5.3.1
- 5.3.0
- 5.2.0
- 5.1.0
- 5.0.0
- 5.0.0-beta.1
- 5.0.0-beta.0
- 4.x-dev
- 4.6.0
- 4.5.2
- 4.5.1
- 4.5.0
- 4.4.0
- 4.3.0
- 4.2.1
- 4.2.0
- 4.1.0
- 4.0.0
- 3.0.0
- 2.x-dev
- 2.1.0
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.x-dev
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.15.0
- 0.14.1
- 0.14.0
- 0.13.0
- 0.12.0
- 0.11.0
- 0.10.0
- 0.9.0
- 0.8.1
- 0.8.0
- 0.7.0
- 0.6.1
- 0.6.0
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.0
This package is auto-updated.
Last update: 2024-11-17 07:57:57 UTC
README
This package improves standard Laravel migrations to add support for raw SQL files during migration and seeding. So you can easily use your favorite visual tool for database development like MySQL Workbench with Laravel 🥳
Important
The Migrator uses the same mechanism as Squashing Migrations so not all databases are supported, please see Laravel Documentation for more details.
Requirements
Installation
composer require lastdragon-ru/lara-asp-migrator
Migrations
To create migration, just use the following command:
php artisan lara-asp-migrator:sql-migration MyMigration
It will create the following files in database/migrations
:
2020_11_05_170802_my_migration.php
2020_11_05_170802_my_migration~down.sql
2020_11_05_170802_my_migration~up.sql
Usually, you just need to put your SQL into *~up.sql
and *~down.sql
😇 Note that you still can use standard Laravel migrations. Also, migrations can be placed into subdirectories.
Seeders
The package uses a bit different approach compared with standard and provides a few different types of seeders:
Seeder
- unlike standardSeeder
it is safer and will not run seeder if it is already applied (so it is safe for production 🤩);SqlSeeder
- extendsSmartSeeder
and allow you to use SQL.
To create SQL Seeder you should use the command:
php artisan lara-asp-migrator:sql-seeder MySeeder
The command will create two files:
MySeeder.php
- The class can be used to customizeisSeeded()
method, e.g. you can check if a model exists in the database.MySeeder.sql
- the file where the SQL seed stored.
Upgrading
Please follow Upgrade Guide.
Contributing
This package is the part of Awesome Set of Packages for Laravel. Please use the main repository to report issues, send pull requests, or ask questions.