[development] hook_schema() now in .install, not .schema
merlin at logrus.com
Tue Oct 9 05:46:51 UTC 2007
Barry Jaspan wrote:
> Public service announcement:
> Prior to http://drupal.org/node/150245, hook_schema() was always defined
> in a module's .schema file. There was never any good reason for it to
> be there. The bad reason was "to avoid parsing the extra code in
> .install." However, the results of hook_schema() are cached so the
> functions only have to be called when modules are enabled/disabled or
> when CCK type structures change. This is very rare and parsing the
> .install files only on those occasions is not a performance issue.
> Now, hook_schema() must be defined in .install. The good reason for
> this is that it makes much more sense to have the schema definition and
> the schema update functions in the same place. It will make bugs of the
> "changed hook_schema() without a hook_update_N() or vice versa" sort
> less likely. And it is where God intended hook_schema() to be (says the
> If this had been an actual emergency, your mail server would already
> have crashed.
Personally, I think this was a mistake.
Not that the idea itself wasn't good, but module developers have already
started porting stuff over, and now there are no modules that can
simultaneously work with Drupal 6-beta1 and Drupal 6-beta2. This is one
of the things that can really frustrate module developers, and I don't
see a pressing need for this change. Yes, it was an error and probably
shouldn't have been this way, but it wasn't hurting anything, either.
More information about the development