Environment:
Drupal 6.3 MySQL 5.0.51b PHP 5.2.6 schema-6.x-1.3
I'm trying to use the schema API, but can't get it to create my table in the database. The module I'm developing is called "regatta". This is a new module from scratch, not an upgrade. I've created a regatta.install file (included below).
When I go to /admin/build/schema, it says that the boat table in the regatta module is missing. There are 46 Match (all the normal core tables), zero Mismatch, and zero Extra. Under /admin/build/schema/ describe, it lists "boat (regatta module)", and describes it correctly.
I've gone through several cycles of enabling and disabling regatta, and ran update.php. Any ideas what I'm doing wrong?
<?php // -*- mode: php; -*-
function regatta_schema() { $schema['boat'] = array( 'description' => t('A boat'), 'fields' => array( 'id' => array( 'description' => t('The primary identifier for a boat.'), 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE ), 'sail_number' => array( 'description' => t('Sail number, optionally including country id'), 'type' => 'varchar', 'not null' => TRUE, 'length' => 10, 'default' => '' ), 'boat_name' => array( 'description' => t('Boat name'), 'type' => 'varchar', 'not null' => TRUE, 'length' => 24, 'default' => '' ), 'skipper_name' => array( 'description' => t('Skipper name'), 'type' => 'varchar', 'not null' => TRUE, 'length' => 24, 'default' => '' ), ), 'primary key' => array('id'), ); return $schema; }
function regatta_install() { drupal_install_schema('regatta'); }
function regatta_uninstall() { drupal_uninstall_schema('regatta'); }
---------------- Roy Smith roy@panix.com
hi,
whenever i try to run the database update script, for instance after installing a new version of a module, I get
HTTP error 501 occured. update.php?op=do_update
If I then click on update summary i get
The update process was aborted prematurely while running update #5000 in blogapi.module. All other errors have been logged. You may need to check the watchdog database table manually.
Maybe not related:
for lack of time I have not done complete upgrades since 5.7 but only always applied the security patches. now users using mozilla on macs report severe problems such as the submit buttons missing when trying to contribute something
is this a known problem? has this anything to do with not having done upgrades, only patching?
best regards and thanks for any help armin
I wrote a regatta_update_1() function and put it in my regatta.install file. I then disabled and re-enabled the regatta module. This had no effect.
I then decided to upgrade to core 6.4. Lo and behold, after I was done with the 6.4 upgrade, my boat table was there! Obviously, there is some event which triggers running the table creation which I haven't figured out yet.
On Aug 23, 2008, at 8:42 AM, Roy Smith wrote:
Environment:
Drupal 6.3 MySQL 5.0.51b PHP 5.2.6 schema-6.x-1.3
I'm trying to use the schema API, but can't get it to create my table in the database. The module I'm developing is called "regatta". This is a new module from scratch, not an upgrade. I've created a regatta.install file (included below).
When I go to /admin/build/schema, it says that the boat table in the regatta module is missing. There are 46 Match (all the normal core tables), zero Mismatch, and zero Extra. Under /admin/build/schema/ describe, it lists "boat (regatta module)", and describes it correctly.
I've gone through several cycles of enabling and disabling regatta, and ran update.php. Any ideas what I'm doing wrong?
<?php // -*- mode: php; -*-
function regatta_schema() { $schema['boat'] = array( 'description' => t('A boat'), 'fields' => array( 'id' => array( 'description' => t('The primary identifier for a boat.'), 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE ), 'sail_number' => array( 'description' => t('Sail number, optionally including country id'), 'type' => 'varchar', 'not null' => TRUE, 'length' => 10, 'default' => '' ), 'boat_name' => array( 'description' => t('Boat name'), 'type' => 'varchar', 'not null' => TRUE, 'length' => 24, 'default' => '' ), 'skipper_name' => array( 'description' => t('Skipper name'), 'type' => 'varchar', 'not null' => TRUE, 'length' => 24, 'default' => '' ), ), 'primary key' => array('id'), ); return $schema; }
function regatta_install() { drupal_install_schema('regatta'); }
function regatta_uninstall() { drupal_uninstall_schema('regatta'); }
Roy Smith roy@panix.com
-- [ Drupal support list | http://lists.drupal.org/ ]
---------------- Roy Smith roy@panix.com
Quoting Roy Smith roy@panix.com:
I wrote a regatta_update_1() function and put it in my regatta.install file. I then disabled and re-enabled the regatta module. This had no effect.
I then decided to upgrade to core 6.4. Lo and behold, after I was done with the 6.4 upgrade, my boat table was there! Obviously, there is some event which triggers running the table creation which I haven't figured out yet.
If you had your module activated without a table and then added the table later, could be a reason. You need to Uninstall to remove the module from the system table so that it will do a fresh install. The upgrade caught your regatta_update_1 and then installed the table when you ran the update.php file.
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
On Aug 24, 2008, at 4:10 PM, Earnie Boyd wrote:
Quoting Roy Smith roy@panix.com:
I wrote a regatta_update_1() function and put it in my regatta.install file. I then disabled and re-enabled the regatta module. This had no effect.
I then decided to upgrade to core 6.4. Lo and behold, after I was done with the 6.4 upgrade, my boat table was there! Obviously, there is some event which triggers running the table creation which I haven't figured out yet.
If you had your module activated without a table and then added the table later, could be a reason.
Yes, I think that's probably what I did.
What exactly do I need to do to uninstall a module? I assume you start by removing the entire /sites/all/modules/regatta directory, but then what? Is visiting any page in the site enough to make drupal notice that it's gone, or is there something more explicit that needs to be done?
You need to Uninstall to remove the module from the system table so that it will do a fresh install. The upgrade caught your regatta_update_1 and then installed the table when you ran the update.php file.
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
-- [ Drupal support list | http://lists.drupal.org/ ]
---------------- Roy Smith roy@panix.com
Quoting Roy Smith roy@panix.com:
On Aug 24, 2008, at 4:10 PM, Earnie Boyd wrote:
Quoting Roy Smith roy@panix.com:
I wrote a regatta_update_1() function and put it in my regatta.install file. I then disabled and re-enabled the regatta module. This had no effect.
I then decided to upgrade to core 6.4. Lo and behold, after I was done with the 6.4 upgrade, my boat table was there! Obviously, there is some event which triggers running the table creation which I haven't figured out yet.
If you had your module activated without a table and then added the table later, could be a reason.
Yes, I think that's probably what I did.
What exactly do I need to do to uninstall a module? I assume you start by removing the entire /sites/all/modules/regatta directory, but then what? Is visiting any page in the site enough to make drupal notice that it's gone, or is there something more explicit that needs to be done?
Assuming the module has a hook_uninstall in its .install file then you click the "Uninstall" tab on the admin/build/modules page, click the checkbox of the module(s) you want to uninstall, submit the page and then confirm the unstall. You do not have to remove the directory nor should you unless you no longer want it; but, do that ``after'' the uninstall.
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
On Aug 25, 2008, at 7:46 AM, Earnie Boyd wrote:
Assuming the module has a hook_uninstall in its .install file then you click the "Uninstall" tab on the admin/build/modules page, click the checkbox of the module(s) you want to uninstall, submit the page and then confirm the unstall. You do not have to remove the directory nor should you unless you no longer want it; but, do that ``after'' the uninstall.
OK, now I get it. I hadn't even noticed the Uninstall tab. The full drill looks like:
1) admin/build/modules 2) uncheck "Enabled" for my module 3) click the "Save configuration" button 4) click the Uninstall tab at the top of the admin/build/modules page 5) check the "Uninstall" box for my module 6) click the "Uninstall" button
Then, copy my new regatta.module and regatta.install files into the sites/all/modules/regatta directory and reverse the above steps.
Thanks!
---------------- Roy Smith roy@panix.com