0

所以这让我疯狂了 2 天,我写了一个模块,它使用 3 个 DB 表,其中 2 个安装完美,这是第三个:

$schema['tags_twistal'] = array(
    'description' => t('Taxonomy for videos (tags)'),
    'fields' => array(
        'vid' => array(
            'description' => t('The video ID'),
            'type' => 'varchar',
            'length' => 255,
            'not null' => TRUE,
        ),
        'tag' => array(
            'description' => t('The tag name'),
            'type' => 'varchar',
            'length' => 255,
            'not null' => TRUE,
        ),
    ),
    'primary key' => array('tag','vid'),
);

我能想到的是它与我设置的主键有关,我也尝试过:

'unique keys' => array(
    'tag_vid' => array('tag', 'vid'),
),
'primary key' => array('tag_vid'),

有任何想法吗?我要拔头发了!

4

1 回答 1

0

I'm having a similar issue in Drupal 7.

The tables of mine that install correctly are those which have a matching entry in the array returned by hook_node_info().

It looks as though Drupal will not create any tables that are not referenced in hook_node_info(), even if they are explicitly enumerated in hook_scheme(). I can't find this documented anywhere, but it matches my experience, and is a pain in the butt.

于 2012-10-08T04:28:50.497 回答