Database script and model