A schema is used to define connections to a database. Rather than connecting to a specific database, the schema definition allows you to connect to a different database depending on which environment your web application is running in.

Schema values

Before defining your schema, you must define one or more database connection definitions using the db_config model. Typically, you will define a db_config that points to a test database in your sandbox environment and a second db_config definition that points to a production database with an identical structure to the sandbox database. Then you would configure your schema to point to the test database in the sandbox environment and the production database in the live environment.

Click on the magnifying class icons to select from a list of available db_config values.

Setting Your Schema

A default schema can be set within site_settings. This schema will be used when the schema is not set at the page or component level. If a page or dollar function wants to access a different schema, the default schema can be overridden by the component.

Mandatory Schemas

Several GenHelm models make use of a schema named information_schema. This is a schema that is built into MySQL to contain metadata pertaining to the other schemas. You will need to define this schema to take advantage of certain features such those which automatically populate your model specification with a list of fields defined within the table you want to access.

The informatiion_schema definition will look something like this:

Information schema definition

If you are working on a stand-alone PC but you have connectivity to the sandbox information schema you could also point to your sandbox rather than having a local database.

Your db_config definition will look something like this:

db_config definition for the information_schema

These definitions can be defined within the genhelm site if you only plan on using these within GenHelm itself, alternatively you can create these within system to gain access to them from any site.

Sample schema definition
Sample schema graphic