database script and diagram