db: add a common function for index creation

This patch adds a common function that drop the index if exists and
creates it after that.

This is done in order to prevent scripts failures when the index is not
dropped and an attempt to re-create it is done

Change-Id: I6e6e2577ceac435e25030dfde6ff6c4c3f8a7278
Signed-off-by: Eli Mesika <emesika@redhat.com>