ecstore数据库表生成方式dbschema建表规则
每一个APP中如果有相应的数据库表那么他的建表方式如下:
首先在你的应用名以【每日签到送积分】(signin)为例下新建文件dbschema/signin.php
signin.php 中内容如下
$db['signin'] = array /*这里的signin 必须和文件名相同*/
(
'columns'=>array
(
'id' => /*表字段*/
array (
'type' => 'bigint unsigned', /*字段类型 如果是枚举类型则定义为array();具体请参考b2c中的表*/
'extra' => 'auto_increment',
'pkey' => true,
'label' => 'ID', /*显示在列表中内容*/
'required' => true, /*是否必填*/
'editable' => false,
'filtertype' => 'yes', /*搜索类型= 如果是has 则表示like*/
),
'member_id'=>
array(
'type' => "table:members@b2c",
),
'name' =>
array(
'type' => 'varchar(320)',
'label' => app::get('b2c')->_('姓名'),
'required' => true,
'editable' => false,
'in_list' => true, /*是否在列表中显示*/
'default_in_list' => true, /*是否默认在列表中*/
'filtertype' => 'has',
'filterdefault' => true, /*是否允许在高级搜索中*/
'searchtype' => 'has',
),
'createtime' =>
array(
'type' => 'time',
'label' => app::get('b2c')->_('签到时间'),
'editable' => false,
'in_list' => true,
'default_in_list' => true,
'filtertype' => 'time',
'filterdefault' => true,
'require' => true,
),
'jf' =>
array(
'type' => 'smallint(5)',
'default' => 0,
'label' => app::get('b2c')->_('积分'),
'width' => 110,
'editable' => false,
'filtertype' => 'number',
'in_list' => true,
'default_in_list' => true,
),
),
'comment' => app::get('b2c')->_('签到表'),
'engine' => 'innodb',
'version' => '$Rev: 42798 $',
);
如有任何疑问都可以直接联系QQ:2392521892来解答。
