building db generation script