TODO: Apply the same tag change to other structs with uuid id too
This commit is contained in:
parent
68859642f3
commit
588849a6c2
1 changed files with 13 additions and 1 deletions
|
@ -19,7 +19,19 @@ import (
|
|||
// - AP remote links
|
||||
// - Auth methods and tokens (hashed pw, totp key, passkey id)
|
||||
type User struct {
|
||||
ID string `gorm:"primarykey"` // ID is a uuid for this account
|
||||
// ID is a uuid for this account
|
||||
//
|
||||
// NOTE: Performance and storage wise, using a UUID (as string) for the primary key
|
||||
// is not the best idea and it would be better to use incrementing integers
|
||||
// Additionally, there is a risk with inconsistency if postgres crashes during a commit
|
||||
// in which case the new entry might not have a valid Id with which it could be found
|
||||
// and the username is lost until manual recovery
|
||||
// However, a UUID is still necessary in some way to provide a (secondary) stable
|
||||
// identifier for users and other servers, especially when changing the username
|
||||
// (username != display name) might be a future feature
|
||||
// Same also applies for other types that use a UUID as primary key
|
||||
// TODO: Copy the default value and gorm type to those other types as well
|
||||
ID string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"`
|
||||
// Username of the user (eg "max" if the full username is @max@example.com)
|
||||
// Assume unchangable (once set by a user) to be kind to other implementations
|
||||
// Would be an easy avenue to fuck with them though
|
||||
|
|
Loading…
Reference in a new issue