Fix database generation scripts