我正在使用 Schema API 在 Drupa 6.17 上为我的模块创建表,但这些表并未在数据库中创建。我安装了架构模块,它告诉我,虽然我的模块的架构被识别,但它的表不在数据库中。它出现在“缺失”下:
Tables in the schema that are not present in the database.
test
* test_table
以下是我的 test.install 文件的内容。
<?php
// $Id$
function test_schema() {
$schema['test_table'] = array(
'description' => t('Test table'),
'fields' => array(
'nid' => array(
'description' => t('test field'),
'type' => 'serial',
'not null' => TRUE,
),
'options' => array(
'description' => t('other test field'),
'type' => 'text',
'not null' => FALSE,
),
),
'primary key' => array('nid'),
);
return $schema;
}
function test_install() {
drupal_install_schema('test');
}
function test_uninstall() {
drupal_uninstall_schema('test');
}
如果您想在模块创建后添加模块安装,您需要从 drupal 数据库的系统表中删除记录,然后再次启用它。
禁用您的模块并保存
转到“系统”表并在那里找到您的模块
删除该记录
启用您的模块并保存
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)