Ticket #4536: updatedb.sql

File updatedb.sql, 4.3 KB (added by user1, 7 years ago)

Apply this to the database with sqlite3 lobby_rankings.sqlite3 < updatedb.sql

Line 
1CREATE TABLE "players_info_tmp" (
2 `id` INTEGER NOT NULL,
3 `player_id` INTEGER,
4 `game_id` INTEGER,
5 `civs` VARCHAR(20),
6 `teams` INTEGER,
7 `economyScore` INTEGER,
8 `militaryScore` INTEGER,
9 `totalScore` INTEGER,
10 `foodGathered` INTEGER,
11 `foodUsed` INTEGER,
12 `woodGathered` INTEGER,
13 `woodUsed` INTEGER,
14 `stoneGathered` INTEGER,
15 `stoneUsed` INTEGER,
16 `metalGathered` INTEGER,
17 `metalUsed` INTEGER,
18 `vegetarianFoodGathered` INTEGER,
19 `treasuresCollected` INTEGER,
20 `lootCollected` INTEGER,
21 `tributesSent` INTEGER,
22 `tributesReceived` INTEGER,
23 `totalUnitsTrained` INTEGER,
24 `totalUnitsLost` INTEGER,
25 `enemytotalUnitsKilled` INTEGER,
26 `infantryUnitsTrained` INTEGER,
27 `infantryUnitsLost` INTEGER,
28 `enemyInfantryUnitsKilled` INTEGER,
29 `workerUnitsTrained` INTEGER,
30 `workerUnitsLost` INTEGER,
31 `enemyWorkerUnitsKilled` INTEGER,
32 `femaleCitizenUnitsTrained` INTEGER,
33 `femaleCitizenUnitsLost` INTEGER,
34 `enemyFemaleCitizenUnitsKilled` INTEGER,
35 `cavalryUnitsTrained` INTEGER,
36 `cavalryUnitsLost` INTEGER,
37 `enemyCavalryUnitsKilled` INTEGER,
38 `championUnitsTrained` INTEGER,
39 `championUnitsLost` INTEGER,
40 `enemyChampionUnitsKilled` INTEGER,
41 `heroUnitsTrained` INTEGER,
42 `heroUnitsLost` INTEGER,
43 `enemyHeroUnitsKilled` INTEGER,
44 `shipUnitsTrained` INTEGER,
45 `shipUnitsLost` INTEGER,
46 `enemyShipUnitsKilled` INTEGER,
47 `traderUnitsTrained` INTEGER,
48 `traderUnitsLost` INTEGER,
49 `enemyTraderUnitsKilled` INTEGER,
50 `totalBuildingsConstructed` INTEGER,
51 `totalBuildingsLost` INTEGER,
52 `enemytotalBuildingsDestroyed` INTEGER,
53 `civCentreBuildingsConstructed` INTEGER,
54 `civCentreBuildingsLost` INTEGER,
55 `enemyCivCentreBuildingsDestroyed` INTEGER,
56 `houseBuildingsConstructed` INTEGER,
57 `houseBuildingsLost` INTEGER,
58 `enemyHouseBuildingsDestroyed` INTEGER,
59 `economicBuildingsConstructed` INTEGER,
60 `economicBuildingsLost` INTEGER,
61 `enemyEconomicBuildingsDestroyed` INTEGER,
62 `outpostBuildingsConstructed` INTEGER,
63 `outpostBuildingsLost` INTEGER,
64 `enemyOutpostBuildingsDestroyed` INTEGER,
65 `militaryBuildingsConstructed` INTEGER,
66 `militaryBuildingsLost` INTEGER,
67 `enemyMilitaryBuildingsDestroyed` INTEGER,
68 `fortressBuildingsConstructed` INTEGER,
69 `fortressBuildingsLost` INTEGER,
70 `enemyFortressBuildingsDestroyed` INTEGER,
71 `wonderBuildingsConstructed` INTEGER,
72 `wonderBuildingsLost` INTEGER,
73 `enemyWonderBuildingsDestroyed` INTEGER,
74 `woodBought` INTEGER,
75 `foodBought` INTEGER,
76 `stoneBought` INTEGER,
77 `metalBought` INTEGER,
78 `tradeIncome` INTEGER,
79 `percentMapExplored` INTEGER,
80 PRIMARY KEY(id),
81 FOREIGN KEY(`player_id`) REFERENCES players ( id ),
82 FOREIGN KEY(`game_id`) REFERENCES games ( id )
83);
84INSERT INTO players_info_tmp SELECT `id`,`player_id`,`game_id`,`civs`,`teams`,`economyScore`,`militaryScore`,`totalScore`,`foodGathered`,`foodUsed`,`woodGathered`,`woodUsed`,`stoneGathered`,`stoneUsed`,`metalGathered`,`metalUsed`,`vegetarianFoodGathered`,`treasuresCollected`,`lootCollected`,`tributesSent`,`tributesReceived`,`totalUnitsTrained`,`totalUnitsLost`,`enemytotalUnitsKilled`,`infantryUnitsTrained`,`infantryUnitsLost`,`enemyInfantryUnitsKilled`,`workerUnitsTrained`,`workerUnitsLost`,`enemyWorkerUnitsKilled`,`femaleUnitsTrained`,`femaleUnitsLost`,`enemyFemaleUnitsKilled`,`cavalryUnitsTrained`,`cavalryUnitsLost`,`enemyCavalryUnitsKilled`,`championUnitsTrained`,`championUnitsLost`,`enemyChampionUnitsKilled`,`heroUnitsTrained`,`heroUnitsLost`,`enemyHeroUnitsKilled`,`shipUnitsTrained`,`shipUnitsLost`,`enemyShipUnitsKilled`,`traderUnitsTrained`,`traderUnitsLost`,`enemyTraderUnitsKilled`,`totalBuildingsConstructed`,`totalBuildingsLost`,`enemytotalBuildingsDestroyed`,`civCentreBuildingsConstructed`,`civCentreBuildingsLost`,`enemyCivCentreBuildingsDestroyed`,`houseBuildingsConstructed`,`houseBuildingsLost`,`enemyHouseBuildingsDestroyed`,`economicBuildingsConstructed`,`economicBuildingsLost`,`enemyEconomicBuildingsDestroyed`,`outpostBuildingsConstructed`,`outpostBuildingsLost`,`enemyOutpostBuildingsDestroyed`,`militaryBuildingsConstructed`,`militaryBuildingsLost`,`enemyMilitaryBuildingsDestroyed`,`fortressBuildingsConstructed`,`fortressBuildingsLost`,`enemyFortressBuildingsDestroyed`,`wonderBuildingsConstructed`,`wonderBuildingsLost`,`enemyWonderBuildingsDestroyed`,`woodBought`,`foodBought`,`stoneBought`,`metalBought`,`tradeIncome`,`percentMapExplored` FROM `players_info`;
85DROP TABLE `players_info`;
86ALTER TABLE `players_info_tmp` RENAME TO `players_info`;