SET FOREIGN_KEY_CHECKS=0;

CREATE TABLE `eod_file`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键Id',
  `ValueDate` datetime NOT NULL COMMENT '收盘日期',
  `FileName` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '文件名称',
  `FileType` int NOT NULL COMMENT '文件类型 1 日终资金流水 2 估值文件\r\n            ',
  `FilePath` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件路径',
  `FailMsg` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '失败原因',
  `Status` int NOT NULL COMMENT '状态: 0 未生成  1 生成中 2 已生成',
  `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 `index_valuedate`(`ValueDate` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '收盘后文件生成记录表' ROW_FORMAT = Dynamic;

ALTER TABLE `exchange_list_option` ADD COLUMN `UpdateFlag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '交易接口更新标识(0:不更新)(第1位用于到期日是否更新)' AFTER `StockCode`;

ALTER TABLE `margin_template_detail` MODIFY COLUMN `StockEqvNotional` double(18, 6) NULL DEFAULT NULL COMMENT '总持仓名义本金' AFTER `UsePositionStockEqvNotional`;

ALTER TABLE `margin_template_detail` MODIFY COLUMN `SingleStockEqvNotional` double(18, 6) NULL DEFAULT NULL COMMENT '单一标的持仓名义本金' AFTER `StockEqvNotional`;

