]> git.rm.cloudns.org Git - xonotic/xonstatdb.git/commitdiff
Add primary keys using our naming scheme.
authorAnt Zucaro <azucaro@gmail.com>
Sun, 11 Jan 2015 17:30:05 +0000 (12:30 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Sun, 11 Jan 2015 17:30:05 +0000 (12:30 -0500)
scripts/gen_partitions.shl

index 47583ae09edd3d55ef2a7c92f8b4c412426c573e..4a767424c825e1d46eb7b7145c9b8f68280ace9f 100755 (executable)
@@ -33,8 +33,8 @@ do
         if [[ $table = "games" ]]
         then
             printf "CREATE INDEX %s_%s%s_ix002 on %s_%s%s using gin(players);\n" $table $year $qtr $table $year $qtr
-            # TODO(divVerent): This index probably should be a primary key instead.
-            printf "CREATE INDEX %s_%s%s_ix003 on %s_%s%s(game_id);\n" $table $year $qtr $table $year $qtr
+            printf "CREATE UNIQUE INDEX %s_%s%s_pk on %s_%s%s(game_id);\n" $table $year $qtr $table $year $qtr
+            printf "ALTER TABLE %s_%s%s ADD PRIMARY KEY USING INDEX %s_%s%s_pk;\n" $table $year $qtr $table $year $qtr
         fi
         
         if [[ $table = "player_game_stats" || $table = "player_weapon_stats" ]]