1
0

20221127192906_create_customer_extension_table.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateCustomerExtensionTable 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. $table = $this->table('customer_extension', ['comment' => '员工pc端推广明细表', 'engine'=>'InnoDB']);
  30. $table->addColumn('addtime', 'date',array('comment'=>'投放日期'))
  31. ->addColumn(Column::decimal('money',10,2)->setComment('推广费用')->setDefault(0))
  32. ->addColumn('show', 'integer', array('default'=> '0', 'comment'=>'展现次数'))
  33. ->addColumn('click', 'integer', array('default'=> '0', 'comment'=>'点击次数'))
  34. ->addColumn('root_id', 'integer', array('default'=> '0', 'comment'=>'所属企业'))
  35. ->addColumn('employee_id', 'integer', array('default'=> '0', 'comment'=>'员工id'))
  36. ->addColumn('org_id', 'integer', array('default'=> '0', 'comment'=>'所属部门id'))
  37. ->addColumn('source_id', 'integer', array('default'=> '0', 'comment'=>'来源id'))
  38. ->create();
  39. }
  40. }