SchemaScript Example

The following Schema Script example adds a new table with multiple columns, one relation, and one index to the database schema.

Example Schema Script files are also included in the examples directory. There is an example for Clarify databases version 7.0 and later, and an example for Amdocs databases version 6 and later.

Note: Only adds and updates can be performed using Schema Script. Deletes are not supported.

Note: When performing an add operation (such as addTable or addColumn), if that object already exists in the database, this object will be "skipped", and will not cause any database changes to be performed.

Note: This is the entire schema script file.

<schemaScript xmlns="http://www.dovetailsoftware.com/2006/10/SchemaScript.xsd">

   <addTable name="fc_login_monitor" id="4634">
      <description>Tracks application logins and logouts</description>
      <groupName>FC Login Monitor</groupName>
   </addTable>

   <addColumn name="objid" dataType="Integer" table="fc_login_monitor" />
   <addColumn name="logout_time" dataType="DateTime" table="fc_login_monitor" />
   <addColumn name="login_time" dataType="DateTime" table="fc_login_monitor" />
   <addColumn name="application" dataType="String" table="fc_login_monitor" >
	<length>255</length>
   </addColumn>
   <addColumn name="comments" dataType="String" table="fc_login_monitor" >
	<length>255</length>
   </addColumn>
   <addColumn name="login_name" dataType="String" table="fc_login_monitor" >
	<length>80</length>
   </addColumn>
   <addColumn name="fcsessionid" dataType="String" table="fc_login_monitor" >
	<length>80</length>
   </addColumn>

   <addRelation name="user2fc_login_monitor" type="OneToMany" table="user"
	inverseRelationName="fc_login_monitor2user" inverseTable="fc_login_monitor" />

   <addIndex name="sessionid_ind" columns="fcsessionid" table="fc_login_monitor">
	<isUnique>True</isUnique>
   </addIndex>

</schemaScript>

See Also

Working with SchemaScript

Script Ordering

Schema Script Namespaces

Next

Script Ordering

SchemaScript Example