acardona/CATMAID — pull request #492 by mhl (2013-04-07 17:43:57+00:00)
Title: Ensure that the B-tree index on parent_id of the treenode table exists

The initial migration 0001 *should* have created an index on
the parent_id column of treenode, but didn't. This means that
new instances where the database schema was entirely created
via syncdb and south wouldn't have that index, whereas legacy
databases would.

This migration, when run forwards, creates that index if it
wasn't already present.

This commit also adds a function for returning all indices in
the public schema which may be useful for similar migrations
in the future, e.g. if any other such indices were missed.

(Note that foreign key columns that were created by South
or Django have indices them created automatically - db_index=True
is assumed for ForeignKey. So, this is only an issue for the
manually created tables, which are those in the PostgreSQL
inheritance hierarchy.)