temori / distancexport
Data migration tool that can migrate data between databases with different structures.
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Language:JavaScript
Requires
- php: >=5.4
- phpunit/phpunit: ^4.8
Requires (Dev)
- vlucas/phpdotenv: ^5.2
This package is auto-updated.
Last update: 2025-02-05 09:58:50 UTC
README
Data migration tool between databases.
Data migration is possible regardless of RDB.
Table of Contents
Features
-
Database data migration tools.
-
Data migration between two databases is possible.
-
Migrate the data in the source column in the same row as the destination column in a web like Google Spreadsheet.
-
The default only supports Mysql and pgsql drivers.
If you want to use another driver, you can add a driver classes.
Requirements
- php 5.4 or later
Installation
Using composer:
cd path/to/your/project
composer require temori/distancexport --dev
Usage
-
Create a php files.
If you use any FW, Create a routable controllers.
-
Define the following constants.
- For the destination DB.
DX_DESTINATION_DB_DRIVER
destination DB drivers.DX_DESTINATION_DB_HOST
destination DB hosts.DX_DESTINATION_DB_PORT
destination DB ports.DX_DESTINATION_DB_USERNAME
destination DB accounts.DX_DESTINATION_DB_PASSWORD
destination DB passwords.
- For the source DB.
DX_SOURCE_DB_DRIVER
source DB drivers.DX_SOURCE_DB_HOST
source DB hosts.DX_SOURCE_DB_PORT
source DB ports.DX_SOURCE_DB_USERNAME
source DB accounts.DX_SOURCE_DB_PASSWORD
source DB passwords.
- When need csrf tokens.
DX_CSRF_TOKEN_NAME
CSRF token name fields.DX_CSRF_TOKEN
CSRF token fields.
- For the destination DB.
-
Create an instance of
\Temori\Distancexport\Distancexport
with the created php file or controller and execute theinit()
method,like below.
$dis = new \Temori\Distancexport\Distancexport(); $dis->init();
-
If you use a FW that requires routing settings, you need to create the routes
get
andpost
. -
Open the above php file or controller url.
-
Since table names, data types, key types, etc. are lined up like a spreadsheet, copy and paste the column name you want to migrate next to the migration destination database column.
The columns required for migration are
Field
inDestination Databases
andField
inSource Databases
.Data migration is ignored if
Field
inSource Databases
is blank.If you enter a character string in the
Uniformity
column as an option, the character string described inUniformity
will be added to all records. -
The
Dry run
button performs test execution, and theRun
button executes data migration.If an exception occurs, an error message will be displayed in
Results
andmessage
.
Supported RDB driver types
- Mysql
- postgresql
Add RDB driver
If you want you can add other driver classes.
For the class to be created, implement the BaseDriver
class and inherit the Connect
class.
In addition, create a method that produces the same execution result as the following class.
Specify the driver class added when creating the instance as shown below.
$dis = new \Temori\Distancexport\Distancexport(\Some\NameSpace\DestinationDriverClass::class, \Some\NameSpace\SourceDriverClass::class);
Note
[warning]
Since the entire database structure is displayed, please be careful about security when using it.
License
Paddington is licensed under the MIT license.
Copyright © 2020, Atushi Inoue