PHP Classes

PHP DB Migration Library: Migrate MySQL database tables with given SQL files

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 128 All time: 9,385 This week: 206Up
Version License PHP version Categories
db-migration 1.0.0GNU General Publi...5PHP 5, Databases, Systems administration
Description 

Author

This package can migrate MySQL database tables with given SQL files.

It scans a given directory with files with SQL statements to be executed.

The class can execute the SQL files that were found using the mysql command program.

The class also keeps track of all SQL files that have been executed before by updating a file in CSV format with the previously executed SQL files, so it does not execute those SQL files again unless an option to force reloading those files is passed to the class.

Optionally the class can also drop all the tables of the specified database before executing the migration SQL files.

Picture of Istvan Dobrentei
  Performance   Level  
Name: Istvan Dobrentei <contact>
Classes: 12 packages by
Country: Hungary Hungary
Age: 47
All time rank: 134511 in Hungary Hungary
Week rank: 164 Up3 in Hungary Hungary Up
Innovation award
Innovation award
Nominee: 9x

Winner: 1x

Documentation

db-migration

Migration Class to help automatization

The migration Class is a command line php utility and it helps to automatizate database changings and its migrations. It is useful for example to create a Continous Integration environment. The sqlauto directory containts an init script and some mysql stored procedures.

Usage:

put mysql migration files into the sqlauto directory file name conventions:

- start with sql + iso date format (YYYYMMDD)  
- should end with .sql  

Run:

/usr/local/bin/php migration_runner.php --host=127.0.0.1 --database=bl_model_unit --user=root --password=345+4 --forceload=1 --droptables=1

input parameters:

--host

   the mysql database host  

--database

   the mysql database name  

--user

   the mysql database user  

--password

   the mysql database password  

--forceload

   it will load all sql files into the database, ignore the .migrated file content  

--droptables

   it will drop all tables inside the database  

  Files folder image Files (4)  
File Role Description
Files folder imagesqlauto (1 file)
Accessible without login Plain text file LICENSE Lic. License text
Plain text file migration_runner.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (4)  /  sqlauto  
File Role Description
  Accessible without login Plain text file sql00000000_init.sql Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:128
This week:0
All time:9,385
This week:206Up