Skip to content

MySQL tool to manage DB schema revisions, upgrades and general change.

License

Notifications You must be signed in to change notification settings

nealrichter/schemamgr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SchemaMgr
- 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.

INSTALLATION

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/schemamgr_X.pl 
Usage: either create or upgrade X database
	schemamgr_X.pl -i -uUSERNAME -pPASSWORD [-vVERSION] [-b]
		 updates DB of to current (default) or requested version
	schemamgr_X.pl -s -uUSERNAME -pPASSWORD
		 reinstalls all stored procedures
	schemamgr_X.pl -w -uUSERNAME -pPASSWORD 
		 reinstalls all views
	schemamgr_X.pl -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.

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

About

MySQL tool to manage DB schema revisions, upgrades and general change.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages