diff --git a/reddit/models/reddit_feeds.go b/reddit/models/reddit_feeds.go index 37b2e59623..f5e1885273 100644 --- a/reddit/models/reddit_feeds.go +++ b/reddit/models/reddit_feeds.go @@ -31,6 +31,7 @@ type RedditFeed struct { MinUpvotes int `boil:"min_upvotes" json:"min_upvotes" toml:"min_upvotes" yaml:"min_upvotes"` UseEmbeds bool `boil:"use_embeds" json:"use_embeds" toml:"use_embeds" yaml:"use_embeds"` Slow bool `boil:"slow" json:"slow" toml:"slow" yaml:"slow"` + Disabled bool `boil:"disabled" json:"disabled" toml:"disabled" yaml:"disabled"` R *redditFeedR `boil:"-" json:"-" toml:"-" yaml:"-"` L redditFeedL `boil:"-" json:"-" toml:"-" yaml:"-"` @@ -45,6 +46,7 @@ var RedditFeedColumns = struct { MinUpvotes string UseEmbeds string Slow string + Disabled string }{ ID: "id", GuildID: "guild_id", @@ -54,6 +56,7 @@ var RedditFeedColumns = struct { MinUpvotes: "min_upvotes", UseEmbeds: "use_embeds", Slow: "slow", + Disabled: "disabled", } // Generated where @@ -103,6 +106,7 @@ var RedditFeedWhere = struct { MinUpvotes whereHelperint UseEmbeds whereHelperbool Slow whereHelperbool + Disabled whereHelperbool }{ ID: whereHelperint64{field: `id`}, GuildID: whereHelperint64{field: `guild_id`}, @@ -112,6 +116,7 @@ var RedditFeedWhere = struct { MinUpvotes: whereHelperint{field: `min_upvotes`}, UseEmbeds: whereHelperbool{field: `use_embeds`}, Slow: whereHelperbool{field: `slow`}, + Disabled: whereHelperbool{field: `disabled`}, } // RedditFeedRels is where relationship names are stored. @@ -131,9 +136,9 @@ func (*redditFeedR) NewStruct() *redditFeedR { type redditFeedL struct{} var ( - redditFeedColumns = []string{"id", "guild_id", "channel_id", "subreddit", "filter_nsfw", "min_upvotes", "use_embeds", "slow"} + redditFeedColumns = []string{"id", "guild_id", "channel_id", "subreddit", "filter_nsfw", "min_upvotes", "use_embeds", "slow", "disabled"} redditFeedColumnsWithoutDefault = []string{"guild_id", "channel_id", "subreddit", "filter_nsfw", "min_upvotes", "use_embeds", "slow"} - redditFeedColumnsWithDefault = []string{"id"} + redditFeedColumnsWithDefault = []string{"id", "disabled"} redditFeedPrimaryKeyColumns = []string{"id"} ) diff --git a/reddit/models/reddit_feeds_test.go b/reddit/models/reddit_feeds_test.go index f93f74a262..20e683a95a 100644 --- a/reddit/models/reddit_feeds_test.go +++ b/reddit/models/reddit_feeds_test.go @@ -427,7 +427,7 @@ func testRedditFeedsSelect(t *testing.T) { } var ( - redditFeedDBTypes = map[string]string{`ID`: `bigint`, `GuildID`: `bigint`, `ChannelID`: `bigint`, `Subreddit`: `text`, `FilterNSFW`: `integer`, `MinUpvotes`: `integer`, `UseEmbeds`: `boolean`, `Slow`: `boolean`} + redditFeedDBTypes = map[string]string{`ID`: `bigint`, `GuildID`: `bigint`, `ChannelID`: `bigint`, `Subreddit`: `text`, `FilterNSFW`: `integer`, `MinUpvotes`: `integer`, `UseEmbeds`: `boolean`, `Slow`: `boolean`, `Disabled`: `boolean`} _ = bytes.MinRead ) diff --git a/reddit/schema.go b/reddit/schema.go index 4cbe9a2bee..0b843d08ca 100644 --- a/reddit/schema.go +++ b/reddit/schema.go @@ -18,4 +18,6 @@ CREATE TABLE IF NOT EXISTS reddit_feeds ( CREATE INDEX IF NOT EXISTS redidt_feeds_guild_idx ON reddit_feeds(guild_id); CREATE INDEX IF NOT EXISTS redidt_feeds_subreddit_idx ON reddit_feeds(subreddit); +ALTER TABLE reddit_feeds ADD COLUMN IF NOT EXISTS disabled BOOLEAN NOT NULL DEFAULT FALSE; + `