20220510150316_create_customer_subscribe_table.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateCustomerSubscribeTable 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('customers_subscribe')
  30. ->addColumn('customer_id', 'integer', ['comment'=>'客户id'])
  31. ->addColumn('subscribe_date', 'date', ['comment'=>'预约时间'])
  32. ->addColumn('hour', 'integer', ['comment'=>'预约时间_小时', 'default'=>12])
  33. ->addColumn('employee_id', 'integer', ['comment'=>'客户所属人'])
  34. ->addColumn('designer_id', 'integer', ['comment'=>'客户所属设计师', 'null'=>true])
  35. ->addColumn('type', 'integer', ['comment'=>'预约类型'])
  36. ->addColumn('state', 'integer', ['comment'=>'是否已确认', 'default'=>0])
  37. ->addColumn('aid', 'integer', ['comment'=>'活动id', 'default'=>0])
  38. ->addColumn('org_id', 'integer', ['comment'=>'所属销售部门'])
  39. ->addColumn('addtime', 'timestamp', ['comment'=>'添加时间', 'default'=>'CURRENT_TIMESTAMP'])
  40. ->create();
  41. }
  42. }