db: add indexes to tables

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>