CREATE TABLE `quotamonitor_assetunit`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `ValueDate` date NOT NULL COMMENT '数据日期',
  `AssetBookID` int NOT NULL COMMENT '簿记的Id',
  `AssetBookName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '簿记名称',
  `StockEqvNotional` double NULL DEFAULT NULL COMMENT '名义本金',
  `Quota_StockEqvNotional_Upper` double NULL DEFAULT NULL COMMENT '名义本金限额',
  `Quota_StockEqvNotional_Lower` double NULL DEFAULT NULL COMMENT '名义本金限额',
  `Quota_StockEqvNotional_wUpper` double NULL DEFAULT NULL COMMENT '名义本金限额',
  `Quota_StockEqvNotional_wLower` double NULL DEFAULT NULL COMMENT '名义本金限额',
  `DeltaExposure` double NULL DEFAULT NULL COMMENT 'Delta敞口',
  `Quota_DeltaExposure_Upper` double NULL DEFAULT NULL COMMENT 'Delta敞口限额',
  `Quota_DeltaExposure_Lower` double NULL DEFAULT NULL COMMENT 'Delta敞口限额',
  `Quota_DeltaExposure_wUpper` double NULL DEFAULT NULL COMMENT 'Delta敞口限额',
  `Quota_DeltaExposure_wLower` double NULL DEFAULT NULL COMMENT 'Delta敞口限额',
  `DeltaNetExposure` double NULL DEFAULT NULL COMMENT 'Delta净敞口',
  `Quota_DeltaNetExposure_Upper` double NULL DEFAULT NULL COMMENT 'Delta净敞口限额',
  `Quota_DeltaNetExposure_Lower` double NULL DEFAULT NULL COMMENT 'Delta净敞口限额',
  `Quota_DeltaNetExposure_wUpper` double NULL DEFAULT NULL COMMENT 'Delta净敞口限额',
  `Quota_DeltaNetExposure_wLower` double NULL DEFAULT NULL COMMENT 'Delta净敞口限额',
  `DeltaCash` double NULL DEFAULT NULL COMMENT 'Delta金额',
  `Quota_DeltaCash_Upper` double NULL DEFAULT NULL COMMENT 'Delta金额限额',
  `Quota_DeltaCash_Lower` double NULL DEFAULT NULL COMMENT 'Delta金额限额',
  `Quota_DeltaCash_wUpper` double NULL DEFAULT NULL COMMENT 'Delta金额限额',
  `Quota_DeltaCash_wLower` double NULL DEFAULT NULL COMMENT 'Delta金额限额',
  `GammaCash` double NULL DEFAULT NULL COMMENT 'Gamma金额',
  `Quota_GammaCash_Upper` double NULL DEFAULT NULL COMMENT 'Gamma金额限额',
  `Quota_GammaCash_Lower` double NULL DEFAULT NULL COMMENT 'Gamma金额限额',
  `Quota_GammaCash_wUpper` double NULL DEFAULT NULL COMMENT 'Gamma金额限额',
  `Quota_GammaCash_wLower` double NULL DEFAULT NULL COMMENT 'Gamma金额限额',
  `Vega` double NULL DEFAULT NULL COMMENT 'Vaga',
  `Quota_Vega_Upper` double NULL DEFAULT NULL COMMENT 'Vaga限额',
  `Quota_Vega_Lower` double NULL DEFAULT NULL COMMENT 'Vaga限额',
  `Quota_Vega_wUpper` double NULL DEFAULT NULL COMMENT 'Vaga限额',
  `Quota_Vega_wLower` double NULL DEFAULT NULL COMMENT 'Vaga限额',
  `VegaCash` double NULL DEFAULT NULL COMMENT 'Vaga金额',
  `Quota_VegaCash_Upper` double NULL DEFAULT NULL COMMENT 'Vaga金额限额',
  `Quota_VegaCash_Lower` double NULL DEFAULT NULL COMMENT 'Vaga金额限额',
  `Quota_VegaCash_wUpper` double NULL DEFAULT NULL COMMENT 'Vaga金额限额',
  `Quota_VegaCash_wLower` double NULL DEFAULT NULL COMMENT 'Vaga金额限额',
  `Concentration` double NULL DEFAULT NULL COMMENT '集中度',
  `Quota_Concentration_Upper` double NULL DEFAULT NULL COMMENT '集中度限额',
  `Quota_Concentration_Lower` double NULL DEFAULT NULL COMMENT '集中度限额',
  `Quota_Concentration_wUpper` double NULL DEFAULT NULL COMMENT '集中度限额',
  `Quota_Concentration_wLower` double NULL DEFAULT NULL COMMENT '集中度限额',
  `PositionPnl` double NULL DEFAULT NULL COMMENT '浮动盈亏',
  `Quota_PositionPnl_Upper` double NULL DEFAULT NULL COMMENT '浮动盈亏限额',
  `Quota_PositionPnl_Lower` double NULL DEFAULT NULL COMMENT '浮动盈亏限额',
  `Quota_PositionPnl_wUpper` double NULL DEFAULT NULL COMMENT '浮动盈亏限额',
  `Quota_PositionPnl_wLower` double NULL DEFAULT NULL COMMENT '浮动盈亏限额',
  `Theta` double NULL DEFAULT NULL COMMENT 'Theta',
  `Quota_Theta_Upper` double NULL DEFAULT NULL COMMENT 'Theta限额',
  `Quota_Theta_Lower` double NULL DEFAULT NULL COMMENT 'Theta限额',
  `Quota_Theta_wUpper` double NULL DEFAULT NULL COMMENT 'Theta限额',
  `Quota_Theta_wLower` double NULL DEFAULT NULL COMMENT 'Theta限额',
  `TotalPnL` double NULL DEFAULT NULL COMMENT '本年累计盈亏',
  `Quota_TotalPnL_Upper` double NULL DEFAULT NULL COMMENT '本年累计盈亏限额',
  `Quota_TotalPnL_Lower` double NULL DEFAULT NULL COMMENT '本年累计盈亏限额',
  `Quota_TotalPnL_wUpper` double NULL DEFAULT NULL COMMENT '本年累计盈亏限额',
  `Quota_TotalPnL_wLower` double NULL DEFAULT NULL COMMENT '本年累计盈亏限额',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;

ALTER TABLE `quotamonitor_global` ADD COLUMN `ThisYearTotalPnl` double NULL DEFAULT NULL COMMENT '本年累计盈亏' AFTER `Quota_Theta_wLower`;

ALTER TABLE `quotamonitor_global` ADD COLUMN `Quota_ThisYearTotalPnl_Upper` double NULL DEFAULT NULL COMMENT '本年累计盈亏限额' AFTER `ThisYearTotalPnl`;

ALTER TABLE `quotamonitor_global` ADD COLUMN `Quota_ThisYearTotalPnl_Lower` double NULL DEFAULT NULL COMMENT '本年累计盈亏限额' AFTER `Quota_ThisYearTotalPnl_Upper`;

ALTER TABLE `quotamonitor_global` ADD COLUMN `Quota_ThisYearTotalPnl_wUpper` double NULL DEFAULT NULL COMMENT '本年累计盈亏限额' AFTER `Quota_ThisYearTotalPnl_Lower`;

ALTER TABLE `quotamonitor_global` ADD COLUMN `Quota_ThisYearTotalPnl_wLower` double NULL DEFAULT NULL COMMENT '本年累计盈亏限额' AFTER `Quota_ThisYearTotalPnl_wUpper`;

ALTER TABLE `quotamonitor_underlying` ADD COLUMN `Theta` double NULL DEFAULT NULL COMMENT 'Theta' AFTER `Quota_PositionPnl_wLower`;

ALTER TABLE `quotamonitor_underlying` ADD COLUMN `Quota_Theta_Upper` double NULL DEFAULT NULL COMMENT 'Theta限额' AFTER `Theta`;

ALTER TABLE `quotamonitor_underlying` ADD COLUMN `Quota_Theta_Lower` double NULL DEFAULT NULL COMMENT 'Theta限额' AFTER `Quota_Theta_Upper`;

ALTER TABLE `quotamonitor_underlying` ADD COLUMN `Quota_Theta_wUpper` double NULL DEFAULT NULL COMMENT 'Theta限额' AFTER `Quota_Theta_Lower`;

ALTER TABLE `quotamonitor_underlying` ADD COLUMN `Quota_Theta_wLower` double NULL DEFAULT NULL COMMENT 'Theta限额' AFTER `Quota_Theta_wUpper`;

ALTER TABLE `quotamonitor_underlying` ADD COLUMN `TotalPnL` double NULL DEFAULT NULL COMMENT '本年累计盈亏' AFTER `Quota_Theta_wLower`;

ALTER TABLE `quotamonitor_underlying` ADD COLUMN `Quota_TotalPnL_Upper` double NULL DEFAULT NULL COMMENT '本年累计盈亏限额' AFTER `TotalPnL`;

ALTER TABLE `quotamonitor_underlying` ADD COLUMN `Quota_TotalPnL_Lower` double NULL DEFAULT NULL COMMENT '本年累计盈亏限额' AFTER `Quota_TotalPnL_Upper`;

ALTER TABLE `quotamonitor_underlying` ADD COLUMN `Quota_TotalPnL_wUpper` double NULL DEFAULT NULL COMMENT '本年累计盈亏限额' AFTER `Quota_TotalPnL_Lower`;

ALTER TABLE `quotamonitor_underlying` ADD COLUMN `Quota_TotalPnL_wLower` double NULL DEFAULT NULL COMMENT '本年累计盈亏限额' AFTER `Quota_TotalPnL_wUpper`;

ALTER TABLE `supervise_report_clientcash` MODIFY COLUMN `MarginType` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '追保模式' AFTER `EndBalance`;

ALTER TABLE `supervise_report_clientcash` MODIFY COLUMN `MarginPayTime` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '追保到账时间' AFTER `MarginType`;

ALTER TABLE `supervise_report_clientcash` MODIFY COLUMN `Remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注' AFTER `MarketValueEquity`;

ALTER TABLE `supervise_report_creditrisk` MODIFY COLUMN `BuyClientCount` int NOT NULL COMMENT '我方买入期权的交易对手数' AFTER `TotalCredit`;

ALTER TABLE `trade_swap` MODIFY COLUMN `GetSingleFee` double(18, 8) NULL DEFAULT NULL COMMENT '[收取]按手数收费' AFTER `GetFixedProfit`;

ALTER TABLE `trade_swap` MODIFY COLUMN `PaySingleFee` double(18, 8) NULL DEFAULT NULL COMMENT '[支付]按手数收费' AFTER `PayFixedProfit`;

ALTER TABLE `valuedate_history` MODIFY COLUMN `Data` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '数据' AFTER `OptName`;

SET FOREIGN_KEY_CHECKS=1;