diff options
author | 2021-08-25 15:34:33 +0200 | |
---|---|---|
committer | 2021-08-25 15:34:33 +0200 | |
commit | 2dc9fc1626507bb54417fc4a1920b847cafb27a2 (patch) | |
tree | 4ddeac479b923db38090aac8bd9209f3646851c1 /internal/gtsmodel/mediaattachment.go | |
parent | Manually approves followers (#146) (diff) | |
download | gotosocial-2dc9fc1626507bb54417fc4a1920b847cafb27a2.tar.xz |
Pg to bun (#148)
* start moving to bun
* changing more stuff
* more
* and yet more
* tests passing
* seems stable now
* more big changes
* small fix
* little fixes
Diffstat (limited to 'internal/gtsmodel/mediaattachment.go')
-rw-r--r-- | internal/gtsmodel/mediaattachment.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/internal/gtsmodel/mediaattachment.go b/internal/gtsmodel/mediaattachment.go index 0f12caaad..b767e538c 100644 --- a/internal/gtsmodel/mediaattachment.go +++ b/internal/gtsmodel/mediaattachment.go @@ -26,28 +26,28 @@ import ( // somewhere in storage and that can be retrieved and served by the router. type MediaAttachment struct { // ID of the attachment in the database - ID string `pg:"type:CHAR(26),pk,notnull,unique"` + ID string `bun:"type:CHAR(26),pk,notnull,unique"` // ID of the status to which this is attached - StatusID string `pg:"type:CHAR(26)"` + StatusID string `bun:"type:CHAR(26),nullzero"` // Where can the attachment be retrieved on *this* server URL string // Where can the attachment be retrieved on a remote server (empty for local media) RemoteURL string // When was the attachment created - CreatedAt time.Time `pg:"type:timestamp,notnull,default:now()"` + CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` // When was the attachment last updated - UpdatedAt time.Time `pg:"type:timestamp,notnull,default:now()"` + UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` // Type of file (image/gif/audio/video) - Type FileType `pg:",notnull"` + Type FileType `bun:",notnull"` // Metadata about the file FileMeta FileMeta // To which account does this attachment belong - AccountID string `pg:"type:CHAR(26),notnull"` - Account *Account `pg:"rel:belongs-to"` + AccountID string `bun:"type:CHAR(26),notnull"` + Account *Account `bun:"rel:has-one"` // Description of the attachment (for screenreaders) Description string // To which scheduled status does this attachment belong - ScheduledStatusID string `pg:"type:CHAR(26)"` + ScheduledStatusID string `bun:"type:CHAR(26),nullzero"` // What is the generated blurhash of this attachment Blurhash string // What is the processing status of this attachment @@ -71,7 +71,7 @@ type File struct { // What is the size of the file in bytes. FileSize int // When was the file last updated. - UpdatedAt time.Time `pg:"type:timestamp,notnull,default:now()"` + UpdatedAt time.Time `bun:"type:timestamp,notnull,default:current_timestamp"` } // Thumbnail refers to a small image thumbnail derived from a larger image, video, or audio file. @@ -83,7 +83,7 @@ type Thumbnail struct { // What is the size of the file in bytes FileSize int // When was the file last updated - UpdatedAt time.Time `pg:"type:timestamp,notnull,default:now()"` + UpdatedAt time.Time `bun:"type:timestamp,notnull,default:current_timestamp"` // What is the URL of the thumbnail on the local server URL string // What is the remote URL of the thumbnail (empty for local media) |