Commit c7dd5946 authored by Penny Leach's avatar Penny Leach
Browse files

fixing up more broken foreign key mess

parent 7c5c04fd
......@@ -180,7 +180,7 @@ abstract class ArtefactType {
if ($children = $this->get_children_metadata()) {
$this->childreninstances = array();
foreach ($children as $child) {
$classname = $child->type;
$classname = $child->artefacttype;
$instance = new $classname($child->id, $child);
$this->childreninstances[] = $instance;
}
......@@ -217,7 +217,7 @@ abstract class ArtefactType {
if (!isset($this->parentinstance)) {
$this->parentinstance = false;
if ($parent = $this->get_parent_metadata()) {
$classname = $parent->type;
$classname = $parent->artefacttype;
$this->parentinstance = new $classname($parent->id, $parent);
}
}
......
......@@ -17,12 +17,14 @@
</TABLE>
<TABLE NAME="installed_artefact_type" COMMENT="Information about each installed artefact type" NEXT="installed_auth" PREVIOUS="installed_artefact">
<FIELDS>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" NEXT="plugin" />
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" UNSIGNED="false" ENUM="false" NEXT="name" />
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" NEXT="plugin" PREVIOUS="id" />
<FIELD NAME="plugin" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="name" COMMENT="Primary key for installed artefact types" NEXT="pluginfk" />
<KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="installed_artefact" REFFIELDS="name" PREVIOUS="primary" />
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for installed artefact types" NEXT="nameuk" />
<KEY NAME="nameuk" TYPE="unique" FIELDS="name,plugin" COMMENTS="unique name, plugin" PREVIOUS="primary" NEXT="pluginfk" />
<KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="installed_artefact" REFFIELDS="name" PREVIOUS="nameuk" />
</KEYS>
</TABLE>
<TABLE NAME="installed_auth" COMMENT="Information about each installed authentication plugin" PREVIOUS="installed_artefact_type" NEXT="config">
......@@ -84,9 +86,9 @@
</TABLE>
<TABLE NAME="artefact" COMMENT="Basic information common to all artefact plugin instances" PREVIOUS="usr" NEXT="cron">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" NEXT="type" />
<FIELD NAME="type" TYPE="char" LENGTH="255" NOTNULL="true" ENUM="false" PREVIOUS="id" NEXT="container" />
<FIELD NAME="container" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" ENUM="false" PREVIOUS="type" NEXT="parentid" />
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" NEXT="artefacttype" />
<FIELD NAME="artefacttype" TYPE="char" LENGTH="255" NOTNULL="true" ENUM="false" PREVIOUS="id" NEXT="container" />
<FIELD NAME="container" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" UNSIGNED="false" SEQUENCE="false" ENUM="false" PREVIOUS="artefacttype" NEXT="parentid" />
<FIELD NAME="parentid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" ENUM="false" PREVIOUS="container" NEXT="ctime" />
<FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" PREVIOUS="parentid" NEXT="mtime" />
<FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" PREVIOUS="ctime" NEXT="vtime" />
......@@ -98,7 +100,7 @@
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="typefk" />
<KEY NAME="typefk" TYPE="foreign" FIELDS="type" REFTABLE="installed_artefact_type" REFFIELDS="name" PREVIOUS="primary" NEXT="parentfk" />
<KEY NAME="typefk" TYPE="foreign" FIELDS="artefacttype" REFTABLE="installed_artefact_type" REFFIELDS="id" PREVIOUS="primary" NEXT="parentfk" />
<KEY NAME="parentfk" TYPE="foreign" FIELDS="parentid" REFTABLE="artefact" REFFIELDS="id" PREVIOUS="typefk" />
</KEYS>
</TABLE>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment