Database Schema DDL Generation Guide - hmislk/hmis GitHub Wiki

This page explains how to generate and apply the full database schema for the application, including all missing tables and fields. This is especially useful when setting up a fresh instance of the application or restoring a database structure.

Steps to Generate the DDL File

  1. Locate the persistence.xml file in your project you use for development.
  2. Replace its contents with the configuration from persistence_for_database_generation_script.xml.
  3. Adjust the values in that file, especially the location where the DDL file should be generated on your computer.
  4. Run the application once. This will generate the full database schema as a DDL script in the specified file location.
  5. Open the generated DDL file and copy its contents.
  6. In the application where you want to update the database, go to Menu > Administration > Manage Metadata > Add Missing Fields, paste the copied DDL content into the provided text area, and click the Update Database button.
  7. The latest version of the DDL file is available for download below so that you need not generate it yourself.

Last Update - 2026.08.11 16.22 - (Ariyaratne)

Download the Full DDL File

Download createDDL.sql

Why a download link instead of inline SQL? The full script is ~650 KB — larger than GitHub's page-rendering limit — so when it was pasted into this page, GitHub silently truncated the displayed SQL mid-statement. Anyone copying from the rendered page would have applied an incomplete script. Always use the raw file linked above; never copy the SQL from a rendered wiki page.

To apply it, go to Menu > Administration > Manage Metadata > Add Missing Fields and click Load Latest DDL from Wiki — the server downloads the file above directly, then click Update Database. This is the recommended path: pasting the full ~650 KB script into the text area can exceed the server's maximum POST size and fail with a "Post too large" error.

On older application versions that do not have the Load Latest DDL from Wiki button, download the file and paste its contents into the text area as described in step 6 above — and if you get a "Post too large" error, upgrade the application or apply the script in smaller parts.