From c9e1881f55f09241c3d6483e0dca95bb697d289d Mon Sep 17 00:00:00 2001 From: mstar Date: Mon, 31 Mar 2025 15:23:24 +0200 Subject: [PATCH] Add IDs to the various connector structs --- storage-new/models/NoteToAttachments.go | 1 + storage-new/models/NoteToEmotes.go | 1 + storage-new/models/NoteToPing.go | 1 + storage-new/models/NoteToTag.go | 1 + storage-new/models/TokenLoginProcess.go | 4 +++- storage-new/models/UserAuthentication.go | 1 + storage-new/models/UserBeings.go | 1 + storage-new/models/UserTags.go | 1 + storage-new/models/UserToPronoun.go | 1 + storage-new/models/UserToRole.go | 1 + storage-new/models/UserToUserRelation.go | 1 + 11 files changed, 13 insertions(+), 1 deletion(-) diff --git a/storage-new/models/NoteToAttachments.go b/storage-new/models/NoteToAttachments.go index 21dd416..d562ac2 100644 --- a/storage-new/models/NoteToAttachments.go +++ b/storage-new/models/NoteToAttachments.go @@ -2,6 +2,7 @@ package models // A binding of one note to one media attachment type NoteToAttachment struct { + ID uint64 `gorm:"primarykey"` Note Note NoteId string Attachment MediaMetadata diff --git a/storage-new/models/NoteToEmotes.go b/storage-new/models/NoteToEmotes.go index b218670..4c1af1e 100644 --- a/storage-new/models/NoteToEmotes.go +++ b/storage-new/models/NoteToEmotes.go @@ -2,6 +2,7 @@ package models // A binding of one note to one emote type NoteToEmote struct { + ID uint64 `gorm:"primarykey"` Note Note NoteId string Emote Emote diff --git a/storage-new/models/NoteToPing.go b/storage-new/models/NoteToPing.go index f7d1de8..c2eb86a 100644 --- a/storage-new/models/NoteToPing.go +++ b/storage-new/models/NoteToPing.go @@ -2,6 +2,7 @@ package models // A binding of one note to one mentioned account type NoteToPing struct { + ID uint64 `gorm:"primarykey"` Note Note NoteId string PingTarget User diff --git a/storage-new/models/NoteToTag.go b/storage-new/models/NoteToTag.go index 33bee5d..7ac4271 100644 --- a/storage-new/models/NoteToTag.go +++ b/storage-new/models/NoteToTag.go @@ -2,6 +2,7 @@ package models // A binding of one note to one string (hash)tag type NoteTag struct { + ID uint64 `gorm:"primarykey"` Note Note NoteId string Tag string diff --git a/storage-new/models/TokenLoginProcess.go b/storage-new/models/TokenLoginProcess.go index 9bb67e7..645adc5 100644 --- a/storage-new/models/TokenLoginProcess.go +++ b/storage-new/models/TokenLoginProcess.go @@ -7,8 +7,10 @@ import "time" // Technically, that could be used to permanently block someone from logging in // by starting a new login process every time the target has just started one type LoginProcessToken struct { + ID uint64 `gorm:"primarykey"` User User UserId string `gorm:"unique"` - Token string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"` + Token string `gorm:"type:uuid;default:gen_random_uuid()"` + Name string ExpiresAt time.Time } diff --git a/storage-new/models/UserAuthentication.go b/storage-new/models/UserAuthentication.go index b762191..f7c0244 100644 --- a/storage-new/models/UserAuthentication.go +++ b/storage-new/models/UserAuthentication.go @@ -8,6 +8,7 @@ package models // // Password hashes may only exist at most once per user, the rest 0-m type UserAuthMethod struct { + ID uint64 `gorm:"primarykey"` User User UserId string AuthMethod AuthenticationMethodType `gorm:"type:auth_method_type"` diff --git a/storage-new/models/UserBeings.go b/storage-new/models/UserBeings.go index 2d749cf..fb0bd59 100644 --- a/storage-new/models/UserBeings.go +++ b/storage-new/models/UserBeings.go @@ -3,6 +3,7 @@ package models // Defines an account to be a being of the set type // Multiple are possible for combination type UserToBeing struct { + ID uint64 `gorm:"primarykey"` User User UserId string Being BeingType `gorm:"type:being_type"` diff --git a/storage-new/models/UserTags.go b/storage-new/models/UserTags.go index 92254eb..da0942a 100644 --- a/storage-new/models/UserTags.go +++ b/storage-new/models/UserTags.go @@ -3,6 +3,7 @@ package models // A (hash)tag appearing on an account's profile description // Accounts may have multiple tags, but each tag may only be stored once at most type UserToTag struct { + ID uint64 `gorm:"primarykey"` User User UserId string Tag string diff --git a/storage-new/models/UserToPronoun.go b/storage-new/models/UserToPronoun.go index cbc6d38..09436fc 100644 --- a/storage-new/models/UserToPronoun.go +++ b/storage-new/models/UserToPronoun.go @@ -1,6 +1,7 @@ package models type UserToPronoun struct { + ID uint64 `gorm:"primarykey"` User User UserId string Pronoung string diff --git a/storage-new/models/UserToRole.go b/storage-new/models/UserToRole.go index 657285f..68fad40 100644 --- a/storage-new/models/UserToRole.go +++ b/storage-new/models/UserToRole.go @@ -4,6 +4,7 @@ package models // There may be multiple of these links per user and per role // But a role may only be linked at most once to the same user type UserToRole struct { + ID uint64 `gorm:"primarykey"` User User UserId string Role Role diff --git a/storage-new/models/UserToUserRelation.go b/storage-new/models/UserToUserRelation.go index 58c6b59..ce0130d 100644 --- a/storage-new/models/UserToUserRelation.go +++ b/storage-new/models/UserToUserRelation.go @@ -4,6 +4,7 @@ package models // There may be multiple relations from an account X to an account Y, // each describing a different aspect type UserToUserRelation struct { + ID uint64 `gorm:"primarykey"` User User UserId string TargetUser User