hook_install() doesn't do the right thing
Kiam@avpnet.org - May 21, 2008 - 18:39
| Project: | User Points |
| Version: | 5.x-3.5 |
| Component: | Other |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
The hook_install() function doesn't create the event field.
The function is supposed to be called when Drupal does not find any previous version of the module; in this case, if a user installs the 5.x-3.5 version, he will keep to get an error about an undefined field.

#1
The field is not even added by any
hook_update_N()functions.I had to manually add the field using phpAdmin.
#2
Actually, 'event' is now called 'operation'. update # 7 should have changed that for you.
If you have a contributed module that uses 'event', it should be ported to use the new field.
#3
hook_update_N()implementations get called when the module is already registered in the Drupal{system}table, and drupal finds a new version of the module.hook_update_N()does not get called the first time the module is installed.In the specific case, the new field will not installed in a Drupal installation without any previous version of the module installed, if
hook_install()does not provide to create it.#4
I don't understand what you are talking about.
Do you have a patch that fixes whatever problem you are seeing?
#5
I spitted the issue in two (#265095: Table field get inconsistently named, #265097: hook_update_N() doesn't update any PostgreSQL tables).
On the intranet we use at work we have a web server using a PostgreSQL database, and I had a problem after installing the version 5.x-3.5 of the module (which was not installed before).
I just noticed today that the database was not MySQL as I was wrongly supposing.
#6
I just checked and tested it and hook_install does create both the mysql and postgres SQL tables correctly.
and you're correct almost none of the hook_update_* functions have postgres support. Most of the Queries should work just fine on mysql and postgres but for those that won't I updated to the postgres area.
As per a previous conversation the event field has been renamed to operation thus the original topic of the issue is incorrect.
#7
#8
One final note: the use of PostgreSQL in all of Drupal is far less than MySQL, so do not expect that just reporting a PostgreSQL issue will get it fixed as quickly as MySQL.
If you want good support for PostgreSQL for a module, you have to put in the effort by creating and/or testing patches for it specifically.
#9
Automatically closed -- issue fixed for two weeks with no activity.