Module installation - multiple tables
Posted: Mon May 22, 2006 2:59 pm
This is probably a really stupid coding error, but I can't seem to find it, and maybe something obvious will jump out to someone else...
I'm trying to install two tables, and I'm getting the first one and its _seq table, then the second one I only get the _seq table. Here's the code (I used ModuleMaker to make the skeleton files):
After installing this module, I see the following tables:
cms_module_testmodule_contactgroups_seq
cms_module_testmodule_contacts
cms_module_testmodule_contacts_seq
What am I doing wrong to make the cms_module_testmodule_contactgroups table not get installed?
Btw, I'm using CMSMS 0.13, Apache/MySQL on a Linux webhost. This is my first time to try creating a module, but I don't see anything different about mine than what I see in other modules with multiple tables, so a new pair of eyes should be helpful. Thanks!
I'm trying to install two tables, and I'm getting the first one and its _seq table, then the second one I only get the _seq table. Here's the code (I used ModuleMaker to make the skeleton files):
Code: Select all
function Install()
{
// Typical Database Initialization
$db = &$this->cms->db;
// mysql-specific, but ignored by other database
$taboptarray = array('mysql' => 'TYPE=MyISAM');
$dict = NewDataDictionary($db);
// CONTACTS table
// table schema description
$flds = "
id I KEY,
name C(80),
email C(80),
position C(80)
";
// create it. This should do error checking, but I'm a lazy sod.
$sqlarray = $dict->CreateTableSQL(cms_db_prefix()."module_testmodule_contacts",
$flds, $taboptarray);
$dict->ExecuteSQLArray($sqlarray);
// create a sequence
$db->CreateSequence(cms_db_prefix()."module_testmodule_contacts_seq");
// CONTACTGROUPS table
// table schema description
$flds = "
id I KEY,
group C(80),
contact I
";
// create it. This should do error checking, but I'm a lazy sod.
$sqlarray = $dict->CreateTableSQL(cms_db_prefix()."module_testmodule_contactgroups",
$flds, $taboptarray);
$dict->ExecuteSQLArray($sqlarray);
// create a sequence
$db->CreateSequence(cms_db_prefix()."module_testmodule_contactgroups_seq");
// permissions
// put mention into the admin log
$this->Audit( 0, $this->Lang('friendlyname'), $this->Lang('installed',$this->GetVersion()));
}
cms_module_testmodule_contactgroups_seq
cms_module_testmodule_contacts
cms_module_testmodule_contacts_seq
What am I doing wrong to make the cms_module_testmodule_contactgroups table not get installed?
Btw, I'm using CMSMS 0.13, Apache/MySQL on a Linux webhost. This is my first time to try creating a module, but I don't see anything different about mine than what I see in other modules with multiple tables, so a new pair of eyes should be helpful. Thanks!