Script to generate database