Add and/or fix several missing database indexes

* Schema needs to be in SQL format for now, since fast LIKE queries on
  the ancestry column require a Postgres-specific index type