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.
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.
Configuring a Schema to Fetch Metadata
Several GenHelm models make use of an internal database named information_schema. This is a database that is built into MySQL to contain metadata pertaining to the other databases. Recall that database systems like MySQL require users to be defined within the context of the database security model. Unlike normal databases, for which database users must be granted access, users are automatically granted access to information_schema data associated with the application databases the users can access.
For example, let's say your database includes a customer_info database. To build web applications that access customer_info tables, you must define a user within the database, let's call her cust_web_user, who is granted access to the customer_info database. The user cust_web_user is automatically granted access to the metadata within information_schema, but only for metadata related to customer_info (or other databases to which the user has been granted access).
Since no additional priviledges are required to access information_schema, you generally don't need to create any special GenHelm schemas for the purpose of accessing information_schema. The only time you might want to create a special GenHelm schema to access metadata is in situations where you want GenHelm developers to have access to metadata for more databases than can be accessed by the GenHelm schemas used to access application data or if, for some reason, you don't want the GenHelm models to use your application schema definitions to access information_schema. In such cases, you can define a dedicated GenHelm schema for use by the GenHeml models.. The name of the dedicated schema definition can be specified using the generation_options model for each site. We recommend using the name information_schema.
The information_schema definition will look something like this:
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:
These definitions are normally defined in can be defined within each web application. Alternatively you can create these within system to gain access to them from any site.