Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add schema.xml file
Benn Oshrin committed Sep 25, 2018
1 parent a584671 commit ecee7a1
Showing 1 changed file with 199 additions and 0 deletions.
199 changes: 199 additions & 0 deletions app/config/schema/schema.xml
@@ -0,0 +1,199 @@
<?xml version="1.0" ?>
<!--
COmanage Match Database Schema
Portions licensed to the University Corporation for Advanced Internet
Development, Inc. ("UCAID") under one or more contributor license agreements.
See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
UCAID licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
While this schema mostly works with database prefixes, foreign key constraints
must be specified in raw SQL, which needs the prefixed table name.
-->
<schema version="0.3">
<!--
XXX document datamodel
-->

<table name="meta">
<field name="id" type="I">
<key />
</field>
<field name="upgrade_version" type="C" size="16" />
</table>

<table name="matchgrids">
<field name="id" type="I">
<key />
<autoincrement />
</field>
<field name="description" type="C" size="128" />
<field name="table_name" type="C" size="128" />
<field name="status" type="C" size="2" />
<!-- XXX add this -->
<field name="referenceid_method" type="C" size="2" />
<field name="referenceid_start" type="I" />
<field name="created" type="T" />
<field name="modified" type="T" />

<index name="matchgrids_i1">
<col>table_name</col>
<unique />
</index>
</table>

<table name="permissions">
<field name="id" type="I">
<key />
<autoincrement />
</field>
<!-- We don't currently define username anywhere, ie: there is no users table -->
<field name="username" type="C" size="128" />
<!-- blank for superuser -->
<field name="matchgrid_id" type="I">
<constraint>REFERENCES matchgrids(id)</constraint>
</field>
<field name="permission" type="C" size="2" />
<field name="created" type="T" />
<field name="modified" type="T" />

<index name="permissions_i1">
<col>username</col>
</index>
</table>

<table name="attribute_groups">
<field name="id" type="I">
<key />
<autoincrement />
</field>
<field name="matchgrid_id" type="I">
<constraint>REFERENCES matchgrids(id)</constraint>
</field>
<field name="name" type="C" size="32" />
<field name="created" type="T" />
<field name="modified" type="T" />

<index name="attribute_groups_i1">
<col>matchgrid_id</col>
</index>
</table>

<table name="attributes">
<field name="id" type="I">
<key />
<autoincrement />
</field>
<field name="matchgrid_id" type="I">
<constraint>REFERENCES matchgrids(id)</constraint>
</field>
<!-- restrict to alphanum and use as column name -->
<field name="name" type="C" size="32" />
<field name="description" type="C" size="128" />
<!-- probably need some mechanism to map api_name to nested JSON representation or whatever -->
<field name="api_name" type="C" size="128" />
<field name="attribute_group_id" type="I">
<constraint>REFERENCES attribute_groups(id)</constraint>
</field>
<field name="alphanumeric" type="L" />
<field name="case_sensitive" type="L" />
<field name="invalidates" type="L" />
<field name="null_equivalents" type="L" />
<field name="required" type="L" />
<field name="search_distance" type="I" />
<field name="search_exact" type="L" />
<field name="search_substr_from" type="I" />
<field name="search_substr_for" type="I" />
<field name="created" type="T" />
<field name="modified" type="T" />

<index name="attributes_i1">
<col>matchgrid_id</col>
</index>
</table>

<table name="rules">
<field name="id" type="I">
<key />
<autoincrement />
</field>
<field name="matchgrid_id" type="I">
<constraint>REFERENCES matchgrids(id)</constraint>
</field>
<!-- restrict to alphanum? not really a need to...
do we need both name AND description?
-->
<field name="name" type="C" size="32" />
<field name="description" type="C" size="128" />
<!-- C/anonical P/otential -->
<field name="confidence_mode" type="C" size="2" />
<!-- Order within confidence_mode -->
<field name="ordr" type="I" />
<field name="created" type="T" />
<field name="modified" type="T" />

<index name="rules_i1">
<col>matchgrid_id</col>
</index>
</table>

<!-- If this were just a join table then by cake convention it should be called rules_attributes
-->
<table name="rule_attributes">
<field name="id" type="I">
<key />
<autoincrement />
</field>
<field name="rule_id" type="I">
<constraint>REFERENCES rules(id)</constraint>
</field>
<field name="attribute_id" type="I">
<constraint>REFERENCES attributes(id)</constraint>
</field>
<!-- E/xact S/ubstr D/istance -->
<field name="search_type" type="C" size="2" />
<field name="created" type="T" />
<field name="modified" type="T" />

<index name="rule_attributes_i1">
<col>rule_id</col>
</index>

<!-- XXX do we really need this index? -->
<index name="rule_attributes_i1">
<col>attribute_id</col>
</index>
</table>

<table name="systems_of_record">
<field name="id" type="I">
<key />
<autoincrement />
</field>
<field name="matchgrid_id" type="I">
<constraint>REFERENCES matchgrids(id)</constraint>
</field>
<field name="label" type="C" size="80" />
<!-- I/nteractive E/xternal -->
<field name="resolution_mode" type="c" size="2" />
<field name="created" type="T" />
<field name="modified" type="T" />

<index name="systems_of_record_i1">
<col>matchgrid_id</col>
</index>
</table>
</schema>

0 comments on commit ecee7a1

Please sign in to comment.