2017 © Pedro Peláez
 

library php-migrationtool

Migration tool for PHP

image

petrknap/php-migrationtool

Migration tool for PHP

  • Friday, July 21, 2017
  • by petrknap
  • Repository
  • 1 Watchers
  • 0 Stars
  • 264 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 16 Versions
  • 7 % Grown

The README.md

Migration tool for PHP

What is Migration?

Data migration is the process of transferring data between storage types, formats, or computer systems. It is a key consideration for any system implementation, upgrade, or consolidation. Data migration is usually performed programmatically to achieve an automated migration, freeing up human resources from tedious tasks. Data migration occurs for a variety of reasons, including server or storage equipment replacements, maintenance or upgrades, application migration, website consolidation and data center relocation., (*1)

-- Data migration - Wikipedia, The Free Encyclopedia, (*2)

Usage of php-migrationtool

Migration files

Migration file is file placed in special directory like /migrations. Migration file name contains 3 parts: migration id, description separated by space (optional) and extension separated by dot (optional) - the valid names for migration files are {id}, {id}.{extension}, {id} {description} and {id} {description}.{extension}., (*3)

user@localhost:~/project/migrations$ ls
M0001  M0002.ext  M0003 - Third migration  M0004 - Fourth migration.ext

Migration tools process all files located in directory in ascending order (sorted by file names). If applying of any migration file throws exception, the changes invoked by this file will be canceled and migration tool will be stopped., (*4)

Migration tools also contain lists of applied migrations and guarantee that every file will be processed only once and only in case that there is not applied migration with higher id., (*5)

Migration tools

All migration tools implement MigrationToolInterface with method migrate()., (*6)

<?php

/**
 * @var $tool PetrKnap\Php\MigrationTool\MigrationToolInterface
 */
$tool->migrate();

SQL migration tool

WARNING: The SQL migration tool processes only files with extension sql., (*7)

<?php

/** @var \Doctrine\DBAL\Connection $connection */
$tool = new PetrKnap\Php\MigrationTool\SqlMigrationTool(
    __DIR__ . '/migrations',
    $connection
);

/** @var \Psr\Log\LoggerInterface $logger */
$tool->setLogger($logger);
$tool->migrate();

SQL migration tool supports native SQL files as migration file. You can simply copy and paste output from orm:schema-tool:update --dump-sql, phpMyAdmin, Adminer or whatever with SQL output., (*8)

How to install

Run composer require petrknap/php-migrationtool or merge this JSON code with your project composer.json file manually and run composer install. Instead of dev-master you can use one of released versions., (*9)

{
    "require": {
        "petrknap/php-migrationtool": "dev-master"
    }
}

Or manually clone this repository via git clone https://github.com/petrknap/php-migrationtool.git or download this repository as ZIP and extract files into your project., (*10)

The Versions

21/07 2017

dev-master

9999999-dev https://petrknap.github.io/docs/php-migrationtool.html

Migration tool for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

21/07 2017

v2.0.0-rc4

2.0.0.0-RC4 https://petrknap.github.io/docs/php-migrationtool.html

Migration tool for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

25/05 2017

v2.0.0-rc3

2.0.0.0-RC3 https://petrknap.github.io/docs/php-migrationtool.html

Migration tool for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

25/05 2017

v2.0.0-rc2

2.0.0.0-RC2 https://petrknap.github.io/docs/php-migrationtool.html

Migration tool for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

24/05 2017

v2.0.0-rc1

2.0.0.0-RC1 https://petrknap.github.io/docs/php-migrationtool.html

Migration tool for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

18/05 2017

dev-backup/2017-05-18_master

dev-backup/2017-05-18_master https://github.com/petrknap/php-migrationtool

Migration tool for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

18/05 2017

v1.1.2

1.1.2.0 https://github.com/petrknap/php-migrationtool

Migration tool for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

14/02 2017

dev-feature/second_version

dev-feature/second_version https://github.com/petrknap/php-migrationtool

Migration tool for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

14/02 2017

v1.1.1

1.1.1.0 https://github.com/petrknap/php-migrationtool

Migration tool for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

04/02 2017

v1.1.0

1.1.0.0 https://github.com/petrknap/php-migrationtool

Migration tool for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

04/02 2017

dev-develop

dev-develop https://github.com/petrknap/php-migrationtool

Migration tool for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

29/01 2017

v1.0.2

1.0.2.0 https://github.com/petrknap/php-migrationtool

Migration tool for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

19/01 2017

v1.0.1

1.0.1.0 https://github.com/petrknap/php-migrationtool

Migration tool for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

25/06 2016

v1.0.0

1.0.0.0 https://github.com/petrknap/php-migrationtool

Migration tool for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

24/06 2016

v0.0.2

0.0.2.0 https://github.com/petrknap/php-migrationtool

Migration tool for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

23/06 2016

v0.0.1

0.0.1.0 https://github.com/petrknap/php-migrationtool

Migration tool for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires