123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class CreateRiceCardTable extends Migrator
- {
- /**
- * Change Method.
- *
- * Write your reversible migrations using this method.
- *
- * More information on writing migrations is available here:
- * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
- *
- * The following commands can be used in this method and Phinx will
- * automatically reverse them when rolling back:
- *
- * createTable
- * renameTable
- * addColumn
- * renameColumn
- * addIndex
- * addForeignKey
- *
- * Remember to call "create()" or "update()" and NOT "save()" when working
- * with the Table class.
- */
- public function change()
- {
- $table = $this->table('rice_card',array('id' => true,'primary_key' => ['id'],'engine'=>'InnoDB','comment'=>'米卡表'));
- $table->addColumn('type', 'integer',array('limit' => 2,'signed'=>false,'default'=>0,'comment'=>'米卡类型 1-电子套餐卡 2-电子现金卡 3-电子实物兑换卡'))
- ->addColumn('name', 'string',array('limit' => 255,'default'=>'','comment'=>'米卡名称'))
- ->addColumn('image_id', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'米卡图'))
- ->addColumn('expire_day', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'有效天数'))
- ->addColumn('stock', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'库存'))
- ->addColumn('sale_num', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'销量'))
- ->addColumn('card_price', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>2,'signed'=>false,'default'=>0,'comment'=>'售价'))
- ->addColumn('dk_cat_ids', 'string',array('limit' => 255,'default'=>'','comment'=>'抵扣商品类目 默认空 空表示所有类目 多个类目id以逗号分隔'))
- ->addColumn('describe', 'text',array('null' => true, 'comment'=>'米卡说明'))
- ->addColumn('content', 'text',array('null' => true, 'comment'=>'米卡详情'))
- ->addColumn('status', 'integer',array('limit' => 2,'signed'=>false,'default'=>0,'comment'=>'米卡状态 默认0 0-下架 1-上架'))
- ->addColumn('is_delete', 'integer',array('limit' => 1,'signed'=>false,'default'=>0,'comment'=>'删除状态 0-未删除 1-已删除'))
- ->addColumn('create_time', 'datetime',array('null' => true,'comment'=>'创建时间'))
- ->addColumn('update_time', 'datetime',array('null' => true,'comment'=>'更新时间'))
- ->create();
- }
- }
|