Add foreign keys constraints to rips group tables