Compare commits

...
6 Commits
Author SHA1 Message Date
Dustin Pianalto faf64a8bf9 Add message to end of list with count
CI / build (push) Has been cancelled
2021-02-22 22:03:06 -09:00
Dustin Pianalto 2abe574977 Update database schema to not allow null previous_content
CI / build (push) Has been cancelled
2021-02-22 21:56:18 -09:00
Dustin Pianalto 04c32955c7 Update database schema to not allow null previous_content
CI / build (push) Has been cancelled
2021-02-22 21:29:41 -09:00
Dustin Pianalto 1f70318d26 Update database schema to not allow null previous_content
CI / build (push) Has been cancelled
2021-02-22 21:24:55 -09:00
Dustin Pianalto 47ed519376 Update database schema to not allow null previous_content
CI / build (push) Has been cancelled
2021-02-22 21:16:28 -09:00
Dustin Pianalto 22912c7367 Fix broken SQL query
CI / build (push) Has been cancelled
2021-02-22 20:13:29 -09:00
4 changed files with 17 additions and 2 deletions
+3
View File
@@ -9,6 +9,7 @@ import (
"github.com/dustinpianalto/disgoman" "github.com/dustinpianalto/disgoman"
"github.com/dustinpianalto/geeksbot" "github.com/dustinpianalto/geeksbot"
"github.com/dustinpianalto/geeksbot/internal/discord_utils" "github.com/dustinpianalto/geeksbot/internal/discord_utils"
"github.com/dustinpianalto/geeksbot/internal/utils"
"github.com/dustinpianalto/geeksbot/pkg/services" "github.com/dustinpianalto/geeksbot/pkg/services"
) )
@@ -247,4 +248,6 @@ func listCommandFunc(ctx disgoman.Context, args []string) {
channelName, channelName,
)) ))
} }
_, _ = ctx.Send(fmt.Sprintf("There are currently %d open %s", len(requests), utils.PluralizeString("request", len(requests))))
} }
@@ -0,0 +1,6 @@
BEGIN;
ALTER TABLE messages
ALTER COLUMN previous_content DROP NOT NULL;
ALTER TABLE messages
ALTER COLUMN previous_content DROP DEFAULT;
COMMIT;
@@ -0,0 +1,6 @@
BEGIN;
ALTER TABLE messages
ALTER COLUMN previous_content SET NOT NULL;
ALTER TABLE messages
ALTER COLUMN previous_content SET DEFAULT array[]::varchar[];
COMMIT;
+2 -2
View File
@@ -19,7 +19,7 @@ func (s requestService) Request(id int64) (geeksbot.Request, error) {
var uID sql.NullString var uID sql.NullString
var mID string var mID string
queryString := `SELECT id, author_id, channel_id, guild_id, content, requested_at, completed, queryString := `SELECT id, author_id, channel_id, guild_id, content, requested_at, completed,
completed_at, completed_by, message_id, completed_message completed_at, completed_by, message_id, completed_message FROM requests
WHERE id = $1` WHERE id = $1`
row := s.db.QueryRow(queryString, id) row := s.db.QueryRow(queryString, id)
err := row.Scan(&r.ID, &aID, &cID, &gID, &r.Content, &r.RequestedAt, &r.Completed, err := row.Scan(&r.ID, &aID, &cID, &gID, &r.Content, &r.RequestedAt, &r.Completed,
@@ -168,7 +168,7 @@ func (s requestService) Comment(id int64) (geeksbot.Comment, error) {
var c geeksbot.Comment var c geeksbot.Comment
var aID string var aID string
var rID int64 var rID int64
queryString := "SELECT id, author_id, request_id, comment_at, content WHERE id = $1" queryString := "SELECT id, author_id, request_id, comment_at, content FROM comments WHERE id = $1"
row := s.db.QueryRow(queryString, id) row := s.db.QueryRow(queryString, id)
err := row.Scan(&c.ID, &aID, &rID, &c.CommentAt, &c.Content) err := row.Scan(&c.ID, &aID, &rID, &c.CommentAt, &c.Content)
if err != nil { if err != nil {