SET @ccdi_account_info_is_self_account_sql = IF(
    EXISTS(
        SELECT 1
        FROM information_schema.columns
        WHERE table_schema = DATABASE()
          AND table_name = 'ccdi_account_info'
          AND column_name = 'is_self_account'
    ),
    'SELECT 1',
    'ALTER TABLE `ccdi_account_info` ADD COLUMN `is_self_account` TINYINT NOT NULL DEFAULT 1 COMMENT ''是否本人账户'' AFTER `currency`'
);

PREPARE ccdi_account_info_is_self_account_stmt FROM @ccdi_account_info_is_self_account_sql;
EXECUTE ccdi_account_info_is_self_account_stmt;
DEALLOCATE PREPARE ccdi_account_info_is_self_account_stmt;

SET @ccdi_account_info_trans_risk_level_sql = IF(
    EXISTS(
        SELECT 1
        FROM information_schema.columns
        WHERE table_schema = DATABASE()
          AND table_name = 'ccdi_account_info'
          AND column_name = 'trans_risk_level'
    ),
    'SELECT 1',
    'ALTER TABLE `ccdi_account_info` ADD COLUMN `trans_risk_level` VARCHAR(32) DEFAULT NULL COMMENT ''交易风险等级'' AFTER `is_self_account`'
);

PREPARE ccdi_account_info_trans_risk_level_stmt FROM @ccdi_account_info_trans_risk_level_sql;
EXECUTE ccdi_account_info_trans_risk_level_stmt;
DEALLOCATE PREPARE ccdi_account_info_trans_risk_level_stmt;
