MySQL tool to manage DB schema revisions, upgrades and general change.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


- Author Neal Richter 
- Perl code written in 2007
- Currently used as a production tool

SchemaMgr is a simple perl tool to manage schema change in MySQL DBs.
This has been used in production since 2007.

Each change is assigned a version number and placed in a file.  When the SQL
in the file is executed successfully, a special table is set with that version number.
Subsequent runs install only the higher versioned files.

It can also be used to reinstall views and stored procedures.


1) Edit the file and replace the occurances of X with your database-name.  The 
current/lazy best practice for this tool is to make a derivative copy for 
each database-name and customize to its needs.

2) It is necessary to install the version tracking table with build/install_config_table.sql

Example upgrade steps with version naming conventions are in the build directory.

$ ./bin/ 
Usage: either create or upgrade X database -i -uUSERNAME -pPASSWORD [-vVERSION] [-b]
		 updates DB of to current (default) or requested version -s -uUSERNAME -pPASSWORD
		 reinstalls all stored procedures -w -uUSERNAME -pPASSWORD 
		 reinstalls all views -q -uUSERNAME -pPASSWORD 
		 Requests and prints current version
Optional Params 
	 -vXX -- upgrades upto a specific version number XX 
	 -b   -- backs up the database (with data) before upgrades 
	 -nYY -- runs the upgrades against database YY - default is X 

By convention you create ONE create_X_objects_v1 file with a date.  All other files are update files with greater than v1 numbers.

|-- create_X_objects_v1_20110615.sql
|-- update_X_objects_v2_20110701.sql
`-- update_X_objects_v3_20110702.sql