building rutine for db generation