[development] versioned schema?
barry at jaspan.org
Mon Jun 11 04:03:03 UTC 2007
"Peter Wolanin" <pwolanin at gmail.com> writes:
> To me this suggests that there should be a way having several
> different schema in the .schema file with different version numbers.
Yes. I intentionally left this out because I wasn't sure of the best
way to do it (or even a necessarily good way). Some options:
1. hook_schema_1(), hook_schema_2(), etc.
2. hook_schema($version = SCHEMA_CURRENT)
3. Optionally encoding a version number with each element of the
schema; "this field was added in version 3", "this index was
removed in version 4."
I kinda like #2 the best, but #1 may make more sense with our current
hook_update_N() system. (#3 has the "advantage" that we might be able
to automatically update from one version to the next, but it could
also be very complicated.) Perhaps hook_schema_N() and
hook_update_N() should be tied together in some way so that the new
schema and the upgrade path to get to it from the previous one are
always specified together.
Feel free to make a proposal. :-)
More information about the development