views:

13

answers:

1

Is there a way to attach a piece of metadata to a MySQL database? I'm trying to write code to automatically update the database schema whenever a code upgrade requires it. This requires the storage of a single integer value -- the schema version. I could of course create a whole table for it, but that seems like overkill for just a simple number.

+1  A: 

You can use table comments to store the version:

ALTER TABLE table1 COMMENT = '1.4';

You'll have to regex to get the comment from this:

SHOW CREATE TABLE table1;
/COMMENT='(.*)'/
Ian Wetherbee
That's perfect! Thanks!
zildjohn01