[qtcontacts-sqlite] Make DetailsJoinIndex unique to optimize queries

SQLite 3.8.5's query planner weighs the detail queries differently, and
(somewhat inexplicably) decides to create an automatic index similar to
DetailsJoinIndex rather than using it. That slows down many queries by
15-20ms, leading to delays of multiple minutes in some cases.

We should look into analyzing the indexes properly, but the best way to
optimize this query now is to make Details(detailId, detail) a unique
index.

If there are concerns with the uniqueness of existing data for these
fields, we can work around the problem using INDEXED BY in the affected
queries.
[qtcontacts-sqlite] Test priority of local details in aggregation

Also ensure that a local constituent added to an existing aggregate
produces a correct result.
[qtcontacts-sqlite] Add quick mode to fetchtimes

The full fetchtimes run takes a very long time; add a 'quick' mode
invoked by the '-q' or '--quick' option, which performs a subset of
the full test suite.
Merge pull request #163 from matthewvogt/prioritize-local-details

[qtcontacts-sqlite] Test priority of local details in aggregation
Merge pull request #164 from special/details-index-unique

[qtcontacts-sqlite] Make DetailsJoinIndex unique to optimize queries
Merge pull request #165 from matthewvogt/quick-fetchtimes

[qtcontacts-sqlite] Add quick mode to fetchtimes
{qtcontacts-sqlite] Alter schema for improved query speed

SQLite generates better query plans using a simplified schema, where
the specific detail tables can be joined to the primary Details table
using only their corresponding rowid columns.

This commit contains only the schema changes, a following commit
provides the script to migrate from old to new schema.
[qtcontact-sqlite] Migrate existing databases to updated schema

Includes renaming the TpMetadata table to the correct name.