SET FOREIGN_KEY_CHECKS=0;

ALTER TABLE  `client` ADD COLUMN `LicenseValidTimeStr` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '营业执照有效期' AFTER `MinimumTransferAmount`;

ALTER TABLE  `client` ADD COLUMN `Department` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所属部门' AFTER `LicenseValidTimeStr`;

ALTER TABLE  `client` ADD COLUMN `ServiceType` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '业务种类' AFTER `Department`;

ALTER TABLE  `client_auditlog` MODIFY COLUMN `ClientId` int NOT NULL DEFAULT 0 COMMENT '客户ID' AFTER `id`;

ALTER TABLE  `client_meta` DROP INDEX `ix_clientmeta`;

ALTER TABLE  `client_meta` ADD UNIQUE INDEX `ix_clientmeta`(`ClientId` ASC, `MetaKey` ASC) USING BTREE;

ALTER TABLE  `clientduty` ADD COLUMN `IdCardStartDateStr` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '证件起始日' AFTER `Weixin`;

ALTER TABLE  `clientduty` ADD COLUMN `IdCardEffectiveDateStr` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '证件有效期' AFTER `IdCardStartDateStr`;

ALTER TABLE  `clientduty` ADD COLUMN `ManagementIdentity` int NULL DEFAULT NULL COMMENT '管理层身份' AFTER `IdCardEffectiveDateStr`;

ALTER TABLE  `clientduty` ADD COLUMN `ShareholdingByShareholdersType` int NULL DEFAULT NULL COMMENT '股东持股类型' AFTER `ManagementIdentity`;

ALTER TABLE  `clientduty` ADD COLUMN `ShareholdingByShareholdersRatio` decimal(18, 6) NULL DEFAULT NULL COMMENT '股东持股比例' AFTER `ShareholdingByShareholdersType`;

ALTER TABLE  `clientduty` ADD COLUMN `IdentityOfTheBoardOfDirectors` int NULL DEFAULT NULL COMMENT '董事会身份' AFTER `ShareholdingByShareholdersRatio`;

ALTER TABLE  `clientduty` ADD COLUMN `IsShareholder` bit(1) NULL DEFAULT NULL COMMENT '是否股东' AFTER `IdentityOfTheBoardOfDirectors`;

CREATE TABLE  `sys_tag`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键Id',
  `TagType` int NOT NULL COMMENT '标签类型:0 交易,其它：后续待定',
  `Name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标签名称',
  `Remark` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `OptId` int NULL DEFAULT NULL COMMENT '操作人',
  `OptName` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作人名称',
  `OptDate` datetime NULL DEFAULT NULL COMMENT '操作时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `querybytype`(`TagType` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统标签表' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS=1;