-
Notifications
You must be signed in to change notification settings - Fork 14
/
model.go
44 lines (39 loc) · 1.25 KB
/
model.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* Copyright (c) 2023-present, Ukama Inc.
*/
package db
import (
"github.com/jackc/pgtype"
"github.com/ukama/ukama/systems/common/uuid"
"gorm.io/gorm"
)
type Node struct {
gorm.Model
NodeID string `gorm:"type:string;uniqueIndex:node_id_idx_case_insensetive,expression:lower(node_id);size:23;not null"`
OrgID uint
Org Org
}
type Org struct {
gorm.Model
Name string `gorm:"uniqueIndex"`
OrgId uuid.UUID `gorm:"type:uuid;uniqueIndex:org_id_unique_index,where:deleted_at is null;not null;column_name:org_org_id;"`
Certificate string
Ip pgtype.Inet `gorm:"type:inet"`
Nodes []Node
Systems []System
}
type System struct {
gorm.Model
Name string `gorm:"type:string;index:sys_idx,unique,composite:sys_idx,expression:lower(name);not null"`
Uuid string `gorm:"type:uuid;unique"`
Certificate string
Ip pgtype.Inet `gorm:"type:inet"`
Port int32
OrgID uint `gorm:"type:string;index:sys_idx,unique,composite:sys_idx;not null"`
Org Org
Health uint32 `gorm:"default:100"`
}