PHP Classes

Database metadata: Update a MySQL database schema using on metadata

Recommend this page to a friend!
  Info   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 46%Total: 667 All time: 4,842 This week: 488Up
Version License Categories
dbmedata 1.0.0GNU General Publi...Databases
Description 

Author

This package can be used to update the schema of a MySQL database.

It takes the metadata that defines the schema and compares to the schema of a MySQL database, eventually already installed, and applies the necessary alterations to update the schema.

Picture of Nico den Boer
Name: Nico den Boer <contact>
Classes: 2 packages by
Country: Czech Republic Czech Republic
Age: 57
All time rank: 224126 in Czech Republic Czech Republic
Week rank: 180 Up1 in Czech Republic Czech Republic Up

Details

Short description: This class can update a database structure based on metadata in a SQL script Detailed description: If you deploy your webapplication to more then one server, you need to apply the same structure updates and perhaps also the same user data patches on all servers in a similar way. Did you ever wonder how you can smoothly organize this ? This class reads a sql script with metadata, then updates the database structure accordingly and finally applies patches on user data. A user interface for editing the metadata is not provided. Code is written in PHP5. Description of files: update.php Main page to execute a update. class.mysql.db.maint.inc.php Main class which arranges update of database structure class.backbone.inc.php Class with some generic utility methods class.metadata.inc.php Class with utility methods for metadata classes.mySql.inc.php Classes with database abstraction for MySql class.sqlBuilder.inc.php Class to build a SQL INSERT or UDPATE config.database.inc.php File with database access config parameters InsertMetaData.sql SQL CREATE script, for the required tables Copyright: Nico den Boer NL: www.denboer-ims.nl, info@denboer-ims.nl CZ: www.nicodenboer.com, nico@nicodenboer.com However, you are free to copy and use the code as you like ;) Installation: 1) Create a empty database dbmetadata 2) Execute the script InsertMetaData.sql 3) Open the script InsertMetaData.sql and remove all text starting from line /* Remove the part below after initial installation */ 4) Run the page update.php to see if it works :) After installation: 1) Edit the metadata in the tables db_tables, db_fields, db_indexes 2) Create a new script InsertMetaData.sql with a full backup of db_tables, db_fields, db_indexes 3) If you have user data updates, update the page update.php with relevant patches 4) Distribute the new files update.php and InsertMetaData.sql to (the webservers of) your customers 5) Instruct your customers to run update.php (or add a auto-update function to your application to do it all automatically)

Screenshots (1)  
  • snapshot1.png
  Files folder image Files (10)  
File Role Description
Plain text file classes.mySql.inc.php Class Baseclass for Database abstraction for MySql
Accessible without login Plain text file class.mysql.db.maint.inc.php Class Arranges update of database structure, based on metadata
Accessible without login Plain text file update.php Appl. Main page to execute a update.
Plain text file class.backbone.inc.php Class Class with some generic utility methods
Plain text file class.metadata.inc.php Class Class with utility methods for metadata
Plain text file class.sqlBuilder.inc.php Class Class to build a SQL INSERT or UDPATE
Plain text file config.database.inc.php Conf. Database config
Plain text file InsertMetaData.sql Data SQL CREATE script, for the required tables
Plain text file readme.txt Doc. Documentation

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  
 0%
Total:667
This week:0
All time:4,842
This week:488Up
User Ratings User Comments (1)
 All time
Utility:66%StarStarStarStar
Consistency:75%StarStarStarStar
Documentation:58%StarStarStar
Examples:-
Tests:-
Videos:-
Overall:46%StarStarStar
Rank:3160
 
Excellent
15 years ago (kishore kumar)
70%StarStarStarStar