I wrote a custom module to which modifications need to be made.

The major change is that I need to add a column to one of the custom tables.

My TAS.Info file looks like this (originally I did not have a version attribute. This was added while trying to get the update to work):

; $Id$
name = TAS
description = A module that allows TAS corrections.
package = TAS
version = 1
core = 6.x
dependencies[] = date_popup
dependencies[] = jstools

I added this function in my TAS.install file:

function TAS_update_1() {
  $ret = array();
  db_add_field($ret, 'tas_queue', 'manager_update_date', array('type' => 'datetime', 'not null' => FALSE));
  return $ret;
}

I also added the following entry in the TAS.install file in the TAS_schema hook:

'manager_update_date' => array
      (
        'type' => 'datetime',
        'not null' => FALSE
      )

From this point I am not exactly sure what to do to make the update run.
I tried going to http://localhost/drupal/update, however my module was not listed there. I also checked the module section and can not find how to run the update.

Any help would be greatly appreciated.

Comments

JoeMcGuire’s picture

You may need to let Drupal know the module has an update to be made.

  1. Rename your update function to
    function TAS_update_6110() {
    ...
    
  2. Update TAS.info
    version = 6.x-1.1
    
  3. Run update.php
athom09’s picture

Here are the changes I made (just to be sure ):

TAS.info (I also tried with version = 6.x-1.1):

; $Id$
name = TAS
description = A module that allows TAS corrections.
package = TAS
version = 6.x-1.1.0
core = 6.x
dependencies[] = date_popup
dependencies[] = jstools

TAS.install:

function TAS_update_6110() {
  $ret = array();
  db_add_field($ret, 'tas_queue', 'manager_update_date', array('type' => 'datetime', 'not null' => FALSE));
  return $ret;
}

Do I need to restart something or uninstall/reinstall someting ??

JoeMcGuire’s picture

Sorry for the obvious question but have you ran through update.php?

athom09’s picture

I assume you mean to run http://localhost/drupal/update thru the browser?

JoeMcGuire’s picture

It's in your Drupal root so I'd guess either:

athom09’s picture

When I run that I see several modules (but not my custom module) with the abillity to choose an update number. If I can get mine to show up here I will be in heaven.

JoeMcGuire’s picture

Understood. The module should always be listed with all available updates so you could in theory select a previous update to rerun.

So to confirm is your module list at all on update.php? If not is the module enabled and does it list on the modules page admin/build/modules?

athom09’s picture

It is not listed in the screens you get to when you run update.php. It is listed in the admin/site building/modules and is enabled.

JoeMcGuire’s picture

Cool, I managed to replicate you problem by using a module with an upper case name.

I suggest moving to a lowercase name. However when I did this I had to manually remove the record from the system table so do backup your database first.

Jaypan’s picture

It's apparently a bug in the update system that won't find modules with capital letters in their names. A few people have been reporting this over the last couple of months.

athom09’s picture

YOU ROCK! That fixed it!

frob’s picture

By Name do you mean the machine name or the human readable name in the .info file?

Jaypan’s picture

The machine name.

erantone’s picture

To fix the bug and allow upper case letters in your module name (to work with update.php), the bug in includes/install.inc should be fixed as follows:

function drupal_get_schema_versions($module) {
...
$module = strtolower($module);   // this should be added here!
foreach ($functions['user'] as $function) {
....

Cheers!