根据需要多建立了木地板的其他属性,比如产地,国外名字,拉丁文名字。
这里是数据库安装和卸载的设置,写好以后保持,然后在后台开启模块,在数据库里面就会自动添加了product这个表和相关性的字段了。
t('Product description'),
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => t("The product's {node}.nid.")
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => t("The product's {node_revisions}.vid")
),
'origin' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => t("Where are the products origin")
),
'engname' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => t("The product English name")
),
'laname' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => t("The product Laname")
),
'anothername' => array(
'type' => 'varchar',
'length' =>128,
'not null' => TRUE,
'default' => '',
'description' => t("The product anothername")
),
),
'primary key' => array('nid', 'vid'),
'unique keys' => array(
'vid' => array('vid')
),
'indexes' => array(
'nid' => array('nid')
),
);
Return $schema;
}
?>
看到没有,product数据表已经在数据库里面了,写了这样多的代码,终于看到了。满有成就感的,这种建立数据表的方式是很接单,而且数据库开发效率也高了。
一步一步来吧,每天学习一点,这样就积累了丰富的开发经验!
评论
发表新评论