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

Bug-Url: https://bugzilla.redhat.com/1155153
Change-Id: I6e6e2577ceac435e25030dfde6ff6c4c3f8a7278
Signed-off-by: Eli Mesika <emesika@redhat.com>
(cherry picked from commit d65b5293b48d552d90cc4dbf44d2c09769548906)