Download the PHP package filippo-toso/migrations-generator without Composer
On this page you can find all versions of the php package filippo-toso/migrations-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download filippo-toso/migrations-generator
More information about filippo-toso/migrations-generator
Files in filippo-toso/migrations-generator
Package migrations-generator
Short Description A Laravel Artisan command to automatically generate migrations from database tables
License MIT
Informations about the package migrations-generator
Migrations Generator
A Laravel Artisan command to automatically generate migrations from database tables.
Requirements
- PHP 5.6+
- Laravel 5.4+
- Doctrine DBAL +2.8
Installing
Use Composer to install it:
How does it work?
This generator is very simple. It builds the migrations from the database and saves them in the database folder.
By default the generator doesn't create the models of Laravel's tables like jobs, cache, and so on. You can modify this behavior publishing the package resources and editing the config/migrations-generator.php file.
Configuration
You can publish the configuration file with the following command:
The config/migration-generator.php file allows you to:
- define which tables exclude form the generation (ie. cache, jobs, migrations, ...)
Just open the file and read the comments :)
Options
The predefined use from command line is:
This command generates the migrations with the current time (plus one second for each table).
If there are existing migrations they will not be overwritten.
You can modify the default behavior using the following parameters:
With the overwrite option the generator will remove the previously generated migrations with the same class name.
You can specify a different connection if you need to.
Workflow
To gain the maximum benefits from this package you should follow this workflow:
- design the database (i.e. with MySQL Workbench)
- execute the SQL CREATE statement in your MySQL
- configure the generator
- run the generator
- customize the migrations in the database folder
You must follow Laravel's guidelines about tables and columns names and also include in your SQL statements all the required foreign keys and indexes.
Known Issues
If you have two (or more) tables inter-related, you will need to manually move the foreign key definitions in a separate migrations that will run after all the tables has been created
All versions of migrations-generator with dependencies
illuminate/support Version >=5.5
laravel/helpers Version ^1.1
doctrine/dbal Version ^2.8