USE hyapp_activity;

SET @ddl := IF(
  (SELECT COUNT(*) FROM information_schema.COLUMNS
   WHERE TABLE_SCHEMA = DATABASE()
     AND TABLE_NAME = 'invite_activity_reward_configs'
     AND COLUMN_NAME = 'per_invite_inviter_reward_coin_amount') = 0,
  'ALTER TABLE invite_activity_reward_configs ADD COLUMN per_invite_inviter_reward_coin_amount BIGINT NOT NULL DEFAULT 0 COMMENT ''每邀请一人邀请人即时奖励金币'' AFTER enabled',
  'SELECT 1'
);
PREPARE stmt FROM @ddl;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

SET @ddl := IF(
  (SELECT COUNT(*) FROM information_schema.COLUMNS
   WHERE TABLE_SCHEMA = DATABASE()
     AND TABLE_NAME = 'invite_activity_reward_configs'
     AND COLUMN_NAME = 'per_invite_invitee_reward_coin_amount') = 0,
  'ALTER TABLE invite_activity_reward_configs ADD COLUMN per_invite_invitee_reward_coin_amount BIGINT NOT NULL DEFAULT 0 COMMENT ''每邀请一人被邀请人即时奖励金币'' AFTER per_invite_inviter_reward_coin_amount',
  'SELECT 1'
);
PREPARE stmt FROM @ddl;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
