-- --------------------------------------------------------
-- Server OS:                    debian-linux-gnu
-- HeidiSQL Version:             12.10.0.7000
-- --------------------------------------------------------



-- Dumping database structure for global
CREATE DATABASE IF NOT EXISTS `global` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci */;
USE `global`;

-- Dumping structure for table global.chat
CREATE TABLE IF NOT EXISTS `chat` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` bigint(11) NOT NULL AUTO_INCREMENT,
  `chan` tinyint(3) unsigned DEFAULT NULL,
  `name` varchar(50) DEFAULT NULL,
  `game` varchar(3) DEFAULT NULL,
  `server` tinyint(3) unsigned DEFAULT 0,
  `post` varchar(150) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `server` (`server`),
  KEY `chan` (`chan`),
  KEY `game` (`game`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.chat: ~0 rows (approximately)

-- Dumping structure for table global.chat2
CREATE TABLE IF NOT EXISTS `chat2` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` bigint(11) NOT NULL AUTO_INCREMENT,
  `chan` tinyint(3) unsigned DEFAULT NULL,
  `name` varchar(50) DEFAULT NULL,
  `game` varchar(3) DEFAULT NULL,
  `server` tinyint(3) unsigned DEFAULT 0,
  `post` varchar(150) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `server` (`server`),
  KEY `chan` (`chan`),
  KEY `game` (`game`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.chat2: ~0 rows (approximately)

-- Dumping structure for table global.col
CREATE TABLE IF NOT EXISTS `col` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` bigint(11) NOT NULL AUTO_INCREMENT,
  `userid` int(11) DEFAULT NULL,
  `goodid` int(11) DEFAULT 1,
  `datetime` datetime DEFAULT NULL,
  `class` tinyint(3) unsigned DEFAULT 0,
  `pop` int(11) DEFAULT 1,
  `loyalty` smallint(6) DEFAULT 50,
  `land` int(11) DEFAULT 0,
  `ore` int(11) DEFAULT 0,
  `food` int(11) DEFAULT 0,
  `good` int(11) DEFAULT 0,
  `housing` int(11) DEFAULT 1,
  `commercial` int(11) DEFAULT 0,
  `industry` int(11) DEFAULT 0,
  `agriculture` int(11) DEFAULT 0,
  `mining` int(11) DEFAULT 0,
  `type` tinyint(3) unsigned DEFAULT 8,
  `planet` smallint(3) unsigned DEFAULT 1,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `userid` (`userid`),
  KEY `class` (`class`),
  KEY `type` (`type`)
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.col: ~20 rows (approximately)
INSERT INTO `col` (`match_id`, `id`, `userid`, `goodid`, `datetime`, `class`, `pop`, `loyalty`, `land`, `ore`, `food`, `good`, `housing`, `commercial`, `industry`, `agriculture`, `mining`, `type`, `planet`) VALUES
	(14, 3, 1, 1, '2025-09-10 15:45:34', 1, 1000000, 100, 100000, 10000, 10000, 5000, 10, 5, 5, 5, 5, 8, 1),
	(0, 40, 100, 6, '2025-09-10 22:00:23', 3, 100, 1095, 1500, 1300, 0, 0, 10, 30, 0, 50, 5, 50, 1),
	(0, 41, 100, 5, '2025-09-10 22:05:26', 3, 130, 2470, 1500, 1500, 0, 0, 30, 0, 0, 100, 10, 40, 1),
	(0, 42, 100, 5, '2025-09-10 22:11:42', 3, 130, 2305, 1500, 1500, 0, 0, 30, 0, 0, 100, 10, 40, 1),
	(0, 43, 100, 5, '2025-09-10 22:12:57', 3, 130, 1765, 1500, 1500, 0, 0, 30, 0, 0, 100, 10, 40, 1),
	(0, 44, 100, 5, '2025-09-10 22:12:59', 3, 130, 1770, 1500, 1500, 0, 0, 30, 0, 0, 100, 10, 40, 1),
	(0, 45, 100, 5, '2025-09-10 22:15:02', 3, 130, 605, 1500, 1500, 0, 0, 30, 0, 0, 100, 10, 40, 1),
	(0, 46, 100, 5, '2025-09-10 22:15:07', 3, 130, 685, 1500, 1500, 0, 0, 30, 0, 0, 100, 10, 40, 1),
	(0, 47, 100, 5, '2025-09-10 22:15:25', 3, 130, 1800, 1500, 1500, 0, 0, 30, 0, 0, 100, 10, 40, 1),
	(0, 48, 100, 5, '2025-09-10 22:15:27', 3, 130, 1920, 1500, 1500, 0, 0, 30, 0, 0, 100, 10, 40, 1),
	(0, 49, 100, 2, '2025-09-10 22:15:37', 3, 500, 2500, 1500, 1200, 0, 0, 50, 0, 0, 0, 5, 8, 1),
	(0, 50, 100, 2, '2025-09-10 22:55:33', 3, 500, 2500, 1500, 1200, 0, 0, 50, 0, 0, 0, 5, 8, 1),
	(0, 51, 100, 2, '2025-09-10 22:56:46', 3, 500, 2500, 1500, 1200, 0, 0, 50, 0, 0, 0, 5, 8, 1),
	(0, 52, 100, 2, '2025-09-10 22:58:33', 3, 500, 2500, 1500, 1200, 0, 0, 50, 0, 0, 0, 5, 8, 1),
	(5, 55, 1004, 1, '2025-09-11 13:26:10', 1, 1000000, 100, 100000, 10000, 10000, 5000, 10, 5, 5, 5, 5, 8, 1),
	(0, 57, 1005, 4, '2025-09-11 14:06:10', 1, 200, 1645, 1000, 1000, 0, 0, 20, 0, 100, 50, 15, 4, 1),
	(0, 58, 1005, 6, '2025-09-11 14:28:18', 3, 100, 1105, 1500, 1300, 0, 0, 10, 30, 0, 50, 5, 50, 1),
	(0, 59, 1005, 6, '2025-09-11 16:23:43', 3, 100, 1370, 1500, 1300, 0, 0, 10, 30, 0, 50, 5, 50, 1),
	(8, 62, 1017, 1, '2025-09-11 17:44:56', 1, 85, 90, 100000, 9975, 10000, 5000, 10, 5, 5, 5, 5, 8, 1),
	(0, 63, 1016, 6, '2025-09-11 17:55:43', 3, 100, 1405, 1500, 1300, 0, 0, 10, 30, 0, 50, 5, 50, 1),
	(0, 64, 1017, 6, '2025-09-11 17:56:35', 1, 200, 1265, 1000, 1000, 0, 0, 20, 0, 100, 50, 15, 4, 1),
	(0, 65, 1016, 2, '2025-09-11 17:57:40', 3, 500, 2500, 1500, 1200, 0, 0, 50, 0, 0, 0, 5, 8, 1);

-- Dumping structure for table global.event
CREATE TABLE IF NOT EXISTS `event` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `userid` int(11) DEFAULT NULL,
  `type` tinyint(3) unsigned DEFAULT 0,
  `datetime` datetime DEFAULT NULL,
  `name` longtext DEFAULT NULL,
  `server` tinyint(3) unsigned DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `userid` (`userid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.event: ~10 rows (approximately)
INSERT INTO `event` (`match_id`, `id`, `userid`, `type`, `datetime`, `name`, `server`) VALUES
	(0, 1, 1005, 0, '2025-09-11 15:23:41', '<b>Researcher: </b>We have completed researching Commercial !', 0),
	(0, 2, 1005, 0, '2025-09-11 15:23:42', '<b>Researcher: </b>We have completed researching Commercial !', 0),
	(0, 3, 1005, 0, '2025-09-11 15:23:43', '<b>Researcher: </b>We have completed researching Commercial !', 0),
	(0, 4, 1005, 0, '2025-09-11 15:23:44', '<b>Researcher: </b>We have completed researching Commercial !', 0),
	(0, 5, 1005, 0, '2025-09-11 16:27:51', '<b>Researcher: </b>We have completed researching Commercial !', 0),
	(0, 6, 1005, 0, '2025-09-11 16:27:53', '<b>Researcher: </b>We have completed researching Commercial !', 0),
	(0, 7, 1005, 0, '2025-09-11 16:27:53', '<b>Researcher: </b>We have completed researching Commercial !', 0),
	(0, 8, 1005, 0, '2025-09-11 16:31:21', '<b>Researcher: </b>We have completed researching Commercial !', 0),
	(0, 9, 1005, 0, '2025-09-11 17:08:12', '<b>Researcher: </b>We have completed researching Commercial !', 0),
	(0, 10, 1005, 0, '2025-09-11 17:08:13', '<b>Researcher: </b>We have completed researching Commercial !', 0),
	(0, 11, 1016, 0, '2025-09-11 17:55:57', '<b>Researcher: </b>We have completed researching Commercial !', 0),
	(0, 12, 1016, 0, '2025-09-11 17:55:58', '<b>Researcher: </b>We have completed researching Commercial !', 0),
	(0, 13, 1017, 0, '2025-09-11 17:56:44', '<b>Researcher: </b>We have completed researching Commercial !', 0),
	(0, 14, 1017, 0, '2025-09-11 17:56:45', '<b>Researcher: </b>We have completed researching Commercial !', 0),
	(0, 15, 1016, 0, '2025-09-11 18:00:15', '<b>Researcher: </b>We have completed researching Commercial !', 0);

-- Dumping structure for table global.eventp
CREATE TABLE IF NOT EXISTS `eventp` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `server` tinyint(3) unsigned DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `name` longtext DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `server` (`server`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.eventp: ~0 rows (approximately)

-- Dumping structure for table global.event_attack
CREATE TABLE IF NOT EXISTS `event_attack` (
  `match_id` bigint(20) unsigned NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `datetime` datetime DEFAULT NULL,
  `datetime2` datetime DEFAULT NULL,
  `CTime` int(11) DEFAULT NULL,
  `source` int(11) DEFAULT NULL,
  `sourcepower` int(11) DEFAULT NULL,
  `target` int(11) DEFAULT NULL,
  `targetpower` bigint(12) DEFAULT NULL,
  `winflag` tinyint(3) unsigned DEFAULT NULL,
  `attackflag` tinyint(3) unsigned DEFAULT NULL,
  `winplanet` smallint(6) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`),
  KEY `idx_match_id` (`match_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.event_attack: ~0 rows (approximately)

-- Dumping structure for table global.fed
CREATE TABLE IF NOT EXISTS `fed` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fedtag` tinyint(1) DEFAULT 0,
  `shortdetail` varchar(50) DEFAULT NULL,
  `detail` longtext DEFAULT NULL,
  `detail2` longtext DEFAULT '<u>Objective</u><br><br><br><u>Rules</u><br><br><br>',
  `webpage` longtext DEFAULT NULL,
  `leader` int(11) DEFAULT NULL,
  `leader2` int(11) DEFAULT NULL,
  `leader3` int(11) DEFAULT NULL,
  `server` tinyint(3) unsigned DEFAULT NULL,
  `hit` smallint(6) DEFAULT 0,
  `war` int(11) DEFAULT NULL,
  `ally` int(11) DEFAULT NULL,
  `faction` tinyint(3) unsigned DEFAULT NULL,
  `name` varchar(50) DEFAULT NULL,
  UNIQUE KEY `id` (`id`) USING BTREE,
  KEY `fedtag` (`fedtag`) USING BTREE,
  KEY `war` (`war`) USING BTREE,
  KEY `leader` (`leader`,`leader2`,`leader3`) USING BTREE,
  KEY `server` (`server`) USING BTREE,
  KEY `ally` (`ally`) USING BTREE,
  KEY `faction` (`faction`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ROW_FORMAT=DYNAMIC;

-- Dumping data for table global.fed: ~2 rows (approximately)
INSERT INTO `fed` (`match_id`, `id`, `fedtag`, `shortdetail`, `detail`, `detail2`, `webpage`, `leader`, `leader2`, `leader3`, `server`, `hit`, `war`, `ally`, `faction`, `name`) VALUES
	(0, 1, 0, NULL, 'Federation for Team A', '<u>Objective</u><br><br><br><u>Rules</u><br><br><br>', NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, 'Team A'),
	(0, 2, 0, NULL, 'Federation for Team B', '<u>Objective</u><br><br><br><u>Rules</u><br><br><br>', NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, 'Team B'),
	(8, 5, 0, NULL, 'Matchmaking Team A', '<u>Objective</u><br><br><br><u>Rules</u><br><br><br>', NULL, 0, NULL, NULL, NULL, 0, NULL, NULL, NULL, 'Team Alpha'),
	(8, 6, 0, NULL, 'Matchmaking Team B', '<u>Objective</u><br><br><br><u>Rules</u><br><br><br>', NULL, 0, NULL, NULL, NULL, 0, NULL, NULL, NULL, 'Team Bravo');

-- Dumping structure for table global.fed_apply
CREATE TABLE IF NOT EXISTS `fed_apply` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fedid` int(11) DEFAULT NULL,
  `userid` int(11) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `fedid` (`fedid`),
  KEY `userid` (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.fed_apply: ~0 rows (approximately)

-- Dumping structure for table global.fed_forum
CREATE TABLE IF NOT EXISTS `fed_forum` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fedid` int(11) DEFAULT NULL,
  `userid` int(11) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `name` longtext DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `fedid` (`fedid`),
  KEY `userid` (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.fed_forum: ~0 rows (approximately)

-- Dumping structure for table global.fed_Log
CREATE TABLE IF NOT EXISTS `fed_Log` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fedid` int(11) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `log` text DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `fedid` (`fedid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.fed_Log: ~0 rows (approximately)

-- Dumping structure for table global.fed_planetcount
CREATE TABLE IF NOT EXISTS `fed_planetcount` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fedid` int(11) DEFAULT NULL,
  `planetcount` int(11) DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `fedid` (`fedid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.fed_planetcount: ~0 rows (approximately)

-- Dumping structure for table global.good
CREATE TABLE IF NOT EXISTS `good` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) DEFAULT NULL,
  `detail` longtext DEFAULT NULL,
  `dowhat` longtext DEFAULT NULL,
  `hard` tinyint(3) unsigned DEFAULT NULL,
  `type` tinyint(3) unsigned DEFAULT NULL,
  `g1` tinyint(3) unsigned DEFAULT 0,
  `g2` tinyint(3) unsigned DEFAULT 0,
  `g3` tinyint(3) unsigned DEFAULT 0,
  `g4` tinyint(3) unsigned DEFAULT 0,
  `g5` tinyint(3) unsigned DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `hard` (`hard`),
  KEY `type` (`type`),
  KEY `g1` (`g1`,`g2`,`g3`,`g4`,`g5`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.good: ~0 rows (approximately)

-- Dumping structure for table global.project_user
CREATE TABLE IF NOT EXISTS `project_user` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `userid` int(11) DEFAULT NULL,
  `project` tinyint(3) unsigned DEFAULT NULL,
  `activate` datetime DEFAULT NULL,
  `finishflag` tinyint(3) unsigned DEFAULT 0,
  `credit` bigint(20) DEFAULT NULL,
  `turn` bigint(20) DEFAULT NULL,
  `var1` bigint(3) NOT NULL DEFAULT 0,
  `PL1` smallint(2) DEFAULT NULL,
  `PL2` smallint(2) DEFAULT NULL,
  `PL3` smallint(2) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `userid` (`userid`),
  KEY `projectid` (`project`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.project_user: ~1 rows (approximately)
INSERT INTO `project_user` (`match_id`, `id`, `userid`, `project`, `activate`, `finishflag`, `credit`, `turn`, `var1`, `PL1`, `PL2`, `PL3`) VALUES
	(5, 8, 1005, 4, NULL, 1, 0, 0, 0, NULL, NULL, NULL),
	(8, 9, 1016, 4, NULL, 1, 0, 0, 0, NULL, NULL, NULL);

-- Dumping structure for table global.ship_user
CREATE TABLE IF NOT EXISTS `ship_user` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `userid` int(11) DEFAULT NULL,
  `type` smallint(6) DEFAULT NULL,
  `amount` double(255,0) DEFAULT NULL,
  `power` double(255,0) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `userid` (`userid`),
  KEY `shipid` (`type`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.ship_user: ~0 rows (approximately)

-- Dumping structure for table global.trade_good_user
CREATE TABLE IF NOT EXISTS `trade_good_user` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `server` tinyint(3) unsigned DEFAULT 0,
  `userid` int(11) DEFAULT NULL,
  `type` tinyint(3) unsigned DEFAULT NULL,
  `goodid` tinyint(3) unsigned DEFAULT NULL,
  `amount` bigint(20) DEFAULT NULL,
  `price` int(11) DEFAULT NULL,
  `expire` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `userid` (`userid`),
  KEY `goodid` (`goodid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping structure for table global.user_good
CREATE TABLE IF NOT EXISTS `user_good` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `r1` tinyint(3) DEFAULT NULL,
  `r2` tinyint(3) DEFAULT NULL,
  `r3` tinyint(3) DEFAULT NULL,
  `r4` tinyint(3) DEFAULT NULL,
  `r5` tinyint(3) DEFAULT NULL,
  `r6` tinyint(3) DEFAULT NULL,
  `g1` bigint(20) DEFAULT 0,
  `g2` bigint(20) DEFAULT 0,
  `g3` bigint(20) DEFAULT 0,
  `g4` bigint(20) DEFAULT 0,
  `g5` bigint(20) DEFAULT 0,
  `g6` bigint(20) DEFAULT 0,
  `g7` tinyint(3) unsigned DEFAULT 0,
  `g8` tinyint(3) unsigned DEFAULT 0,
  `g9` tinyint(3) unsigned DEFAULT 0,
  `g10` tinyint(3) unsigned DEFAULT 0,
  `g11` tinyint(3) unsigned DEFAULT 0,
  `g12` tinyint(3) unsigned DEFAULT 0,
  `g13` tinyint(3) unsigned DEFAULT 0,
  `g14` tinyint(3) unsigned DEFAULT 0,
  `g15` tinyint(3) unsigned DEFAULT 0,
  `g16` tinyint(3) unsigned DEFAULT 0,
  `g17` tinyint(3) unsigned DEFAULT 0,
  `g18` tinyint(3) unsigned DEFAULT 0,
  `g19` tinyint(3) unsigned DEFAULT 0,
  `g20` tinyint(3) unsigned DEFAULT 0,
  `g21` tinyint(3) unsigned DEFAULT 0,
  `g22` tinyint(3) unsigned DEFAULT 0,
  `g23` tinyint(3) unsigned DEFAULT 0,
  `g24` tinyint(3) unsigned DEFAULT 0,
  `g25` tinyint(3) unsigned DEFAULT 0,
  `g26` tinyint(3) unsigned DEFAULT 0,
  `g27` tinyint(3) unsigned DEFAULT 0,
  `g28` tinyint(3) unsigned DEFAULT 0,
  `g29` tinyint(3) unsigned DEFAULT 0,
  `g30` tinyint(3) unsigned DEFAULT 0,
  `g31` tinyint(3) unsigned DEFAULT 0,
  `g32` tinyint(3) unsigned DEFAULT 0,
  `g33` tinyint(3) unsigned DEFAULT 0,
  `g34` tinyint(3) unsigned DEFAULT 0,
  `g35` tinyint(3) unsigned DEFAULT 0,
  `g36` tinyint(3) unsigned DEFAULT 0,
  `g37` tinyint(3) unsigned DEFAULT 0,
  `g38` tinyint(3) unsigned DEFAULT 0,
  `g39` tinyint(3) unsigned DEFAULT 0,
  `g40` tinyint(3) unsigned DEFAULT 0,
  `g41` tinyint(3) unsigned DEFAULT 0,
  `g42` tinyint(3) unsigned DEFAULT 0,
  `g43` tinyint(3) unsigned DEFAULT 0,
  `g44` tinyint(3) unsigned DEFAULT 0,
  `g45` tinyint(3) unsigned DEFAULT 0,
  `g46` tinyint(3) unsigned DEFAULT 0,
  `g47` tinyint(3) unsigned DEFAULT 0,
  `g48` tinyint(3) unsigned DEFAULT 0,
  `g49` tinyint(3) unsigned DEFAULT 0,
  `g50` tinyint(3) unsigned DEFAULT 0,
  `g51` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g52` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g53` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g54` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g55` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g56` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g57` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g58` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g59` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g60` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g61` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g62` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g63` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g64` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g65` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g66` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g67` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g68` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g69` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g70` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g71` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g72` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g73` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g74` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g75` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g76` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g77` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g78` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g79` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g80` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g81` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g82` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g83` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g84` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g85` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g86` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g87` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g88` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g89` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g90` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g91` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g92` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g93` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g94` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g95` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g96` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g97` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g98` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g99` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g100` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g101` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g102` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g103` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g104` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g105` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g106` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g107` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g108` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g109` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g110` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g111` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g112` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g113` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g114` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g115` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g116` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g117` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g118` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g119` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g120` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g121` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g122` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g123` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g124` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g125` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g126` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g127` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g128` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g129` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g130` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g131` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g132` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g133` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g134` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g135` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g136` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g137` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g138` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g139` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g140` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g141` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g142` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g143` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g144` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g145` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g146` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g147` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g148` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g149` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g150` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g151` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g152` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g153` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g154` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g155` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g156` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g157` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g158` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g159` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g160` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g161` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g162` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g163` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g164` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g165` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g166` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g167` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g168` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g169` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g170` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g171` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g172` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g173` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g174` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g175` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g176` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g177` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g178` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g179` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g180` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g181` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g182` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g183` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g184` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g185` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g186` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g187` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g188` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g189` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g190` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g191` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g192` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g193` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g194` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g195` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g196` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g197` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g198` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g199` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `g200` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `server` tinyint(3) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1000000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.user_good: ~0 rows (approximately)

-- Dumping structure for table global.user_pm
CREATE TABLE IF NOT EXISTS `user_pm` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `datetime` datetime DEFAULT NULL,
  `userfrom` int(11) DEFAULT NULL,
  `userto` int(11) DEFAULT NULL,
  `name` varchar(20) DEFAULT NULL,
  `detail` longtext DEFAULT NULL,
  `newflag` tinyint(1) DEFAULT 1,
  `FlashFlag` tinyint(1) NOT NULL DEFAULT 1,
  `replyflag` tinyint(1) DEFAULT 0,
  `deleteflag` tinyint(1) DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.user_pm: ~0 rows (approximately)

-- Dumping structure for table global.user_win
CREATE TABLE IF NOT EXISTS `user_win` (
  `match_id` bigint(20) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nic` varchar(50) DEFAULT NULL,
  `server` tinyint(3) unsigned DEFAULT NULL,
  `race` tinyint(3) unsigned DEFAULT NULL,
  `wintype` tinyint(3) unsigned DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `timetaken` smallint(6) DEFAULT NULL,
  `power` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `wintype` (`wintype`),
  KEY `userid` (`nic`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- Dumping data for table global.user_win: ~0 rows (approximately)

-- Dumping structure for trigger global.global_chat2_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='';
DELIMITER //
CREATE TRIGGER global_chat2_bi
BEFORE INSERT ON `global`.`chat2`
FOR EACH ROW
BEGIN
  IF NEW.match_id = 0 OR NEW.match_id IS NULL THEN
    IF @match_id IS NOT NULL AND @match_id > 0 THEN
      SET NEW.match_id = @match_id;
    ELSE
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'match_id must be set. Use SET @match_id = <value> before insert.';
    END IF;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_chat_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER global_chat_bi
BEFORE INSERT ON `global`.`chat`
FOR EACH ROW
BEGIN
  IF NEW.match_id IS NULL THEN
    SET NEW.match_id = @match_id;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_col_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER global_col_bi
BEFORE INSERT ON `global`.`col`
FOR EACH ROW
BEGIN
  IF NEW.match_id = 0 OR NEW.match_id IS NULL THEN
    IF @match_id IS NOT NULL AND @match_id > 0 THEN
      SET NEW.match_id = @match_id;
    ELSE
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'match_id must be set. Use SET @match_id = <value> before insert.';
    END IF;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_col_bu
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER global_col_bu
BEFORE UPDATE ON `global`.`col`
FOR EACH ROW
BEGIN
  IF NEW.match_id <> OLD.match_id THEN
    SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='match_id is immutable';
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_eventp_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='';
DELIMITER //
CREATE TRIGGER global_eventp_bi
BEFORE INSERT ON `global`.`eventp`
FOR EACH ROW
BEGIN
  IF NEW.match_id = 0 OR NEW.match_id IS NULL THEN
    IF @match_id IS NOT NULL AND @match_id > 0 THEN
      SET NEW.match_id = @match_id;
    ELSE
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'match_id must be set. Use SET @match_id = <value> before insert.';
    END IF;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_event_attack_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER global_event_attack_bi
BEFORE INSERT ON `global`.`event_attack`
FOR EACH ROW
BEGIN
  IF NEW.match_id IS NULL THEN
    SET NEW.match_id = @match_id;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_event_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER global_event_bi
BEFORE INSERT ON `global`.`event`
FOR EACH ROW
BEGIN
  IF NEW.match_id IS NULL THEN
    SET NEW.match_id = @match_id;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_fed_apply_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='';
DELIMITER //
CREATE TRIGGER global_fed_apply_bi
BEFORE INSERT ON `global`.`fed_apply`
FOR EACH ROW
BEGIN
  IF NEW.match_id = 0 OR NEW.match_id IS NULL THEN
    IF @match_id IS NOT NULL AND @match_id > 0 THEN
      SET NEW.match_id = @match_id;
    ELSE
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'match_id must be set. Use SET @match_id = <value> before insert.';
    END IF;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_fed_forum_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='';
DELIMITER //
CREATE TRIGGER global_fed_forum_bi
BEFORE INSERT ON `global`.`fed_forum`
FOR EACH ROW
BEGIN
  IF NEW.match_id = 0 OR NEW.match_id IS NULL THEN
    IF @match_id IS NOT NULL AND @match_id > 0 THEN
      SET NEW.match_id = @match_id;
    ELSE
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'match_id must be set. Use SET @match_id = <value> before insert.';
    END IF;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_fed_Log_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='';
DELIMITER //
CREATE TRIGGER global_fed_Log_bi
BEFORE INSERT ON `global`.`fed_Log`
FOR EACH ROW
BEGIN
  IF NEW.match_id = 0 OR NEW.match_id IS NULL THEN
    IF @match_id IS NOT NULL AND @match_id > 0 THEN
      SET NEW.match_id = @match_id;
    ELSE
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'match_id must be set. Use SET @match_id = <value> before insert.';
    END IF;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_fed_planetcount_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='';
DELIMITER //
CREATE TRIGGER global_fed_planetcount_bi
BEFORE INSERT ON `global`.`fed_planetcount`
FOR EACH ROW
BEGIN
  IF NEW.match_id = 0 OR NEW.match_id IS NULL THEN
    IF @match_id IS NOT NULL AND @match_id > 0 THEN
      SET NEW.match_id = @match_id;
    ELSE
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'match_id must be set. Use SET @match_id = <value> before insert.';
    END IF;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_good_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='';
DELIMITER //
CREATE TRIGGER global_good_bi
BEFORE INSERT ON `global`.`good`
FOR EACH ROW
BEGIN
  IF NEW.match_id = 0 OR NEW.match_id IS NULL THEN
    IF @match_id IS NOT NULL AND @match_id > 0 THEN
      SET NEW.match_id = @match_id;
    ELSE
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'match_id must be set. Use SET @match_id = <value> before insert.';
    END IF;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_project_user_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='';
DELIMITER //
CREATE TRIGGER global_project_user_bi
BEFORE INSERT ON `global`.`project_user`
FOR EACH ROW
BEGIN
  IF NEW.match_id = 0 OR NEW.match_id IS NULL THEN
    IF @match_id IS NOT NULL AND @match_id > 0 THEN
      SET NEW.match_id = @match_id;
    ELSE
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'match_id must be set. Use SET @match_id = <value> before insert.';
    END IF;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_ship_user_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='';
DELIMITER //
CREATE TRIGGER global_ship_user_bi
BEFORE INSERT ON `global`.`ship_user`
FOR EACH ROW
BEGIN
  IF NEW.match_id = 0 OR NEW.match_id IS NULL THEN
    IF @match_id IS NOT NULL AND @match_id > 0 THEN
      SET NEW.match_id = @match_id;
    ELSE
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'match_id must be set. Use SET @match_id = <value> before insert.';
    END IF;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_trade_good_user_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='';
DELIMITER //
CREATE TRIGGER global_trade_good_user_bi
BEFORE INSERT ON `global`.`trade_good_user`
FOR EACH ROW
BEGIN
  IF NEW.match_id = 0 OR NEW.match_id IS NULL THEN
    IF @match_id IS NOT NULL AND @match_id > 0 THEN
      SET NEW.match_id = @match_id;
    ELSE
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'match_id must be set. Use SET @match_id = <value> before insert.';
    END IF;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_user_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_user_bu
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_user_good_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER global_user_good_bi
BEFORE INSERT ON `global`.`user_good`
FOR EACH ROW
BEGIN
  IF NEW.match_id IS NULL THEN
    SET NEW.match_id = @match_id;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_user_pm_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='';
DELIMITER //
CREATE TRIGGER global_user_pm_bi
BEFORE INSERT ON `global`.`user_pm`
FOR EACH ROW
BEGIN
  IF NEW.match_id = 0 OR NEW.match_id IS NULL THEN
    IF @match_id IS NOT NULL AND @match_id > 0 THEN
      SET NEW.match_id = @match_id;
    ELSE
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'match_id must be set. Use SET @match_id = <value> before insert.';
    END IF;
  END IF;
END//
DELIMITER ;

-- Dumping structure for trigger global.global_user_win_bi
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='';
DELIMITER //
CREATE TRIGGER global_user_win_bi
BEFORE INSERT ON `global`.`user_win`
FOR EACH ROW
BEGIN
  IF NEW.match_id = 0 OR NEW.match_id IS NULL THEN
    IF @match_id IS NOT NULL AND @match_id > 0 THEN
      SET NEW.match_id = @match_id;
    ELSE
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'match_id must be set. Use SET @match_id = <value> before insert.';
    END IF;
  END IF;
END//
DELIMITER ;

