CREATE TABLE IF NOT EXISTS `bb_medal` (
  `medal_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `cat_id` mediumint(8) unsigned NOT NULL DEFAULT '1',
  `medal_name` varchar(40) NOT NULL,
  `medal_description` varchar(255) NOT NULL,
  `medal_image` varchar(40) DEFAULT NULL,
  PRIMARY KEY (`medal_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `bb_medal_cat` (
  `cat_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `cat_title` varchar(100) NOT NULL,
  `cat_order` mediumint(8) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cat_id`),
  KEY `cat_order` (`cat_order`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `bb_medal_mod` (
  `mod_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `medal_id` mediumint(8) unsigned NOT NULL,
  `user_id` mediumint(8) unsigned NOT NULL,
  PRIMARY KEY (`mod_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `bb_medal_user` (
  `issue_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `medal_id` mediumint(8) unsigned NOT NULL,
  `user_id` mediumint(8) unsigned NOT NULL,
  `issue_reason` varchar(255) NOT NULL,
  `issue_time` int(11) NOT NULL,
  PRIMARY KEY (`issue_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `bb_config` VALUES('dis_medal_display', '1');
INSERT INTO `bb_config` VALUES('medal_display_row', '1');
INSERT INTO `bb_config` VALUES('medal_display_col', '3');
INSERT INTO `bb_config` VALUES('medal_display_width', '');
INSERT INTO `bb_config` VALUES('medal_display_height', '');
INSERT INTO `bb_config` VALUES('medal_display_order', '0');