|versioning the db
||[Jan. 21st, 2002|10:15 pm]
I have an idea that sounds nice.|
Let's explicitly version the db schema. Create a new table, say "metadata", and store there the current vesion of the db schema, like "1.234" . The major version changes rarely when there're lots of integrated changes to the DB structure. The minor version changes all the time: every little alter, every new table, every field widening, etc.
Why? Because update-db-general.pl keeps getting more complicated, and its logic isn't executed in the same order changes were made, which hasn't been a problem so far but might be in the future. With versioning, update-db.pl would just look at the current version, then jump change by change to the most recent structure in the order changes were made. Every time we change something in the DB, we register a small routine keyed to the version number to do exactly this little change and nothing more. Changes of major versions may be coded to involve running larger external conversion scripts.
Maybe so far it's been a non-issue, or maybe not. I think it's the right thing to do, anyway. Thoughts?
P.S. Other things could be stored in the metadata table: for example running statistics of DB size or things like that. Can we graph, currently, how the DB has been growing during the last year?