By mattrweaver on
I have been using coder to upgrade a custom module from D5 to D6. This module has a single table. This is the first time I have worked with the new schema for the install file.
Below is my install file code. When I install the module, the table is not created. Maybe I am missing something obvious.
Anyone have any advice?
mrweaver
<?php
// $Id: moviecat.install v1.1 2009/7/29 $
/**
* @file
* Install, update and uninstall functions for the moviecat module.
*/
/**
* Implementation of hook_schema().
*/
function moviecat_schema() {
$schema['moviecat'] = array(
'description' => 'Movie link information.',
'fields' => array(
'nid' => array(
'description' => 'The primary identifier for a node.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE),
'vid' => array(
'description' => 'The current {node_revisions}.vid version identifier.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0),
'cover_link' => array(
'description' => 'Cover image link from Book Letters',
'type' => 'varchar',
'length' => '100',
'not null' => FALSE),
'imdb_link' => array(
'description' => 'Link to record on Internet Movie Database',
'type' => 'varchar',
'length' => '100',
'not null' => FALSE),
'rt_link' => array(
'description' => 'Link to record on RottenTomatoes.com',
'type' => 'varchar',
'length' => '100',
'not null' => FALSE),
),
'unique keys' => array(
'vid' => array('vid')
),
'primary key' => array('nid, vid'),
);
return $schema;
}
function moviecat_install() {
drupal_install_schema('moviecat');
}
function moviecat_uninstall() {
drupal_uninstall_schema('moviecat');
}
Comments
=-=
may be worth comparing to another module that installs a table or two. If you've not already.
You've probably already
You've probably already enabled the module before this .install file existed? What Drupal does is to remember the module has already once been enabled and it doesn't install the schema again unless you follow the uninstall link on the admin/build/modules page. There is a shortcut way to do this and it's to enable the devel module which has a block allowing you to reinstall modules quickly.
Pobster
Thanks!
pobster, I completely forgot about the uninstall link. I have run into the problem with modules still being recognized. That did it!
Thanks
mrweaver
Finished products are for decadent minds. -- Isaac Asimov