|
@@ -30,6 +30,7 @@ const (
|
|
|
priority INT NOT NULL,
|
|
|
tags TEXT NOT NULL,
|
|
|
click TEXT NOT NULL,
|
|
|
+ icon TEXT NOT NULL,
|
|
|
actions TEXT NOT NULL,
|
|
|
attachment_name TEXT NOT NULL,
|
|
|
attachment_type TEXT NOT NULL,
|
|
@@ -38,45 +39,44 @@ const (
|
|
|
attachment_url TEXT NOT NULL,
|
|
|
sender TEXT NOT NULL,
|
|
|
encoding TEXT NOT NULL,
|
|
|
- published INT NOT NULL,
|
|
|
- icon TEXT NOT NULL
|
|
|
+ published INT NOT NULL
|
|
|
);
|
|
|
CREATE INDEX IF NOT EXISTS idx_mid ON messages (mid);
|
|
|
CREATE INDEX IF NOT EXISTS idx_topic ON messages (topic);
|
|
|
COMMIT;
|
|
|
`
|
|
|
insertMessageQuery = `
|
|
|
- INSERT INTO messages (mid, time, topic, message, title, priority, tags, click, actions, attachment_name, attachment_type, attachment_size, attachment_expires, attachment_url, sender, encoding, published, icon)
|
|
|
+ INSERT INTO messages (mid, time, topic, message, title, priority, tags, click, icon, actions, attachment_name, attachment_type, attachment_size, attachment_expires, attachment_url, sender, encoding, published)
|
|
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
|
`
|
|
|
pruneMessagesQuery = `DELETE FROM messages WHERE time < ? AND published = 1`
|
|
|
selectRowIDFromMessageID = `SELECT id FROM messages WHERE mid = ?` // Do not include topic, see #336 and TestServer_PollSinceID_MultipleTopics
|
|
|
selectMessagesSinceTimeQuery = `
|
|
|
- SELECT mid, time, topic, message, title, priority, tags, click, actions, attachment_name, attachment_type, attachment_size, attachment_expires, attachment_url, sender, encoding, icon
|
|
|
+ SELECT mid, time, topic, message, title, priority, tags, click, icon, actions, attachment_name, attachment_type, attachment_size, attachment_expires, attachment_url, sender, encoding
|
|
|
FROM messages
|
|
|
WHERE topic = ? AND time >= ? AND published = 1
|
|
|
ORDER BY time, id
|
|
|
`
|
|
|
selectMessagesSinceTimeIncludeScheduledQuery = `
|
|
|
- SELECT mid, time, topic, message, title, priority, tags, click, actions, attachment_name, attachment_type, attachment_size, attachment_expires, attachment_url, sender, encoding, icon
|
|
|
+ SELECT mid, time, topic, message, title, priority, tags, click, icon, actions, attachment_name, attachment_type, attachment_size, attachment_expires, attachment_url, sender, encoding
|
|
|
FROM messages
|
|
|
WHERE topic = ? AND time >= ?
|
|
|
ORDER BY time, id
|
|
|
`
|
|
|
selectMessagesSinceIDQuery = `
|
|
|
- SELECT mid, time, topic, message, title, priority, tags, click, actions, attachment_name, attachment_type, attachment_size, attachment_expires, attachment_url, sender, encoding, icon
|
|
|
+ SELECT mid, time, topic, message, title, priority, tags, click, icon, actions, attachment_name, attachment_type, attachment_size, attachment_expires, attachment_url, sender, encoding
|
|
|
FROM messages
|
|
|
WHERE topic = ? AND id > ? AND published = 1
|
|
|
ORDER BY time, id
|
|
|
`
|
|
|
selectMessagesSinceIDIncludeScheduledQuery = `
|
|
|
- SELECT mid, time, topic, message, title, priority, tags, click, actions, attachment_name, attachment_type, attachment_size, attachment_expires, attachment_url, sender, encoding, icon
|
|
|
+ SELECT mid, time, topic, message, title, priority, tags, click, icon, actions, attachment_name, attachment_type, attachment_size, attachment_expires, attachment_url, sender, encoding
|
|
|
FROM messages
|
|
|
WHERE topic = ? AND (id > ? OR published = 0)
|
|
|
ORDER BY time, id
|
|
|
`
|
|
|
selectMessagesDueQuery = `
|
|
|
- SELECT mid, time, topic, message, title, priority, tags, click, actions, attachment_name, attachment_type, attachment_size, attachment_expires, attachment_url, sender, encoding, icon
|
|
|
+ SELECT mid, time, topic, message, title, priority, tags, click, icon, actions, attachment_name, attachment_type, attachment_size, attachment_expires, attachment_url, sender, encoding
|
|
|
FROM messages
|
|
|
WHERE time <= ? AND published = 0
|
|
|
ORDER BY time, id
|
|
@@ -272,6 +272,7 @@ func (c *messageCache) addMessages(ms []*message) error {
|
|
|
m.Priority,
|
|
|
tags,
|
|
|
m.Click,
|
|
|
+ m.Icon,
|
|
|
actionsStr,
|
|
|
attachmentName,
|
|
|
attachmentType,
|
|
@@ -281,7 +282,6 @@ func (c *messageCache) addMessages(ms []*message) error {
|
|
|
m.Sender,
|
|
|
m.Encoding,
|
|
|
published,
|
|
|
- m.Icon,
|
|
|
)
|
|
|
if err != nil {
|
|
|
return err
|
|
@@ -421,7 +421,7 @@ func readMessages(rows *sql.Rows) ([]*message, error) {
|
|
|
for rows.Next() {
|
|
|
var timestamp, attachmentSize, attachmentExpires int64
|
|
|
var priority int
|
|
|
- var id, topic, msg, title, tagsStr, click, actionsStr, attachmentName, attachmentType, attachmentURL, sender, encoding, icon string
|
|
|
+ var id, topic, msg, title, tagsStr, click, icon, actionsStr, attachmentName, attachmentType, attachmentURL, sender, encoding string
|
|
|
err := rows.Scan(
|
|
|
&id,
|
|
|
×tamp,
|
|
@@ -431,6 +431,7 @@ func readMessages(rows *sql.Rows) ([]*message, error) {
|
|
|
&priority,
|
|
|
&tagsStr,
|
|
|
&click,
|
|
|
+ &icon,
|
|
|
&actionsStr,
|
|
|
&attachmentName,
|
|
|
&attachmentType,
|
|
@@ -439,7 +440,6 @@ func readMessages(rows *sql.Rows) ([]*message, error) {
|
|
|
&attachmentURL,
|
|
|
&sender,
|
|
|
&encoding,
|
|
|
- &icon,
|
|
|
)
|
|
|
if err != nil {
|
|
|
return nil, err
|