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: 115 All time: 9,381 This week: 124Up
Version License PHP version Categories
db-migration 1.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
Innovation award
Innovation award
Nominee: 9x

Winner: 1x

Details

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  
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  /  sqlauto  
File Role Description
  Accessible without login Plain text file sql00000000_init.sql Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:115
This week:0
All time:9,381
This week:124Up
For more information send a message to info at phpclasses dot org.