Relation Table

From truxwiki.com
Revision as of 05:56, 27 January 2024 by Sam (talk | contribs) (→‎SourceObjectTypeID)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This table stores the relationships between things in Truxton. This is how the graph of Truxton objects is stored.

SQL

CREATE TABLE "Relation"
(
  "A_ID" uuid NOT NULL,
  "B_ID" uuid NOT NULL,
  "A_ObjectTypeID" smallint NOT NULL,
  "B_ObjectTypeID" smallint NOT NULL,
  "RelationTypeID" integer NOT NULL,
  "SourceID" uuid NOT NULL,
  "SourceObjectTypeID" smallint NOT NULL
);

Columns

A_ID

The globally unique identifier of the first item.

B_ID

The globally unique identifier of the second item.

A_ObjectTypeID

What type A is. This corresponds to the ID column of the [ObjectType] table. It should be one of these values.

B_ObjectTypeID

What B is. This corresponds to the ID column of the [ObjectType] table. It should be one of these values.

RelationTypeID

What relates these two items. This corresponds to the ID column of the [RelationType] table. It should be one of these types.

SourceID

What related these two items. This uuid points to the reason why we added this record to the table.

SourceObjectTypeID

The type of Source. This corresponds to the ID column of the [ObjectType] table. It should be one of these values.