Fix database automatic script