CREATE TABLE roles (
	role VARCHAR(32) UNIQUE NOT NULL
);

CREATE TABLE group_roles (
	gid INTEGER REFERENCES groups(gid),
	role VARCHAR(32) REFERENCES roles(role),
	PRIMARY KEY(gid,role)
);

INSERT INTO roles VALUES('member_menu');
INSERT INTO roles VALUES('hc_menu');
INSERT INTO roles VALUES('bc_menu');
INSERT INTO roles VALUES('dc_menu');
INSERT INTO roles VALUES('intel_menu');
INSERT INTO roles VALUES('attack_menu');
INSERT INTO roles VALUES('no_fleet_update');
INSERT INTO roles VALUES('admin_users');
INSERT INTO roles VALUES('rankings_planet_intel');
INSERT INTO roles VALUES('alliances_resources');
INSERT INTO roles VALUES('alliances');
INSERT INTO roles VALUES('graphs_intel');
INSERT INTO roles VALUES('members');
INSERT INTO roles VALUES('members_points_nolimit');
INSERT INTO roles VALUES('covop');
INSERT INTO roles VALUES('calls_list');
INSERT INTO roles VALUES('calls_edit');
INSERT INTO roles VALUES('calls_leeches');
INSERT INTO roles VALUES('raids_info');
INSERT INTO roles VALUES('raids_edit');
INSERT INTO roles VALUES('stats_intel');
INSERT INTO roles VALUES('stats_details');
INSERT INTO roles VALUES('stats_missions');
INSERT INTO roles VALUES('stats_scans');
INSERT INTO roles VALUES('stats_planetdata');
INSERT INTO roles VALUES('intel');
INSERT INTO roles VALUES('intel_members');
INSERT INTO roles VALUES('intel_member');
INSERT INTO roles VALUES('intel_naps');
INSERT INTO roles VALUES('textexport_alliance');

INSERT INTO group_roles (gid,role) VALUES(2,'member_menu');
INSERT INTO group_roles (gid,role) VALUES(2,'attack_menu');
INSERT INTO group_roles (gid,role) VALUES(2,'members');
INSERT INTO group_roles (gid,role) VALUES(2,'covop');
INSERT INTO group_roles (gid,role) VALUES(2,'stats_details');
INSERT INTO group_roles (gid,role) VALUES(2,'stats_missions');
INSERT INTO group_roles (gid,role) VALUES(2,'stats_scans');
INSERT INTO group_roles (gid,role) VALUES(2,'stats_planetdata');

INSERT INTO group_roles (gid,role) VALUES(6,'dc_menu');
INSERT INTO group_roles (gid,role) VALUES(6,'calls_list');
INSERT INTO group_roles (gid,role) VALUES(6,'calls_edit');
INSERT INTO group_roles (gid,role) VALUES(6,'calls_leeches');

INSERT INTO group_roles (gid,role) VALUES(4,'bc_menu');
INSERT INTO group_roles (gid,role) VALUES(4,'raids_info');
INSERT INTO group_roles (gid,role) VALUES(4,'raids_edit');

INSERT INTO group_roles (gid,role) VALUES(5,'intel_menu');
INSERT INTO group_roles (gid,role) VALUES(5,'intel');

INSERT INTO group_roles (gid,role) VALUES(8,'no_fleet_update');

INSERT INTO group_roles (gid,role) VALUES(9,'members_points_nolimit');
INSERT INTO group_roles (gid,role) VALUES(9,'stats_intel');

INSERT INTO group_roles (gid,role) VALUES(1,'dc_menu');
INSERT INTO group_roles (gid,role) VALUES(1,'bc_menu');
INSERT INTO group_roles (gid,role) VALUES(1,'hc_menu');
INSERT INTO group_roles (gid,role) VALUES(1,'intel_menu');
INSERT INTO group_roles (gid,role) VALUES(1,'admin_users');
INSERT INTO group_roles (gid,role) VALUES(1,'rankings_planet_intel');
INSERT INTO group_roles (gid,role) VALUES(1,'alliances_resources');
INSERT INTO group_roles (gid,role) VALUES(1,'alliances');
INSERT INTO group_roles (gid,role) VALUES(1,'graphs_intel');
INSERT INTO group_roles (gid,role) VALUES(1,'calls_list');
INSERT INTO group_roles (gid,role) VALUES(1,'calls_edit');
INSERT INTO group_roles (gid,role) VALUES(1,'calls_leeches');
INSERT INTO group_roles (gid,role) VALUES(1,'raids_info');
INSERT INTO group_roles (gid,role) VALUES(1,'raids_edit');
INSERT INTO group_roles (gid,role) VALUES(1,'intel');
INSERT INTO group_roles (gid,role) VALUES(1,'intel_members');
INSERT INTO group_roles (gid,role) VALUES(1,'intel_member');
INSERT INTO group_roles (gid,role) VALUES(1,'intel_naps');
INSERT INTO group_roles (gid,role) VALUES(1,'textexport_alliance');

INSERT INTO group_roles (gid,role) VALUES(3,'dc_menu');
INSERT INTO group_roles (gid,role) VALUES(3,'bc_menu');
INSERT INTO group_roles (gid,role) VALUES(3,'hc_menu');
INSERT INTO group_roles (gid,role) VALUES(3,'intel_menu');
INSERT INTO group_roles (gid,role) VALUES(3,'admin_users');
INSERT INTO group_roles (gid,role) VALUES(3,'rankings_planet_intel');
INSERT INTO group_roles (gid,role) VALUES(3,'alliances_resources');
INSERT INTO group_roles (gid,role) VALUES(3,'alliances');
INSERT INTO group_roles (gid,role) VALUES(3,'graphs_intel');
INSERT INTO group_roles (gid,role) VALUES(3,'calls_list');
INSERT INTO group_roles (gid,role) VALUES(3,'calls_edit');
INSERT INTO group_roles (gid,role) VALUES(3,'calls_leeches');
INSERT INTO group_roles (gid,role) VALUES(3,'raids_info');
INSERT INTO group_roles (gid,role) VALUES(3,'raids_edit');
INSERT INTO group_roles (gid,role) VALUES(3,'intel');
INSERT INTO group_roles (gid,role) VALUES(3,'intel_members');
INSERT INTO group_roles (gid,role) VALUES(3,'intel_member');
INSERT INTO group_roles (gid,role) VALUES(3,'intel_naps');
INSERT INTO group_roles (gid,role) VALUES(3,'textexport_alliance');
