123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- use think\facade\Db;
- class CreateCustomerRecycleTable 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('customer_recycle',['comment' => '客户回收表'])
- ->addColumn('customer_id', 'integer', ['limit'=> 11,'comment' => 'customer id'])
- ->addColumn('uid', 'integer', ['limit'=> 11,'comment' => 'user id'])
- ->addColumn('employee_id', 'integer', ['limit'=> 11,'comment' => '员工 id'])
- ->addColumn('changed_ori_info', 'text', ['comment' => '记录异动前上一次的老信息,旧employee_id,uid'])
- ->addColumn('designer_id', 'integer', ['limit'=> 11,'comment' => '设计师id'])
- ->addColumn('clue_id', 'integer', ['limit'=> 11,'comment' => '客户线索id'])
- ->addColumn('phone', 'string', ['limit'=> 255,'comment' => '客户电话'])
- ->addColumn('name', 'string', ['limit'=> 255,'comment' => '客户姓名'])
- ->addColumn('age_range', 'string', ['limit'=> 255,'comment' => '客户年龄'])
- ->addColumn('level', 'string', ['limit'=> 255,'comment' => '客户等级 A B C'])
- ->addColumn('state', 'string', ['limit'=> 255,'comment' => '客户状态:已到店,已交定,已签单'])
- ->addColumn('community_name', 'string', ['limit'=> 255,'comment' => '小区名'])
- ->addColumn('house_type', 'string', ['limit'=> 255,'comment' => '房屋类型 如 毛坯 精装 老房等'])
- ->addColumn('house_delivery_time', 'string', ['limit'=> 255,'comment' => '交房时间'])
- ->addColumn('plan_deco_time', 'string', ['limit'=> 255,'comment' => '预计装修时间'])
- ->addColumn('square', 'string', ['limit'=> 255,'comment' => '房屋大小'])
- ->addColumn('deco_style', 'string', ['limit'=> 255,'comment' => '装修风格'])
- ->addColumn('budget', 'string', ['limit'=> 255,'comment' => '预算'])
- ->addColumn('revisit_time', 'timestamp', ['comment' => '客户跟进,下次业务员回访时间(业务员填写)'])
- ->addColumn('addtime', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '添加时间'])
- ->addColumn('updatetime', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '修改时间', 'update'=> 'CURRENT_TIMESTAMP'])
- ->addColumn('protected_to', 'timestamp', ['comment' => '保护至xx日'])
- ->addColumn('org_id', 'integer', ['limit'=> 11,'comment' => '部门'])
- ->addColumn('crm_res_id', 'integer', ['limit'=> 11,'comment' => 'crm_import_log id'])
- ->addColumn('is_resource', 'integer', ['limit'=> 4,'comment' => '是否属于资源库'])
- ->addColumn('before_pool', 'string', ['limit'=> 255,'comment' => '入公海前操作信息'])
- ->addColumn('bad_phone', 'integer', ['limit'=> 4,'comment' => '电话无效 1为无效'])
- ->addColumn('fresh', 'integer', ['limit'=> 4,'comment' => '新客户'])
- ->addColumn('sex', 'tinyblob', ['comment' => '性别'])
- ->addColumn('first_visit_date', 'timestamp', ['comment' => '首次到访时间'])
- ->addColumn('last_contact_date', 'timestamp', ['comment' => '上次沟通时间'])
- ->addColumn('product', 'string', ['limit'=> 50,'comment' => '关注点'])
- ->addColumn('source_id', 'integer', ['limit'=> 11,'comment' => '来源'])
- ->addColumn('remark', 'string', ['limit'=> 255, 'comment'=>'备注'])
- ->addColumn('ext', 'json', ['comment'=>'扩展字段', 'default' => 'NULL'])
- ->addColumn('deletetime', 'timestamp', ['comment'=>'删除时间', 'default' => 'CURRENT_TIMESTAMP'])
- ->create();*/
- Db::execute("CREATE TABLE `fl_customer_recycle` (
- `id` int(11) NOT NULL,
- `customer_id` int(11) DEFAULT NULL COMMENT 'customer id',
- `uid` int(11) DEFAULT NULL COMMENT 'user id',
- `employee_id` int(11) DEFAULT NULL COMMENT '员工 id',
- `changed_ori_info` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '记录异动前上一次的老信息,旧employee_id,uid',
- `designer_id` int(11) DEFAULT NULL COMMENT '设计师id',
- `clue_id` int(11) DEFAULT NULL COMMENT '客户线索id',
- `phone` varchar(255) DEFAULT NULL COMMENT '客户电话',
- `name` varchar(255) DEFAULT NULL COMMENT '客户姓名',
- `age_range` varchar(255) DEFAULT NULL COMMENT '客户年龄',
- `level` varchar(255) DEFAULT NULL COMMENT '客户等级 A B C',
- `state` varchar(255) DEFAULT NULL COMMENT '客户状态:已到店,已交定,已签单',
- `community_name` varchar(255) DEFAULT NULL COMMENT '小区名',
- `house_type` varchar(255) DEFAULT NULL COMMENT '房屋类型 如 毛坯 精装 老房等',
- `house_delivery_time` varchar(255) DEFAULT NULL COMMENT '交房时间',
- `plan_deco_time` varchar(255) DEFAULT NULL COMMENT '预计装修时间',
- `square` varchar(255) DEFAULT NULL COMMENT '房屋大小',
- `deco_style` varchar(255) DEFAULT NULL COMMENT '装修风格',
- `budget` varchar(255) DEFAULT NULL COMMENT '预算',
- `revisit_time` timestamp NULL DEFAULT NULL COMMENT '客户跟进,下次业务员回访时间(业务员填写)',
- `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
- `updatetime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
- `protected_to` timestamp NULL DEFAULT NULL COMMENT '保护至xx日',
- `org_id` int(11) NOT NULL COMMENT '部门',
- `crm_res_id` int(11) DEFAULT NULL COMMENT 'crm_import_log id',
- `is_resource` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否属于资源库',
- `before_pool` varchar(255) DEFAULT NULL COMMENT '入公海前操作信息',
- `bad_phone` tinyint(4) NOT NULL DEFAULT '0' COMMENT '电话无效 1为无效',
- `fresh` tinyint(4) NOT NULL DEFAULT '1' COMMENT '新客户',
- `sex` tinyblob NOT NULL COMMENT '性别',
- `first_visit_date` date DEFAULT NULL COMMENT '首次到访时间',
- `last_contact_date` date DEFAULT NULL COMMENT '上次沟通时间',
- `product` varchar(50) DEFAULT NULL COMMENT '关注点',
- `source_id` int(11) DEFAULT NULL COMMENT '来源',
- `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
- `ext` json DEFAULT NULL COMMENT '扩展字段',
- `deposit_money` int(11) DEFAULT NULL COMMENT '收定金额',
- `signed_money` INT(11) DEFAULT NULL COMMENT '签单金额',
- `deletetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '删除时间'
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='客户回收表' ROW_FORMAT=DYNAMIC;");
- Db::execute("ALTER TABLE `fl_customer_recycle` ADD PRIMARY KEY (`id`) USING BTREE;");
- Db::execute("ALTER TABLE `fl_customer_recycle` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;");
- Db::execute("INSERT INTO `fl_permission` (`id`, `pid`, `auth_name`, `uri`, `is_menu`, `icon`, `sort`, `relation`) VALUES (NULL, '7', '回收站', 'crm/recycle', '1', NULL, '50', 'crm/recycle,crm/undelete');");
- Db::execute("UPDATE `fl_permission` SET `relation` = 'crm/withdrawl,crm/addpool,crm/distribute,crm/distributing,crm/delete' WHERE `fl_permission`.`id` = 10;");
- }
- }
|