Location: PHPKode > scripts > Database metadata > readme.txt
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, hide@address.com
CZ: www.nicodenboer.com, hide@address.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)

Return current item: Database metadata