DROP TABLE IF EXISTS faction_alliances;
CREATE TABLE faction_alliances (
	id               INTEGER PRIMARY KEY,
	faction_id       INTEGER NOT NULL DEFAULT 0,
	friend_faction   INTEGER NOT NULL DEFAULT 0,
	hostile_faction  INTEGER NOT NULL DEFAULT 0,
	UNIQUE(faction_id, friend_faction, hostile_faction),
	FOREIGN KEY (faction_id) REFERENCES factions(id) ON UPDATE CASCADE
);

INSERT INTO faction_alliances VALUES
(61,11,0,1),
(1,11,0,12),
(39,11,0,102),
(64,11,0,122),
(66,12,0,1),
(2,12,0,11),
(75,12,0,120),
(76,12,0,121),
(79,12,0,362),
(80,12,0,363),
(81,12,0,364),
(77,12,0,366),
(78,12,0,367),
(3,21,0,22),
(21,34,0,1),
(41,34,0,5),
(26,34,0,35),
(23,34,0,36),
(25,34,0,354),
(62,44,0,1),
(63,44,0,12),
(40,102,0,35),
(15,102,0,116),
(18,102,0,120),
(36,104,0,103),
(37,104,0,136),
(34,104,102,0),
(35,104,105,0),
(32,105,0,103),
(33,105,0,155),
(30,105,101,0),
(29,105,102,0),
(31,105,104,0),
(16,116,0,102),
(14,116,0,117),
(17,120,0,102),
(65,122,0,11),
(43,122,0,111),
(42,122,0,117),
(27,125,0,139),
(28,139,0,125),
(73,145,1,0),
(57,214,0,1),
(56,214,0,12),
(19,214,0,33),
(59,214,0,359),
(58,214,0,361),
(55,214,11,0),
(60,214,16,0),
(12,250,0,144),
(13,250,143,0),
(9,288,0,289),
(24,354,0,34),
(48,357,0,35),
(51,357,0,36),
(50,357,0,44),
(49,357,0,358),
(44,357,356,0),
(47,358,0,356),
(46,358,0,357),
(52,359,0,360),
(53,361,0,359),
(54,361,0,360),
(67,362,0,363),
(68,362,0,364),
(69,363,0,362),
(70,363,0,364),
(71,364,0,362),
(72,364,0,363),
(82,366,0,11),
(83,366,0,12),
(74,367,0,12);
