SET FOREIGN_KEY_CHECKS=0;

ALTER TABLE `bankcard` ADD COLUMN `ApprovalOrder` int NOT NULL DEFAULT 0 COMMENT '审批状态:枚举类型' AFTER `PreValidState`;

ALTER TABLE `bankcard` ADD COLUMN `SourceId` int NULL DEFAULT NULL COMMENT '来源id主要用于编辑审批' AFTER `ApprovalOrder`;

ALTER TABLE `client` DROP INDEX `client_Name_Index`;

ALTER TABLE `client` ADD COLUMN `ApprovalStatus` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '审批状态' AFTER `ProcessOrderId`;

ALTER TABLE `client` ADD COLUMN `ApprovalOptDate` datetime NULL DEFAULT NULL COMMENT '审批时间' AFTER `ApprovalStatus`;

ALTER TABLE `client` ADD COLUMN `ApprovalOrderId` int NULL DEFAULT 0 COMMENT '流程进度，审批中 >0 、已拒绝 -1、审批通过-2 、无 0' AFTER `ApprovalOptDate`;

ALTER TABLE `client` ADD COLUMN `ApprovalLogId` int NULL DEFAULT 0 COMMENT '审批提交批logid' AFTER `ApprovalOrderId`;

ALTER TABLE `client` ADD COLUMN `IsParentCompanyCreditOn` tinyint(1) NULL DEFAULT NULL COMMENT '是否允许使用母公司授信' AFTER `IsCreditOn`;

ALTER TABLE `client` ADD COLUMN `ProcessOrderBranch` int NULL DEFAULT 0 COMMENT '审批分支' AFTER `ServiceType`;

ALTER TABLE `client` ADD COLUMN `MarginRules` int NULL DEFAULT 0 COMMENT '预付金规则：0 Span算法  1 Delta算法' AFTER `ProcessOrderBranch`;

ALTER TABLE `client` MODIFY COLUMN `ProcessStatus` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '未提交' COMMENT '客户状态' AFTER `LicenseCode`;

ALTER TABLE `client` MODIFY COLUMN `ProcessOptDate` datetime NULL DEFAULT NULL COMMENT '客户状态修改时间' AFTER `ProcessStatus`;

ALTER TABLE `client` MODIFY COLUMN `ProcessOrderId` int NULL DEFAULT 0 COMMENT '流程进度，未提交 0；未开户 -1；已开户 -2；已销户 -3；已休眠 -4；' AFTER `ProcessOptDate`;

ALTER TABLE `client_black` MODIFY COLUMN `Remarks` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '备注' AFTER `Name`;

ALTER TABLE `client_file` ADD COLUMN `ApprovalOrder` int NOT NULL DEFAULT 0 COMMENT '审批状态:枚举类型' AFTER `ParentClientFileId`;

ALTER TABLE `client_file` ADD COLUMN `SourceId` int NULL DEFAULT NULL COMMENT '来源id主要用于编辑审批' AFTER `ApprovalOrder`;

ALTER TABLE `clientduty` ADD COLUMN `ApprovalOrder` int NOT NULL DEFAULT 0 COMMENT '审批状态:枚举类型' AFTER `Remarks`;

ALTER TABLE `clientduty` ADD COLUMN `SourceId` int NULL DEFAULT NULL COMMENT '来源id主要用于编辑审批' AFTER `ApprovalOrder`;

DROP TABLE IF EXISTS `trs_group`;

SET FOREIGN_KEY_CHECKS=1;