PHP Classes

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

Recommend this page to a friend!
  Info   View files Documentation   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 125 All time: 9,395 This week: 109Up
Version License PHP version Categories
db-migration 1.0.0GNU General Publi...5PHP 5, Databases, Systems administration


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: 46
All time rank: 134711 in Hungary Hungary
Week rank: 349 Up5 in Hungary Hungary Up
Innovation award
Innovation award
Nominee: 9x

Winner: 1x



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.


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

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


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

input parameters:


   the mysql database host  


   the mysql database name  


   the mysql database user  


   the mysql database password  


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


   it will drop all tables inside the database  

  Files folder image Files  
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 Doc. Documentation

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

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,395
This week:109Up