Download the PHP package capsulescodes/laravel-population without Composer
On this page you can find all versions of the php package capsulescodes/laravel-population. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download capsulescodes/laravel-population
More information about capsulescodes/laravel-population
Files in capsulescodes/laravel-population
Package laravel-population
Short Description Simplify database migrations and ensure consistency with your database tables effortlessly.
License MIT
Informations about the package laravel-population
Simplify database migrations and ensure consistency with your database tables effortlessly.
Laravel Population package provides a set of commands that parses your migrations and detects any disparities between them and your database tables. If differences are found, a wizard is triggered to help you migrate and seed the new tables with converted records.
Typically, your users
table might have a fullname
column, but you need two separate columns : firstname
and lastname
. However, your database is already full of records.
This article provides an in-depth exploration of the package.
[!WARNING] We recommend exercising caution when using this package on production.
Installation
Usage
Let's say, your current users
table have a fullname
column, but you need two separate columns : firstname
and lastname
. First, modify your migration :
Now unleash the magic :
The populate command will display the changes made in the migration files and ask for confirmation.
Your users
table has been updated and seeded with converted records. Simple.
If you want to rollback the latest population :
Options
- Laravel Population supports SQLite, MySQL, MariaDB and PostgreSQL.
- Laravel Population can work with multiple databases.
- Laravel Population supports both anonymous and named migrations classes.
- Laravel Population supports multiple table creation in migration files.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate. In order to run MySQL tests, credentials have to be configured in the intended TestCases.