refine db script