20220516090753_create_customer_drop_pool_tabel.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateCustomerDropPoolTabel 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('customer_drop_pool',['comment' => '客户自动回收表'])
  30. ->addColumn('customer_id', 'integer', ['limit'=> 11, 'comment' => 'customer id'])
  31. ->addColumn('uid', 'integer', ['limit'=> 11,'comment' => 'user id', 'null'=> true])
  32. ->addColumn('employee_id', 'integer', ['limit'=> 11,'comment' => '员工 id'])
  33. ->addColumn('changed_ori_info', 'text', ['comment' => '记录异动前上一次的老信息,旧employee_id,uid', 'null'=> true])
  34. ->addColumn('designer_id', 'integer', ['limit'=> 11,'comment' => '设计师id', 'null'=> true])
  35. ->addColumn('clue_id', 'integer', ['limit'=> 11,'comment' => '客户线索id', 'null'=> true])
  36. ->addColumn('phone', 'string', ['limit'=> 255,'comment' => '客户电话', 'null'=> true])
  37. ->addColumn('name', 'string', ['limit'=> 255,'comment' => '客户姓名', 'null'=> true])
  38. ->addColumn('age_range', 'string', ['limit'=> 255, 'comment' => '客户年龄', 'null'=> true])
  39. ->addColumn('level', 'string', ['limit'=> 255,'comment' => '客户等级 A B C', 'null'=> true])
  40. ->addColumn('state', 'string', ['limit'=> 255,'comment' => '客户状态:已到店,已交定,已签单', 'null'=> true])
  41. ->addColumn('community_name', 'string', ['limit'=> 255,'comment' => '小区名', 'null'=> true])
  42. ->addColumn('house_type', 'string', ['limit'=> 255,'comment' => '房屋类型 如 毛坯 精装 老房等', 'null'=> true])
  43. ->addColumn('house_delivery_time', 'string', ['limit'=> 255,'comment' => '交房时间', 'null'=> true])
  44. ->addColumn('plan_deco_time', 'string', ['limit'=> 255,'comment' => '预计装修时间', 'null'=> true])
  45. ->addColumn('square', 'string', ['limit'=> 255,'comment' => '房屋大小', 'null'=> true])
  46. ->addColumn('deco_style', 'string', ['limit'=> 255,'comment' => '装修风格', 'null'=> true])
  47. ->addColumn('budget', 'string', ['limit'=> 255,'comment' => '预算', 'null'=> true])
  48. ->addColumn('revisit_time', 'timestamp', ['comment' => '客户跟进,下次业务员回访时间(业务员填写)', 'null'=> true])
  49. ->addColumn('addtime', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '添加时间'])
  50. ->addColumn('updatetime', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '修改时间', 'update'=> 'CURRENT_TIMESTAMP'])
  51. ->addColumn('protected_to', 'timestamp', ['comment' => '保护至xx日', 'null'=> true])
  52. ->addColumn('org_id', 'integer', ['limit'=> 11,'comment' => '部门'])
  53. ->addColumn('crm_res_id', 'integer', ['limit'=> 11,'comment' => 'crm_import_log id', 'null'=> true])
  54. ->addColumn(Column::tinyInteger('is_resource')->setComment('是否属于资源库')->setDefault(0))
  55. ->addColumn('before_pool', 'string', ['limit'=> 255,'comment' => '入公海前操作信息', 'null'=> true])
  56. ->addColumn(Column::tinyInteger('bad_phone')->setComment('电话无效 1为无效')->setDefault(0))
  57. ->addColumn(Column::tinyInteger('fresh')->setComment('新客户')->setDefault(1))
  58. ->addColumn(Column::binary('sex')->setComment('性别')->setDefault(null))
  59. ->addColumn('first_visit_date', 'date', ['comment' => '首次到访时间', 'null'=> true])
  60. ->addColumn('last_contact_date', 'date', ['comment' => '上次沟通时间', 'null'=> true])
  61. ->addColumn('product', 'string', ['limit'=> 50,'comment' => '关注点', 'null'=> true])
  62. ->addColumn('source_id', 'integer', ['limit'=> 11,'comment' => '来源', 'null'=> true])
  63. ->addColumn('remark', 'string', ['limit'=> 255, 'comment'=>'备注', 'default'=> ''])
  64. ->addColumn('ext', 'json', ['comment'=>'扩展字段', 'null'=> true])
  65. ->addColumn('deposit_money', 'integer', ['limit'=> 11, 'comment'=> '收定金额', 'null'=> true])
  66. ->addColumn('signed_money', 'integer', ['limit'=> 11, 'comment'=> '签单金额', 'null'=> true])
  67. ->addColumn('aid', 'integer', ['limit'=> 11, 'comment'=> '预约活动id', 'default'=> 0])
  68. ->addColumn('house_status', 'string', ['limit'=> 255, 'comment'=> '房屋状态', 'default'=> ''])
  69. ->addColumn('agents_id', 'integer', ['limit'=> 11, 'comment'=> '所属经纪id', 'null'=> true])
  70. ->addColumn(Column::tinyInteger('agent_source_type')->setComment('经纪人客户来源 1表示手动报备2表示活动报名录入')->setDefault(1))
  71. ->addColumn('droptime', 'timestamp', ['comment'=>'删除时间', 'default' => 'CURRENT_TIMESTAMP'])
  72. ->addColumn('phone1', 'string', ['limit'=> 150, 'comment'=> '其他电话1', 'default'=> ''])
  73. ->addColumn('phone2', 'string', ['limit'=> 150, 'comment'=> '其他电话2', 'default'=> ''])
  74. ->create();
  75. }
  76. }