继续Drupal分享精神 QQ群:107748121 站长QQ:2275288328 skype: hellodrupal【drupal交流+drupal 建站+theme制作】
登录 注册

建立 drupal .install 安装文件 数据库的初始化设计

根据需要多建立了木地板的其他属性,比如产地,国外名字,拉丁文名字。 这里是数据库安装和卸载的设置,写好以后保持,然后在后台开启模块,在数据库里面就会自动添加了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数据表已经在数据库里面了,写了这样多的代码,终于看到了。满有成就感的,这种建立数据表的方式是很接单,而且数据库开发效率也高了。 一步一步来吧,每天学习一点,这样就积累了丰富的开发经验!

评论

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 自动断行和分段。
  • You can use BBCode tags in the text.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.