mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-30 18:53:31 -06:00
[chore] Update bun / sqlite versions; update gtsmodels (#754)
* upstep bun and sqlite versions * allow specific columns to be updated in the db * only update necessary columns for user * bit tidier * only update necessary fields of media_attachment * only update relevant instance fields * update tests * update only specific account columns * use bool pointers on gtsmodels includes attachment, status, account, user * update columns more selectively * test all default fields on new account insert * updating remaining bools on gtsmodels * initialize pointer fields when extracting AP emoji * copy bools properly * add copyBoolPtr convenience function + test it * initialize false bool ptrs a bit more neatly
This commit is contained in:
parent
52fe681ba2
commit
ac6ed3d939
376 changed files with 337942 additions and 298092 deletions
|
|
@ -44,15 +44,15 @@ type Account struct {
|
|||
Fields []Field `validate:"-"` // a key/value map of fields that this account has added to their profile
|
||||
Note string `validate:"-" bun:""` // A note that this account has on their profile (ie., the account's bio/description of themselves)
|
||||
NoteRaw string `validate:"-" bun:""` // The raw contents of .Note without conversion to HTML, only available when requester = target
|
||||
Memorial bool `validate:"-" bun:",default:false"` // Is this a memorial account, ie., has the user passed away?
|
||||
Memorial *bool `validate:"-" bun:",default:false"` // Is this a memorial account, ie., has the user passed away?
|
||||
AlsoKnownAs string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // This account is associated with x account id (TODO: migrate to be AlsoKnownAsID)
|
||||
MovedToAccountID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // This account has moved this account id in the database
|
||||
Bot bool `validate:"-" bun:",default:false"` // Does this account identify itself as a bot?
|
||||
Bot *bool `validate:"-" bun:",default:false"` // Does this account identify itself as a bot?
|
||||
Reason string `validate:"-" bun:""` // What reason was given for signing up when this account was created?
|
||||
Locked bool `validate:"-" bun:",default:true"` // Does this account need an approval for new followers?
|
||||
Discoverable bool `validate:"-" bun:",default:false"` // Should this account be shown in the instance's profile directory?
|
||||
Locked *bool `validate:"-" bun:",default:true"` // Does this account need an approval for new followers?
|
||||
Discoverable *bool `validate:"-" bun:",default:false"` // Should this account be shown in the instance's profile directory?
|
||||
Privacy Visibility `validate:"required_without=Domain,omitempty,oneof=public unlocked followers_only mutuals_only direct" bun:",nullzero"` // Default post privacy for this account
|
||||
Sensitive bool `validate:"-" bun:",default:false"` // Set posts from this account to sensitive by default?
|
||||
Sensitive *bool `validate:"-" bun:",default:false"` // Set posts from this account to sensitive by default?
|
||||
Language string `validate:"omitempty,bcp47_language_tag" bun:",nullzero,notnull,default:'en'"` // What language does this account post in?
|
||||
StatusFormat string `validate:"required_without=Domain,omitempty,oneof=plain markdown" bun:",nullzero"` // What is the default format for statuses posted by this account (only for local accounts).
|
||||
URI string `validate:"required,url" bun:",nullzero,notnull,unique"` // ActivityPub URI for this account.
|
||||
|
|
@ -70,7 +70,7 @@ type Account struct {
|
|||
SensitizedAt time.Time `validate:"-" bun:"type:timestamptz,nullzero"` // When was this account set to have all its media shown as sensitive?
|
||||
SilencedAt time.Time `validate:"-" bun:"type:timestamptz,nullzero"` // When was this account silenced (eg., statuses only visible to followers, not public)?
|
||||
SuspendedAt time.Time `validate:"-" bun:"type:timestamptz,nullzero"` // When was this account suspended (eg., don't allow it to log in/post, don't accept media/posts from this account)
|
||||
HideCollections bool `validate:"-" bun:",default:false"` // Hide this account's collections
|
||||
HideCollections *bool `validate:"-" bun:",default:false"` // Hide this account's collections
|
||||
SuspensionOrigin string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // id of the database entry that caused this account to become suspended -- can be an account ID or a domain block ID
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,6 @@ type DomainBlock struct {
|
|||
CreatedByAccount *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to createdByAccountID
|
||||
PrivateComment string `validate:"-" bun:""` // Private comment on this block, viewable to admins
|
||||
PublicComment string `validate:"-" bun:""` // Public comment on this block, viewable (optionally) by everyone
|
||||
Obfuscate bool `validate:"-" bun:",default:false"` // whether the domain name should appear obfuscated when displaying it publicly
|
||||
Obfuscate *bool `validate:"-" bun:",nullzero,notnull,default:false"` // whether the domain name should appear obfuscated when displaying it publicly
|
||||
SubscriptionID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // if this block was created through a subscription, what's the subscription ID?
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ type Emoji struct {
|
|||
ImageFileSize int `validate:"required,min=1" bun:",nullzero,notnull"` // Size of the emoji image file in bytes, for serving purposes.
|
||||
ImageStaticFileSize int `validate:"required,min=1" bun:",nullzero,notnull"` // Size of the static version of the emoji image file in bytes, for serving purposes.
|
||||
ImageUpdatedAt time.Time `validate:"-" bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // When was the emoji image last updated?
|
||||
Disabled bool `validate:"-" bun:",notnull,default:false"` // Has a moderation action disabled this emoji from being shown?
|
||||
Disabled *bool `validate:"-" bun:",nullzero,notnull,default:false"` // Has a moderation action disabled this emoji from being shown?
|
||||
URI string `validate:"url" bun:",nullzero,notnull,unique"` // ActivityPub uri of this emoji. Something like 'https://example.org/emojis/1234'
|
||||
VisibleInPicker bool `validate:"-" bun:",notnull,default:true"` // Is this emoji visible in the admin emoji picker?
|
||||
VisibleInPicker *bool `validate:"-" bun:",nullzero,notnull,default:true"` // Is this emoji visible in the admin emoji picker?
|
||||
CategoryID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // In which emoji category is this emoji visible?
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,6 @@ type Follow struct {
|
|||
Account *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to accountID
|
||||
TargetAccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:srctarget,notnull,nullzero"` // Who is the target of this follow ?
|
||||
TargetAccount *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to targetAccountID
|
||||
ShowReblogs bool `validate:"-" bun:",default:true"` // Does this follow also want to see reblogs and not just posts?
|
||||
Notify bool `validate:"-" bun:",default:false"` // does the following account want to be notified when the followed account posts?
|
||||
ShowReblogs *bool `validate:"-" bun:",nullzero,notnull,default:true"` // Does this follow also want to see reblogs and not just posts?
|
||||
Notify *bool `validate:"-" bun:",nullzero,notnull,default:false"` // does the following account want to be notified when the followed account posts?
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,6 @@ type FollowRequest struct {
|
|||
Account *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to accountID
|
||||
TargetAccountID string `validate:"required,ulid" bun:"type:CHAR(26),unique:frsrctarget,notnull,nullzero"` // Who is the target of this follow request?
|
||||
TargetAccount *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to targetAccountID
|
||||
ShowReblogs bool `validate:"-" bun:",default:true"` // Does this follow also want to see reblogs and not just posts?
|
||||
Notify bool `validate:"-" bun:",default:false"` // does the following account want to be notified when the followed account posts?
|
||||
ShowReblogs *bool `validate:"-" bun:",nullzero,notnull,default:true"` // Does this follow also want to see reblogs and not just posts?
|
||||
Notify *bool `validate:"-" bun:",nullzero,notnull,default:false"` // does the following account want to be notified when the followed account posts?
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ type MediaAttachment struct {
|
|||
Processing ProcessingStatus `validate:"oneof=0 1 2 666" bun:",notnull,default:2"` // What is the processing status of this attachment
|
||||
File File `validate:"required" bun:",embed:file_,notnull,nullzero"` // metadata for the whole file
|
||||
Thumbnail Thumbnail `validate:"required" bun:",embed:thumbnail_,notnull,nullzero"` // small image thumbnail derived from a larger image, video, or audio file.
|
||||
Avatar bool `validate:"-" bun:",notnull,default:false"` // Is this attachment being used as an avatar?
|
||||
Header bool `validate:"-" bun:",notnull,default:false"` // Is this attachment being used as a header?
|
||||
Cached bool `validate:"-" bun:",notnull"` // Is this attachment currently cached by our instance?
|
||||
Avatar *bool `validate:"-" bun:",nullzero,notnull,default:false"` // Is this attachment being used as an avatar?
|
||||
Header *bool `validate:"-" bun:",nullzero,notnull,default:false"` // Is this attachment being used as a header?
|
||||
Cached *bool `validate:"-" bun:",nullzero,notnull,default:false"` // Is this attachment currently cached by our instance?
|
||||
}
|
||||
|
||||
// File refers to the metadata for the whole file
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ type Mention struct {
|
|||
OriginAccount *Account `validate:"-" bun:"rel:belongs-to"` // account referred to by originAccountID
|
||||
TargetAccountID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // Mention target/receiver account ID
|
||||
TargetAccount *Account `validate:"-" bun:"rel:belongs-to"` // account referred to by targetAccountID
|
||||
Silent bool `validate:"-" bun:",notnull,default:false"` // Prevent this mention from generating a notification?
|
||||
Silent *bool `validate:"-" bun:",nullzero,notnull,default:false"` // Prevent this mention from generating a notification?
|
||||
|
||||
/*
|
||||
NON-DATABASE CONVENIENCE FIELDS
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ type Notification struct {
|
|||
OriginAccount *Account `validate:"-" bun:"rel:belongs-to"` // Account corresponding to originAccountID
|
||||
StatusID string `validate:"required_if=NotificationType mention,required_if=NotificationType reblog,required_if=NotificationType favourite,required_if=NotificationType status,omitempty,ulid" bun:"type:CHAR(26),nullzero"` // If the notification pertains to a status, what is the database ID of that status?
|
||||
Status *Status `validate:"-" bun:"rel:belongs-to"` // Status corresponding to statusID
|
||||
Read bool `validate:"-" bun:",notnull,default:false"` // Notification has been seen/read
|
||||
Read *bool `validate:"-" bun:",nullzero,notnull,default:false"` // Notification has been seen/read
|
||||
}
|
||||
|
||||
// NotificationType describes the reason/type of this notification.
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ type Status struct {
|
|||
Mentions []*Mention `validate:"-" bun:"attached_mentions,rel:has-many"` // Mentions corresponding to mentionIDs
|
||||
EmojiIDs []string `validate:"dive,ulid" bun:"emojis,array"` // Database IDs of any emojis used in this status
|
||||
Emojis []*Emoji `validate:"-" bun:"attached_emojis,m2m:status_to_emojis"` // Emojis corresponding to emojiIDs. https://bun.uptrace.dev/guide/relations.html#many-to-many-relation
|
||||
Local bool `validate:"-" bun:",notnull,default:false"` // is this status from a local account?
|
||||
Local *bool `validate:"-" bun:",nullzero,notnull,default:false"` // is this status from a local account?
|
||||
AccountID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // which account posted this status?
|
||||
Account *Account `validate:"-" bun:"rel:belongs-to"` // account corresponding to accountID
|
||||
AccountURI string `validate:"required,url" bun:",nullzero,notnull"` // activitypub uri of the owner of this status
|
||||
|
|
@ -53,17 +53,17 @@ type Status struct {
|
|||
BoostOfAccount *Account `validate:"-" bun:"rel:belongs-to"` // account that corresponds to boostOfAccountID
|
||||
ContentWarning string `validate:"-" bun:",nullzero"` // cw string for this status
|
||||
Visibility Visibility `validate:"oneof=public unlocked followers_only mutuals_only direct" bun:",nullzero,notnull"` // visibility entry for this status
|
||||
Sensitive bool `validate:"-" bun:",notnull,default:false"` // mark the status as sensitive?
|
||||
Sensitive *bool `validate:"-" bun:",nullzero,notnull,default:false"` // mark the status as sensitive?
|
||||
Language string `validate:"-" bun:",nullzero"` // what language is this status written in?
|
||||
CreatedWithApplicationID string `validate:"required_if=Local true,omitempty,ulid" bun:"type:CHAR(26),nullzero"` // Which application was used to create this status?
|
||||
CreatedWithApplication *Application `validate:"-" bun:"rel:belongs-to"` // application corresponding to createdWithApplicationID
|
||||
ActivityStreamsType string `validate:"required" bun:",nullzero,notnull"` // What is the activitystreams type of this status? See: https://www.w3.org/TR/activitystreams-vocabulary/#object-types. Will probably almost always be Note but who knows!.
|
||||
Text string `validate:"-" bun:""` // Original text of the status without formatting
|
||||
Pinned bool `validate:"-" bun:",notnull,default:false"` // Has this status been pinned by its owner?
|
||||
Federated bool `validate:"-" bun:",notnull"` // This status will be federated beyond the local timeline(s)
|
||||
Boostable bool `validate:"-" bun:",notnull"` // This status can be boosted/reblogged
|
||||
Replyable bool `validate:"-" bun:",notnull"` // This status can be replied to
|
||||
Likeable bool `validate:"-" bun:",notnull"` // This status can be liked/faved
|
||||
Pinned *bool `validate:"-" bun:",nullzero,notnull,default:false"` // Has this status been pinned by its owner?
|
||||
Federated *bool `validate:"-" bun:",notnull"` // This status will be federated beyond the local timeline(s)
|
||||
Boostable *bool `validate:"-" bun:",notnull"` // This status can be boosted/reblogged
|
||||
Replyable *bool `validate:"-" bun:",notnull"` // This status can be replied to
|
||||
Likeable *bool `validate:"-" bun:",notnull"` // This status can be liked/faved
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ type Tag struct {
|
|||
URL string `validate:"required,url" bun:",nullzero,notnull"` // Href/web address of this tag, eg https://example.org/tags/somehashtag
|
||||
Name string `validate:"required" bun:",unique,nullzero,notnull"` // name of this tag -- the tag without the hash part
|
||||
FirstSeenFromAccountID string `validate:"omitempty,ulid" bun:"type:CHAR(26),nullzero"` // Which account ID is the first one we saw using this tag?
|
||||
Useable bool `validate:"-" bun:",notnull,default:true"` // can our instance users use this tag?
|
||||
Listable bool `validate:"-" bun:",notnull,default:true"` // can our instance users look up this tag?
|
||||
Useable *bool `validate:"-" bun:",nullzero,notnull,default:true"` // can our instance users use this tag?
|
||||
Listable *bool `validate:"-" bun:",nullzero,notnull,default:true"` // can our instance users look up this tag?
|
||||
LastStatusAt time.Time `validate:"-" bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was this tag last used?
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@ type User struct {
|
|||
ConfirmationSentAt time.Time `validate:"required_with=ConfirmationToken" bun:"type:timestamptz,nullzero"` // When did we send email confirmation to this user?
|
||||
ConfirmedAt time.Time `validate:"required_with=Email" bun:"type:timestamptz,nullzero"` // When did the user confirm their email address
|
||||
UnconfirmedEmail string `validate:"required_without=Email" bun:",nullzero"` // Email address that hasn't yet been confirmed
|
||||
Moderator bool `validate:"-" bun:",notnull,default:false"` // Is this user a moderator?
|
||||
Admin bool `validate:"-" bun:",notnull,default:false"` // Is this user an admin?
|
||||
Disabled bool `validate:"-" bun:",notnull,default:false"` // Is this user disabled from posting?
|
||||
Approved bool `validate:"-" bun:",notnull,default:false"` // Has this user been approved by a moderator?
|
||||
Moderator *bool `validate:"-" bun:",nullzero,notnull,default:false"` // Is this user a moderator?
|
||||
Admin *bool `validate:"-" bun:",nullzero,notnull,default:false"` // Is this user an admin?
|
||||
Disabled *bool `validate:"-" bun:",nullzero,notnull,default:false"` // Is this user disabled from posting?
|
||||
Approved *bool `validate:"-" bun:",nullzero,notnull,default:false"` // Has this user been approved by a moderator?
|
||||
ResetPasswordToken string `validate:"required_with=ResetPasswordSentAt" bun:",nullzero"` // The generated token that the user can use to reset their password
|
||||
ResetPasswordSentAt time.Time `validate:"required_with=ResetPasswordToken" bun:"type:timestamptz,nullzero"` // When did we email the user their reset-password email?
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue