updated as of: March 30, 2015
last author: Andy Theuninck
The latest documentation can be found on the Project Wiki. The information below may be out of date.
I revised database creation a bit. It still takes place in the install script (install/index.php), the work is no longer all in one multi-thousand line file.

The create_if_needed function (install/db.php) does most of the heavy lifting. It takes five arguments:

The only real gotcha is the double database names. There are two so that the user doesn't have to call their databases is4c_op and is4c_log, but the create_if_needed function can still discern which database we're talking about. By convention, $stddb should be op, trans, or arch. Yay brevity.

Next are create statement scripts. Each table or view should have it's own create statement script. These PHP files live in the install/sql directory, with a subdirectory for each database. The name of the file should match the name of the table. Example: the create statement script for the products table is install/sql/op/products.php.

A create statement script should generate a query string that will create the appropriate table or view and assign it to the variable $CREATE[$stdb.$table_name]. Example: products would assign its query to $CREATE["op.products"]. Create statement scripts are included directly; no need to return anything. The array-entry naming convention is just a sanity check.

Comment your create statement scripts. Any comments included are used to auto-generate HTML documentation for the database.