CREATE TABLE IF NOT EXISTS `calendar` (
    trade_date DATE PRIMARY KEY COMMENT '交易日期',
    exchange VARCHAR(10) COMMENT '交易所代码',
    is_open TINYINT COMMENT '是否交易（0：休市 1：交易）',
    pretrade_date DATE COMMENT '上一个交易日',

    create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',

    INDEX idx_exchange (exchange),
    INDEX idx_is_open (is_open)
) ENGINE=InnoDB COMMENT '交易日历表';