]> ruin.nu Git - ndwebbie.git/commitdiff
Change database structure for planets and alliances + PG 8.4 changes
authorMichael Andreen <harv@ruin.nu>
Tue, 28 Jul 2009 00:51:51 +0000 (02:51 +0200)
committerMichael Andreen <harv@ruin.nu>
Sat, 15 Aug 2009 14:40:26 +0000 (16:40 +0200)
Change the id for planets from id to pid. Similar change for alliances where
id is changed to aid. This makes them unique in the database, which
makes it possible to replace several 'JOIN .. ON' with 'JOIN .. USING'
or 'NATURAL JOIN'.

Also, use the real alliance name as foreign key instead of the
surrogate key.

Some bigger queries are moved into views, mainly defense calls and
alliance resource estimation.

Together with this, use some new PostgreSQL 8.4 features.

* CTE and Window function for alliance resource estimate, so only the
  top60 planets are picked.

* Use the new array_agg() instead of the custom array_accum()

Also, since 0000 is not a valid year anymore, raid.js is changed to use
0001 instead.


No differences found