-- 临时禁用安全模式
SET SQL_SAFE_UPDATES = 0;

CREATE TABLE IF NOT EXISTS crypto_market_data (
    id BIGINT AUTO_INCREMENT PRIMARY KEY,
    symbol VARCHAR(50) NOT NULL,
    bar VARCHAR(20) NOT NULL,
    timestamp BIGINT NOT NULL,
    date_time VARCHAR(50) NOT NULL,
    open DECIMAL(20,5) NOT NULL,
    high DECIMAL(20,5) NOT NULL,
    low DECIMAL(20,5) NOT NULL,
    close DECIMAL(20,5) NOT NULL,
    volume DECIMAL(30,8) NOT NULL,
    volCcy DECIMAL(30,8) NOT NULL,
    volCCyQuote DECIMAL(30,8) NOT NULL,
    buy_sz DECIMAL(20, 6) NOT NULL,
    sell_sz DECIMAL(20, 6) NOT NULL,
    create_time VARCHAR(50) NOT NULL,
    UNIQUE KEY uniq_symbol_bar_timestamp (symbol, bar, timestamp)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
