mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-23 22:09:09 +02:00
[management] Add additional indexes for groups, events, pats and access logs (#8289)
This commit is contained in:
@@ -22,9 +22,9 @@ const (
|
||||
|
||||
type AccessLogEntry struct {
|
||||
ID string `gorm:"primaryKey"`
|
||||
AccountID string `gorm:"index"`
|
||||
AccountID string `gorm:"index;index:idx_access_log_entries_account_timestamp,priority:1,option:CONCURRENTLY"`
|
||||
ServiceID string `gorm:"index"`
|
||||
Timestamp time.Time `gorm:"index"`
|
||||
Timestamp time.Time `gorm:"index;index:idx_access_log_entries_account_timestamp,priority:2"`
|
||||
GeoLocation peer.Location `gorm:"embedded;embeddedPrefix:location_"`
|
||||
SubdivisionCode string
|
||||
Method string `gorm:"index"`
|
||||
|
||||
@@ -17,7 +17,7 @@ type ActivityDescriber interface { //nolint:revive
|
||||
// Event represents a network/system activity event.
|
||||
type Event struct {
|
||||
// Timestamp of the event
|
||||
Timestamp time.Time
|
||||
Timestamp time.Time `gorm:"index:idx_events_account_timestamp,priority:2"`
|
||||
// Activity that was performed during the event
|
||||
Activity Activity `gorm:"type:integer"`
|
||||
// ID of the event (can be empty, meaning that it wasn't yet generated)
|
||||
@@ -31,7 +31,7 @@ type Event struct {
|
||||
// TargetID is the ID of an object that was effected by the event (e.g., a peer)
|
||||
TargetID string
|
||||
// AccountID is the ID of an account where the event happened
|
||||
AccountID string `gorm:"index"`
|
||||
AccountID string `gorm:"index;index:idx_events_account_timestamp,priority:1,option:CONCURRENTLY"`
|
||||
|
||||
// Meta of the event, e.g. deleted peer information like name, IP, etc
|
||||
Meta map[string]any `gorm:"serializer:json"`
|
||||
|
||||
@@ -40,7 +40,7 @@ type Group struct {
|
||||
type GroupPeer struct {
|
||||
AccountID string `gorm:"index"`
|
||||
GroupID string `gorm:"primaryKey"`
|
||||
PeerID string `gorm:"primaryKey"`
|
||||
PeerID string `gorm:"primaryKey;index:idx_group_peers_peer_id,option:CONCURRENTLY"`
|
||||
}
|
||||
|
||||
func (g *Group) LoadGroupPeers() {
|
||||
|
||||
@@ -31,7 +31,7 @@ type PersonalAccessToken struct {
|
||||
// User is a reference to Account that this object belongs
|
||||
UserID string `gorm:"index"`
|
||||
Name string
|
||||
HashedToken string
|
||||
HashedToken string `gorm:"index:idx_personal_access_tokens_hashed_token"`
|
||||
ExpirationDate *time.Time
|
||||
// scope could be added in future
|
||||
CreatedBy string
|
||||
|
||||
Reference in New Issue
Block a user