mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 04:52:24 -05:00
[chore] replace statuses.updated_at column with statuses.edited_at (#3636)
* update statuses table to replace updated_at column with edited_at * code comment * better code comments, fix setting of status + edit + mention + poll database times * fix log to logf call * fix status.EditIDs not being carried over in dereferencer.encrichStatus() * move status.EditID setting into handleStatusEdit()
This commit is contained in:
parent
e9bb7ddd3a
commit
c013892ca2
23 changed files with 417 additions and 118 deletions
|
|
@ -28,7 +28,7 @@ import (
|
|||
type Status struct {
|
||||
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
|
||||
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
|
||||
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
|
||||
EditedAt time.Time `bun:"type:timestamptz,nullzero"` // when this status was last edited (if set)
|
||||
FetchedAt time.Time `bun:"type:timestamptz,nullzero"` // when was item (remote) last fetched.
|
||||
PinnedAt time.Time `bun:"type:timestamptz,nullzero"` // Status was pinned by owning account at this time.
|
||||
URI string `bun:",unique,nullzero,notnull"` // activitypub URI of this status
|
||||
|
|
@ -299,6 +299,15 @@ func (s *Status) AllAttachmentIDs() []string {
|
|||
return xslices.Deduplicate(attachmentIDs)
|
||||
}
|
||||
|
||||
// UpdatedAt returns latest time this status
|
||||
// was updated, either EditedAt or CreatedAt.
|
||||
func (s *Status) UpdatedAt() time.Time {
|
||||
if s.EditedAt.IsZero() {
|
||||
return s.CreatedAt
|
||||
}
|
||||
return s.EditedAt
|
||||
}
|
||||
|
||||
// StatusToTag is an intermediate struct to facilitate the many2many relationship between a status and one or more tags.
|
||||
type StatusToTag struct {
|
||||
StatusID string `bun:"type:CHAR(26),unique:statustag,nullzero,notnull"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue