Build database script