20220826071420_create_za_activity_relation_table.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateZaActivityRelationTable extends Migrator
  5. {
  6. /**
  7. * Change Method.
  8. *
  9. * Write your reversible migrations using this method.
  10. *
  11. * More information on writing migrations is available here:
  12. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  13. *
  14. * The following commands can be used in this method and Phinx will
  15. * automatically reverse them when rolling back:
  16. *
  17. * createTable
  18. * renameTable
  19. * addColumn
  20. * renameColumn
  21. * addIndex
  22. * addForeignKey
  23. *
  24. * Remember to call "create()" or "update()" and NOT "save()" when working
  25. * with the Table class.
  26. */
  27. public function change()
  28. {
  29. $this->table('za_activity_relations', array('id' => true, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'comment' => '买一赠一用户关联表'))
  30. ->addColumn('order_id', 'integer',array('limit' => 11, 'signed' => false, 'default' => 0, 'comment'=>'主订单id,赠送人下单后写入一条记录'))
  31. ->addColumn('child_order_id', 'integer',array('limit' => 11, 'signed' => false, 'default' => 0, 'comment'=>'赠送订单id,领取后生成'))
  32. ->addColumn('expire_time', 'datetime',array('null' => true,'comment'=>'过期时间'))
  33. ->addColumn('receive_state', 'integer',array('limit' => 11, 'signed' => false, 'default' => 0, 'comment'=>'领取状态 0:未领取 1:已领取 2:领取失败'))
  34. ->addColumn('receive_time', 'datetime',array('null' => true,'comment'=>'领取时间'))
  35. ->addColumn('receive_user_id', 'integer',array('limit' => 11, 'signed' => false, 'default' => 0, 'comment'=>'领取用户id'))
  36. ->addColumn('create_time', 'integer', array('limit' => 10,'signed' => false, 'default' => 0, 'comment' => '创建时间'))
  37. ->addColumn('update_time', 'integer', array('limit' => 10,'signed' => false, 'default' => 0, 'comment' => '更新时间'))
  38. ->addColumn('sign_str', 'string',array('limit' => 255, 'default'=> '','comment'=>'加密串,赠送人下单支付后生成'))
  39. ->save();
  40. }
  41. }