123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class AlterColumnToOrderGoods 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()
- {
- $this->table('order_goods')
- ->addColumn('distributor_radio', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>2,'signed'=>false,'default'=>0,'comment'=>'分销员顾客购物折扣比例'))
- ->addColumn('distributor_goods_price', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>2,'signed'=>false,'default'=>0,'comment'=>'分销员顾客购物单价减去的优惠价格'))
- ->addColumn('distributor_total_money', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>2,'signed'=>false,'default'=>0,'comment'=>'分销员顾客购物减去的优惠总价'))
- ->addColumn('rice_card_id', 'integer',array('limit' => 11,'default'=>0,'comment'=>'购买的现金米卡ID'))
- ->addColumn('rice_card_money', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>2,'signed'=>false,'default'=>0,'comment'=>'现金米卡抵扣的价格'))
- ->save();
- $this->table('order')
- ->addColumn('distributor_total_money', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>2,'signed'=>false,'default'=>0,'comment'=>'分销员顾客购物减去的优惠总价'))
- ->addColumn('rice_card_id', 'integer',array('limit' => 11,'default'=>0,'comment'=>'购买的现金米卡ID'))
- ->addColumn('rice_card_money', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>2,'signed'=>false,'default'=>0,'comment'=>'现金米卡抵扣总价格'))
- ->addColumn('rice_card_express_money', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>2,'signed'=>false,'default'=>0,'comment'=>'现金米卡抵扣运费金额'))
- ->save();
- }
- }
|