db: create relationships table if not exists
db: impose unique constraint on thread and label