Where is the script to create the database schema?

The schema is created automatically when the icat ear file is deployed. This works fine if no tables exist. If tables do exist it will try to create them and report an error for each table. If any table exists and has the wrong structure, it will not be replaced or updated, and ICAT will not work properly.