-- No longer needed
DROP TABLE entityStatic;
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014839, 500, 0, 50000000, 1000, 45, 54, 1000173, 30000380, 20000054, 10000004, 'Polaris I - Station', 35263733760, 4932526080, 55459307520, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014842, 500, 0, 50000000, 1000, 45, 56, 1000173, 30000380, 20000054, 10000004, 'Polaris II - Station', 65561272320, 9169920000, -95195504640, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014845, 500, 0, 50000000, 1000, 45, 1927, 1000173, 30000380, 20000054, 10000004, 'Polaris III - Station', 190772305920, 26684006400, -94657044480, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014936, 500, 0, 50000000, 1000, 45, 1932, 1000132, 30002854, 20000419, 10000034, 'Rat Annihilation and Termination Squad Station', -83125002240, -8509562880, -27283906560, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014848, 500, 0, 50000000, 1000, 45, 2499, 1000173, 30000380, 20000054, 10000004, 'Polaris IV - Station', 266567393280, 37291008000, 98144133120, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014867, 500, 0, 50000000, 1000, 45, 12242, 144719292, 30000895, 20000131, 10000010, 'IMK-K1 IX - Moon 1 - Manufacturing Outpost', 2705419591680, 112490618880, -982318571520, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014868, 500, 0, 50000000, 1000, 45, 12242, 150087495, 30001256, 20000183, 10000014, 'FAT-6P VIII - Moon 1 - Manufacturing Outpost', 1245813596160, -3994705920, 683998126080, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014870, 500, 0, 50000000, 1000, 45, 12242, 144684705, 30002617, 20000383, 10000031, 'Z-N9IP VII - Moon 2 - Manufacturing Outpost', 1744243384320, 58374266880, 444875120640, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014872, 500, 0, 50000000, 1000, 45, 12242, 150087495, 30003121, 20000456, 10000039, 'BZ-0GW V - Moon 1 - Manufacturing Outpost', -523215790080, 41777356800, 74517504000, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014873, 500, 0, 50000000, 1000, 45, 12242, 1000135, 30003666, 20000534, 10000045, 'V7-MID IX - Moon 1 - Manufacturing Outpost', -1771751546880, -224628203520, -2169463480320, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014883, 500, 0, 50000000, 1000, 45, 12242, 150094093, 30004962, 20000726, 10000063, 'G-Q5JU VII - Moon 1 - Manufacturing Outpost', -2462505246720, -125320519680, -207525027840, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014890, 500, 0, 50000000, 1000, 45, 12294, 1000135, 30000867, 20000127, 10000010, 'D7-ZAC VIII - Moon 1 - Refining Outpost', -36212121600, 1780162560, -483143884800, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014906, 500, 0, 50000000, 1000, 45, 12294, 150134971, 30004935, 20000722, 10000063, 'TPAR-G IX - Moon 3 - Refining Outpost', 546419466240, -91034296320, -769929584640, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014920, 500, 0, 50000000, 1000, 45, 12295, 150001295, 30003689, 20000537, 10000046, 'Allah Ackhbar', -2135999815680, 222355415040, -231166156800, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014921, 500, 0, 50000000, 1000, 45, 12295, 144693213, 30003979, 20000581, 10000050, '9CG6-H VIII - Moon 4 - Cloning Outpost', -482415452160, -32584704000, 289285939200, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014922, 500, 0, 50000000, 1000, 45, 12295, 1000135, 30004059, 20000593, 10000051, '9-4RP2 IV - Moon 2 - Cloning Outpost', 878666588160, 175879741440, -1675383644160, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014924, 500, 0, 50000000, 1000, 45, 12295, 1000135, 30004453, 20000650, 10000056, 'VNGJ-U V - Moon 1 - Cloning Outpost', -90715545600, 8120279040, 236737781760, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(60014926, 500, 0, 50000000, 1000, 45, 12295, 150134971, 30004712, 20000689, 10000060, 'NOL-M9 VI - Moon 2 - Cloning Outpost', 356915896320, 67440599040, -143501844480, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(61000001, 500, 0, 50000000, 1000, 45, 21646, 150020944, 30004470, 20000652, 10000056, 'DB1R-4 II - duperTum Corp Minmatar Service Outpost', 41858520043.9836, -3560717577.50918, -74433249981.7999, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(61000002, 500, 0, 50000000, 1000, 45, 21646, 150020944, 30004469, 20000652, 10000056, 'ZS-2LT XI - duperTum Corp Minmatar Service Outpost', 3551829704651.49, 48132245340.0623, 1676316680033.34, 0.5, 0.025, 4);
INSERT INTO `staStations` (`stationID`, `security`, `dockingCostPerVolume`, `maxShipVolumeDockable`, `officeRentalCost`, `operationID`, `stationTypeID`, `corporationID`, `solarSystemID`, `constellationID`, `regionID`, `stationName`, `x`, `y`, `z`, `reprocessingEfficiency`, `reprocessingStationsTake`, `reprocessingHangarFlag`) VALUES(61000003, 500, 0, 50000000, 1000, 45, 21646, 150020944, 30004952, 20000724, 10000063, 'JZL-VB VIII - duperTum Corp Minmatar Service Outpost', -369609154560, -38893363200, 2953009766400, 0.5, 0.025, 4);
/*
 * This SQL batch drops some columns which are no longer needed.
 * 
 * characterName, typeID -> LEFT JOIN entity
 * bloodlineID           -> LEFT JOIN entity, bloodlineTypes
 * raceID                -> LEFT JOIN entity, bloodlineTypes, chrBloodlines
 *
 * I know it may look difficult but we don't want to store (and manage)
 * duplicates, do we?
 */

ALTER TABLE character_
 DROP COLUMN characterName,
 DROP COLUMN typeID,
 DROP COLUMN bloodlineID,
 DROP COLUMN raceID;

/*
 * We don't drop characterStatic's columns characterName
 * and typeID because prime_db.sql uses these columns to
 * properly populate entity and eveStaticOwners tables.
 */  
ALTER TABLE characterStatic
 DROP COLUMN bloodlineID,
 DROP COLUMN raceID;

/*
 * Moving corporation roles from chrCorporationRoles to character_.
 */

ALTER TABLE character_
 ADD COLUMN corpRole BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER corporationID,
 ADD COLUMN rolesAtAll BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER corpRole,
 ADD COLUMN rolesAtBase BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER rolesAtAll,
 ADD COLUMN rolesAtHQ BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER rolesAtBase,
 ADD COLUMN rolesAtOther BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER rolesAtHQ
;

DROP TABLE IF EXISTS chrCorporationRoles;
DROP TABLE IF EXISTS `chrSkillQueue`;

CREATE TABLE `chrSkillQueue` (
	`id` int(10) unsigned NOT NULL auto_increment,
	`itemID` int(10) unsigned NOT NULL,
	`typeID` int(10) unsigned NOT NULL,
	`level` int(10) unsigned NOT NULL,
	UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;
ALTER TABLE `chrSkillQueue`
 CHANGE `id` `orderIndex` INT(10) UNSIGNED NOT NULL AFTER `characterID`,
 CHANGE `itemID` `characterID` INT(10) UNSIGNED NOT NULL,
 DROP KEY `id`;
