小编lif*_*der的帖子

Drupal 7架构中的外键问题

我在模块的Drupal 7架构上遇到了麻烦.有4个表,但样本2就足够了:

function mymodule_schema() {
$schema['series'] = array(
    'fields' => array(
        'id' => array(
            'type' => 'serial',
            'unsigned' => true,
            'not null' => true,
        ),
        'name' => array(
            'type' => 'varchar',
            'length' => 255,
            'not null' => true,
        ),
    ),
    'unique keys' => array(
        'name' => array('name'),
    ),
    'primary key' => array('id'),
);

$schema['sermon'] = array(
    'fields' => array(
        'id' => array(
            'type' => 'serial',
            'unsigned' => true,
            'not null' => true,
        ),
        'title' => array(
            'type' => 'varchar',
            'length' …
Run Code Online (Sandbox Code Playgroud)

drupal foreign-keys drupal-7 drupal-modules drupal-schema

3
推荐指数
1
解决办法
3356
查看次数