ensure ,notnull,nullzero on all columns with default values

Signed-off-by: kim (grufwub) <grufwub@gmail.com>
This commit is contained in:
kim (grufwub) 2021-08-26 20:11:15 +01:00
commit 77a578528f
8 changed files with 19 additions and 19 deletions

View file

@ -78,15 +78,15 @@ type Account struct {
*/
// Does this account need an approval for new followers?
Locked bool `bun:",default:true"`
Locked bool `bun:",nullzero,notnull,default:true"`
// Should this account be shown in the instance's profile directory?
Discoverable bool `bun:",default:false"`
Discoverable bool `bun:",nullzero,notnull,default:false"`
// Default post privacy for this account
Privacy Visibility `bun:",default:'public'"`
Privacy Visibility `bun:",nullzero,notnull,default:'public'"`
// Set posts from this account to sensitive by default?
Sensitive bool `bun:",default:false"`
Sensitive bool `bun:",nullzero,notnull,default:false"`
// What language does this account post in?
Language string `bun:",default:'en'"`
Language string `bun:",nullzero,notnull,default:'en'"`
/*
ACTIVITYPUB THINGS

View file

@ -28,7 +28,7 @@ type Emoji struct {
// eg., 'blob_hug' 'purple_heart' Must be unique with domain.
Shortcode string `bun:",notnull,unique:shortcodedomain"`
// Origin domain of this emoji, eg 'example.org', 'queer.party'. empty string for local emojis.
Domain string `bun:",notnull,default:'',unique:shortcodedomain"`
Domain string `bun:",nullzero,notnull,default:'',unique:shortcodedomain"`
// When was this emoji created. Must be unique with shortcode.
CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
// When was this emoji updated
@ -67,11 +67,11 @@ type Emoji struct {
// When was the emoji image last updated?
ImageUpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
// Has a moderation action disabled this emoji from being shown?
Disabled bool `bun:",notnull,default:false"`
Disabled bool `bun:",nullzero,notnull,default:false"`
// ActivityStreams uri of this emoji. Something like 'https://example.org/emojis/1234'
URI string `bun:",notnull,unique"`
// Is this emoji visible in the admin emoji picker?
VisibleInPicker bool `bun:",notnull,default:true"`
VisibleInPicker bool `bun:",nullzero,notnull,default:true"`
// In which emoji category is this emoji visible?
CategoryID string `bun:"type:CHAR(26),nullzero"`
}

View file

@ -35,7 +35,7 @@ type Follow struct {
TargetAccountID string `bun:"type:CHAR(26),unique:srctarget,notnull"`
TargetAccount *Account `bun:"rel:belongs-to"`
// Does this follow also want to see reblogs and not just posts?
ShowReblogs bool `bun:"default:true"`
ShowReblogs bool `bun:",nullzero,notnull,default:true"`
// What is the activitypub URI of this follow?
URI string `bun:",unique,nullzero"`
// does the following account want to be notified when the followed account posts?

View file

@ -35,7 +35,7 @@ type FollowRequest struct {
TargetAccountID string `bun:"type:CHAR(26),unique:frsrctarget,notnull"`
TargetAccount *Account `bun:"rel:belongs-to"`
// Does this follow also want to see reblogs and not just posts?
ShowReblogs bool `bun:"default:true"`
ShowReblogs bool `bun:",nullzero,notnull,default:true"`
// What is the activitypub URI of this follow request?
URI string `bun:",unique,nullzero"`
// does the following account want to be notified when the followed account posts?

View file

@ -35,7 +35,7 @@ type Instance struct {
ContactAccountID string `bun:"type:CHAR(26),nullzero"`
ContactAccount *Account `bun:"rel:belongs-to"`
// Reputation score of this instance
Reputation int64 `bun:",notnull,default:0"`
Reputation int64 `bun:",nullzero,notnull,default:0"`
// Version of the software used on this instance
Version string `bun:",nullzero"`
}

View file

@ -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 `bun:",notnull,default:current_timestamp"`
UpdatedAt time.Time `bun:",nullzero,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 `bun:",notnull,default:current_timestamp"`
UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
// What is the URL of the thumbnail on the local server
URL string `bun:",nullzero"`
// What is the remote URL of the thumbnail (empty for local media)

View file

@ -138,11 +138,11 @@ const (
// If DIRECT is selected, boostable will be FALSE, and all other flags will be TRUE.
type VisibilityAdvanced struct {
// This status will be federated beyond the local timeline(s)
Federated bool `bun:"default:true"`
Federated bool `bun:",nullzero,notnull,default:true"`
// This status can be boosted/reblogged
Boostable bool `bun:"default:true"`
Boostable bool `bun:",nullzero,notnull,default:true"`
// This status can be replied to
Replyable bool `bun:"default:true"`
Replyable bool `bun:",nullzero,notnull,default:true"`
// This status can be liked/faved
Likeable bool `bun:"default:true"`
Likeable bool `bun:",nullzero,notnull,default:true"`
}

View file

@ -35,9 +35,9 @@ type Tag struct {
// when was this tag last updated
UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
// can our instance users use this tag?
Useable bool `bun:",notnull,default:true"`
Useable bool `bun:",nullzero,notnull,default:true"`
// can our instance users look up this tag?
Listable bool `bun:",notnull,default:true"`
Listable bool `bun:",nullzero,notnull,default:true"`
// when was this tag last used?
LastStatusAt time.Time `bun:",nullzero"`
}