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

v1.0.0 2020-11-05 00:06 UTC

This package is auto-updated.

Last update: 2024-04-05 08:12:16 UTC


README

https://img.shields.io/badge/license-MIT-green.svg Packagist PHP Version Support (custom server) Packagist Version GitHub code size in bytes

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.
  • Create an instance of \Temori\Distancexport\Distancexport with the created php file or controller and execute the init() 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 and post.

  • 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 in Destination Databases and Field in Source Databases.

    Data migration is ignored if Field in Source Databases is blank.

    If you enter a character string in the Uniformity column as an option, the character string described in Uniformity will be added to all records.

  • The Dry run button performs test execution, and the Run button executes data migration.

    If an exception occurs, an error message will be displayed in Results and message.

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.

DataBases/Drivers/Mysql.php

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