Download the PHP package marcinkozak/databasemigrator without Composer
On this page you can find all versions of the php package marcinkozak/databasemigrator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package databasemigrator
Database Migrator for Laravel
A simple console tool which helps to migrate database data from one to another using different DB connections.
Features
- Defining source and target database connection.
- Allows to change target tables names and columns as well.
- Transforms data for each processing rows.
When to use
Sometimes you can have an opportunity to make your custom database based on the existing one but in your opinion you can design it in better way for example primary keys are not names simply as but in the , or columns values are not exactly what you want.
Installation
Add marcinkozak/databasemigrator to composer.json.
Or simply run:
To make it available for Laravel open the file and add line below.
Configuration
Run command
to publish new files in an application root:
The first file contains a collection of connections where each of them defines source and target DB connection, disabled/enabled state and class name of schema.
The schema files are located in the directory.
Before you start migrating you must have defined target tables, otherwise an exception will be thrown.
Examples
Migrating the same table name
Migrating different table names
Defining columns
This is a mandatory step to make migration works for the selected table. You can define a single column
or for different names
or use the method to define multi columns in single step.
Of course you are able to define different names inside the above method.
Transform column value
Not always we want to migrate the same value for certain column. The package supports the method which allows to transform value to the new one. To use it simply define new instance.
If you want to make some relation which has poorly designed in the source table you can follow that way
Let's suppose that in this case stores identical value as the column. By using the function we can fetch the desirable primary key and use it as foreign key for the new value inside the method.
Running migration
The package has two Artisan methods.
Populating target tables
Clearing target tables
All versions of databasemigrator with dependencies
illuminate/support Version ^5.8|^6
illuminate/database Version ^5.8|^6
illuminate/console Version ^5.8|^6
ext-iconv Version *