Make server tests also run against postgres

This commit is contained in:
binwiederhier
2026-02-19 20:48:01 -05:00
parent 939b3d1117
commit 9e4a48b058
10 changed files with 5379 additions and 4830 deletions

View File

@@ -26,12 +26,13 @@ type Store interface {
AddMessage(m *model.Message) error
AddMessages(ms []*model.Message) error
DB() *sql.DB
Message(id string) (*model.Message, error)
MessageCounts() (map[string]int, error)
Messages(topic string, since model.SinceMarker, scheduled bool) ([]*model.Message, error)
MessagesDue() ([]*model.Message, error)
MessagesExpired() ([]string, error)
Message(id string) (*model.Message, error)
MarkPublished(m *model.Message) error
MessageCounts() (map[string]int, error)
UpdateMessageTime(messageID string, timestamp int64) error
Topics() ([]string, error)
DeleteMessages(ids ...string) error
DeleteScheduledBySequenceID(topic, sequenceID string) ([]string, error)
@@ -71,6 +72,7 @@ type storeQueries struct {
selectAttachmentsSizeByUserID string
selectStats string
updateStats string
updateMessageTime string
}
// commonStore implements store operations that are identical across database backends
@@ -302,6 +304,12 @@ func (c *commonStore) Message(id string) (*model.Message, error) {
return readMessage(rows)
}
// UpdateMessageTime updates the time column for a message by ID. This is only used for testing.
func (c *commonStore) UpdateMessageTime(messageID string, timestamp int64) error {
_, err := c.db.Exec(c.queries.updateMessageTime, timestamp, messageID)
return err
}
func (c *commonStore) MarkPublished(m *model.Message) error {
c.mu.Lock()
defer c.mu.Unlock()