Maintaining Application Schema Metadata
What Is Schema Metadata?
Schema metadata about tables includes:
- The application module in which a table belongs
- Data about table triggers, such as whether a primary key is generated,
whether inserts or updates are allowed, and so on
- Data about AlphaKeys
(or Next
Keys), which are system-generated values used as
keys
- Data about user
extended table (UET) inheritance
- Data about views generated for multi-site tables
- Data about application-specific table extensions, such as ERDBGW
population for APS
The system refers to this metadata when generating table triggers.
NOTE: When you create a new table,
first try generating and testing table triggers without adding your
table to the metadata. If it works the way you want, do not add it
to the metadata. Otherwise, refer to this section and the related
topics to determine how to add metadata to adjust the generation.
Defining Metadata
After you create a custom table or a custom column on a standard table,
define any needed metadata as follows:
- Use the Application
Schema Modules Metadata form to define any custom modules.
- Use the Application
Schema Tables Metadata form to:
- Assign custom tables to the appropriate module.
- For backward compatibility with existing multi-site tables,
assign a viewname. The viewname should match the former table
name. For example, a table formerly named item which is now item_mst
would have a view named item. Specify a column name that contains
the site value. The combination of view name and site value is
used to create a view over the table.
- Specify information about insert and update triggers on the
table.
- When UETs are added to the currently selected table, specify
any other tables to which the UETs should be applied.
- If a table has an AlphaKey (you want to generate Next Keys for
a column in the specified table), use the Application
Schema Columns Metadata form to define this.
- If
using this application with APS and you want to populate ERDBGW for
APS for the new table, define the appropriate extensions in the Application
Schema Tables Metadata Extensions
form.
If you later remove a custom table or column from the application database
schema, you must also remove the corresponding row from the application
schema metadata, if that row exists.
Generating Triggers
To generate triggers using the metadata you defined, use the Trigger Management
form, specifying the tables where you changed metadata.
Triggers require generation after you:
- Add columns to standard tables.
- Add custom tables, if you want standard trigger functionality.
- Impact the schema for User Extended Tables with the UET Impact Schema
form. (This generates triggers automatically and creates views for
multi-site tables.)
- Upgrade databases where the schema has changed. (This generates
triggers automatically.)
- Run the Database Migration utility. (This generates triggers automatically.)
Building and Running Scripts
You can dump the metadata into SQL scripts which can then be loaded
into other application databases, for example at other sites where the
same table/column changes are being made. Follow these steps:
- In one site, define the metadata as described above.
- Use the Generate
Application Schema Metadata Scripts form to create the following
scripts, as needed:
- Module metadata, which was defined in the Application Schema
Modules Metadata form
- Tables metadata, which was defined in the Application Schem
Tables Metadata form
- Column (Next Keys) metadata, which was defined in the Application
Schema Columns Metadata form.
- If using this
application with APS, use the Generate
Application Schema Metadata Extensions Script
form to create a SQL script with table-based attribute extensions
metadata.
- Load the SQL script(s) into other sites (application databases),
which must also contain any applicable new or modified schema elements.
- At these other sites, use the Trigger
Management form to generate triggers for specified tables.
For More Information
The document Insert and
Update Trigger Generation, available on our support
Web site, explains in much greater detail the specifics of this metadata
and its use in the system.
Related Topics
Impact Schema
Utility
Trigger Management
User
Extended Tables Overview