モジュールのDrupal7スキーマに問題があります。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' => 255,
'not null' => true,
),
'series_id' => array(
'type' => 'int',
),
),
'foreign keys' => array(
'series_id' => array(
'table' => 'series',
'columns' => array('series_id' => 'id'),
),
),
'primary key' => array('id'),
);
return $schema;
}
このコードはテーブルを作成しますが、外部キーは作成しません。Drupal.orgから取得した実装例:http://drupal.org/node/146939
Drupalのバージョンは7.0-beta3です..アイデアとして:多分、まだ実装されていないので、node
表には表示されません(ドキュメントの例はインストーラーからのコードを指しています)。
お手伝いありがとうございます。