Database

From DreamFactory
Jump to: navigation, search


Data Model

The data model for DFE consists of a few core entities and many supporting entities. Below is the overall diagram of the entire model. We'll have a look at the pieces in the following sections. Dfe-database.png

Core Entities

Several tables in the data model act as **core** entities. That is to say, all other models, in one way or another, rely on their existence. Take the *User* table, for instance. Without it, the instances cannot be launched.

The following entities are considered **core** entities of DreamFactory Enterprise:

* Cluster
* Server
* Mount
* Instance
* ServiceUser
* User

Owned Entities

Three (Cluster, User, and Instance) of the core entities are considered to be *owned*. This means that they can be the virtual property of a *user* or other core entity, instead of being *system-owned*. This notion is intended for the future use, and expansion of, instance automation services. Currently, unless otherwise specified, the system **owns** all core entities.

Associative Entities

The relationship of servers to clusters, and instances to servers are maintained via *associative entities*. These entities consist, usually, of a primary key and time stamps. The primary key, however, is a composite key of the `id` columns of the two entities being associated. The associative entities relating to the core entities are:


* ClusterServerAssign
* InstanceServerAssign


The first, ClusterServerAssign (`cluster_server_asgn_t`), associates servers to clusters. This maintains servers within a cluster's sphere of influence. The second, InstanceServerAssign (`instance_server_asgn_t`), associates instances to servers. This relationship is maintained for performance, metrics, and future load-balancing purposes.

Archive Entities

Clusters, servers, and instances (and their associations) are never truly *deleted*. The system operates in a *soft-delete* mode whereby these core entities are recoverable via simple SQL statements. These archive entities are:

* ClusterArchive
* ClusterServerAssignArchive
* InstanceArchive
* InstanceGuestArchive
* InstanceServerAssignArchive
* ServerArchive


Diagram

ServiceUser is not included as it is currently only used to authorize Console logins.

Dfe-database-core.png