Fix case when half update queries are executed

Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>
combine & move alter query at the last; made update queries idempotent

Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>