From 385c22ef2042ee18f31857d0abca6406c9d9af6f Mon Sep 17 00:00:00 2001 From: Darko Luketic Date: Fri, 8 Apr 2022 21:29:06 +0200 Subject: [PATCH] Update 'Database Schema' --- Database-Schema.md | 107 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 Database-Schema.md diff --git a/Database-Schema.md b/Database-Schema.md new file mode 100644 index 0000000..f3dade2 --- /dev/null +++ b/Database-Schema.md @@ -0,0 +1,107 @@ +``` +Account: + +----------+-----------+--------+----------+----------+---------+---------------+-----------+---------------------------+------------+ + | Field | Type | Unique | Optional | Nillable | Default | UpdateDefault | Immutable | StructTag | Validators | + +----------+-----------+--------+----------+----------+---------+---------------+-----------+---------------------------+------------+ + | id | int64 | false | false | false | false | false | false | json:"id,omitempty" | 0 | + | created | time.Time | false | false | false | true | false | true | json:"created,omitempty" | 0 | + | modified | time.Time | false | true | false | true | true | false | json:"modified,omitempty" | 0 | + | username | string | false | false | false | false | false | false | json:"username,omitempty" | 0 | + | password | []byte | false | false | false | false | false | false | json:"password,omitempty" | 0 | + | super | bool | false | false | false | false | false | false | json:"super,omitempty" | 0 | + | active | bool | false | false | false | false | false | false | json:"active,omitempty" | 0 | + +----------+-----------+--------+----------+----------+---------+---------------+-----------+---------------------------+------------+ + +---------+----------+---------+---------+----------+--------+----------+ + | Edge | Type | Inverse | BackRef | Relation | Unique | Optional | + +---------+----------+---------+---------+----------+--------+----------+ + | domains | Domain | false | | M2M | false | true | + | logs | Logentry | false | | O2M | false | true | + +---------+----------+---------+---------+----------+--------+----------+ + +Alias: + +-----------+-----------+--------+----------+----------+---------+---------------+-----------+----------------------------+------------+ + | Field | Type | Unique | Optional | Nillable | Default | UpdateDefault | Immutable | StructTag | Validators | + +-----------+-----------+--------+----------+----------+---------+---------------+-----------+----------------------------+------------+ + | id | int64 | false | false | false | false | false | false | json:"id,omitempty" | 0 | + | created | time.Time | false | false | false | true | false | true | json:"created,omitempty" | 0 | + | modified | time.Time | false | true | true | true | true | false | json:"modified,omitempty" | 0 | + | domain_id | int64 | false | true | false | false | false | false | json:"domain_id,omitempty" | 0 | + | goto | string | false | false | false | false | false | false | json:"goto,omitempty" | 0 | + | active | bool | false | false | false | false | false | false | json:"active,omitempty" | 0 | + +-----------+-----------+--------+----------+----------+---------+---------------+-----------+----------------------------+------------+ + +--------+--------+---------+---------+----------+--------+----------+ + | Edge | Type | Inverse | BackRef | Relation | Unique | Optional | + +--------+--------+---------+---------+----------+--------+----------+ + | domain | Domain | true | aliases | M2O | true | true | + +--------+--------+---------+---------+----------+--------+----------+ + +Domain: + +---------------+-----------+--------+----------+----------+---------+---------------+-----------+--------------------------------+------------+ + | Field | Type | Unique | Optional | Nillable | Default | UpdateDefault | Immutable | StructTag | Validators | + +---------------+-----------+--------+----------+----------+---------+---------------+-----------+--------------------------------+------------+ + | id | int64 | false | false | false | false | false | false | json:"id,omitempty" | 0 | + | created | time.Time | false | false | false | true | false | true | json:"created,omitempty" | 0 | + | modified | time.Time | false | true | true | true | true | false | json:"modified,omitempty" | 0 | + | domain | string | false | false | false | false | false | false | json:"domain,omitempty" | 0 | + | description | string | false | true | true | false | false | false | json:"description,omitempty" | 0 | + | max_aliases | int64 | false | false | false | false | false | false | json:"max_aliases,omitempty" | 0 | + | max_mailboxes | int64 | false | false | false | false | false | false | json:"max_mailboxes,omitempty" | 0 | + | max_quota | int64 | false | false | false | false | false | false | json:"max_quota,omitempty" | 0 | + | quota | int64 | false | false | false | false | false | false | json:"quota,omitempty" | 0 | + | transport | string | false | false | false | false | false | false | json:"transport,omitempty" | 0 | + | backup_mx | bool | false | false | false | false | false | false | json:"backup_mx,omitempty" | 0 | + | active | bool | false | false | false | false | false | false | json:"active,omitempty" | 0 | + +---------------+-----------+--------+----------+----------+---------+---------------+-----------+--------------------------------+------------+ + +-----------+----------+---------+---------+----------+--------+----------+ + | Edge | Type | Inverse | BackRef | Relation | Unique | Optional | + +-----------+----------+---------+---------+----------+--------+----------+ + | mailboxes | Mailbox | false | | O2M | false | true | + | aliases | Alias | false | | O2M | false | true | + | logs | Logentry | false | | O2M | false | true | + | accounts | Account | true | domains | M2M | false | true | + +-----------+----------+---------+---------+----------+--------+----------+ + +Logentry: + +------------+-----------+--------+----------+----------+---------+---------------+-----------+-----------------------------+------------+ + | Field | Type | Unique | Optional | Nillable | Default | UpdateDefault | Immutable | StructTag | Validators | + +------------+-----------+--------+----------+----------+---------+---------------+-----------+-----------------------------+------------+ + | id | int64 | false | false | false | false | false | false | json:"id,omitempty" | 0 | + | timestamp | time.Time | false | false | false | true | false | true | json:"timestamp,omitempty" | 0 | + | action | string | false | false | false | false | false | false | json:"action,omitempty" | 0 | + | data | string | false | true | true | false | false | false | json:"data,omitempty" | 0 | + | account_id | int64 | false | true | false | false | false | false | json:"account_id,omitempty" | 0 | + | domain_id | int64 | false | true | false | false | false | false | json:"domain_id,omitempty" | 0 | + +------------+-----------+--------+----------+----------+---------+---------------+-----------+-----------------------------+------------+ + +---------+---------+---------+---------+----------+--------+----------+ + | Edge | Type | Inverse | BackRef | Relation | Unique | Optional | + +---------+---------+---------+---------+----------+--------+----------+ + | account | Account | true | logs | M2O | true | true | + | domain | Domain | true | logs | M2O | true | true | + +---------+---------+---------+---------+----------+--------+----------+ + +Mailbox: + +------------+-----------+--------+----------+----------+---------+---------------+-----------+-----------------------------+------------+ + | Field | Type | Unique | Optional | Nillable | Default | UpdateDefault | Immutable | StructTag | Validators | + +------------+-----------+--------+----------+----------+---------+---------------+-----------+-----------------------------+------------+ + | id | int64 | false | false | false | false | false | false | json:"id,omitempty" | 0 | + | active | bool | false | false | false | false | false | false | json:"active,omitempty" | 0 | + | created | time.Time | false | false | false | true | false | true | json:"created,omitempty" | 0 | + | modified | time.Time | false | true | true | true | true | false | json:"modified,omitempty" | 0 | + | domain_id | int64 | false | true | false | false | false | false | json:"domain_id,omitempty" | 0 | + | username | string | false | false | false | false | false | false | json:"username,omitempty" | 0 | + | password | []byte | false | false | false | false | false | false | json:"password,omitempty" | 0 | + | name | string | false | true | true | false | false | false | json:"name,omitempty" | 0 | + | quota | int64 | false | false | false | false | false | false | json:"quota,omitempty" | 0 | + | local_part | string | false | false | false | false | false | false | json:"local_part,omitempty" | 0 | + | homedir | string | false | true | true | false | false | false | json:"homedir,omitempty" | 0 | + | maildir | string | false | true | true | false | false | false | json:"maildir,omitempty" | 0 | + | uid | int32 | false | true | true | false | false | false | json:"uid,omitempty" | 0 | + | gid | int32 | false | true | true | false | false | false | json:"gid,omitempty" | 0 | + +------------+-----------+--------+----------+----------+---------+---------------+-----------+-----------------------------+------------+ + +--------+--------+---------+-----------+----------+--------+----------+ + | Edge | Type | Inverse | BackRef | Relation | Unique | Optional | + +--------+--------+---------+-----------+----------+--------+----------+ + | domain | Domain | true | mailboxes | M2O | true | true | + +--------+--------+---------+-----------+----------+--------+----------+ + +``` \ No newline at end of file