Skip to content

Commit

Permalink
bug fix: db error when deleting multiple ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Jul 3, 2018
1 parent 1b76314 commit cb64da9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,7 @@ A text-only [command line client](./tn-cli) implements every possible command.
<p align="center">
<kbd><img src="docs/web-mob-contacts-1.png" alt="Mobile web: contacts" width=323 /></kbd> <kbd><img src="docs/web-mob-chat-1.png" alt="Mobile web: chat" width=323 /></kbd> <kbd><img src="docs/web-mob-info-1.png" alt="Mobile web: topic info" width=323 /></kbd> <kbd><img src="docs/web-mob-new-chat-1.png" alt="Mobile web: start new 1:1 chat" width=323 /></kbd>
</p>

# SEO Strings (word 'chat' in Chinese, Russian, and Persian)

聊天室 чат گپ
2 changes: 1 addition & 1 deletion server/db/mysql/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ func (a *adapter) CreateDb(reset bool) error {
hi INT NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY(topic) REFERENCES topics(name),
UNIQUE INDEX dellog_topic_delid_deletedfor(topic,delid,deletedfor),
INDEX dellog_topic_delid_deletedfor(topic,delid,deletedfor),
INDEX dellog_topic_deletedfor_low_hi(topic,deletedfor,low,hi),
INDEX dellog_deletedfor(deletedfor)
);`); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion server/db/mysql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ CREATE TABLE dellog(
PRIMARY KEY(id),
FOREIGN KEY(topic) REFERENCES topics(name),
# For getting the list of deleted message ranges
UNIQUE INDEX dellog_topic_delid_deletedfor(topic,delid,deletedfor),
INDEX dellog_topic_delid_deletedfor(topic,delid,deletedfor),
# Used when getting not-yet-deleted messages(messages LEFT JOIN dellog)
INDEX dellog_topic_deletedfor_low_hi(topic,deletedfor,low,hi),
# Used when deleting a user
Expand Down
6 changes: 0 additions & 6 deletions server/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -1862,12 +1862,6 @@ func (t *Topic) replyDelMsg(sess *Session, del *MsgClientDel) error {

var err error

defer func() {
if err != nil {
log.Println("failed to delete message(s):", err)
}
}()

var ranges []types.Range
if len(del.DelSeq) == 0 {
err = errors.New("del.msg: no IDs to delete")
Expand Down
2 changes: 1 addition & 1 deletion tinode-db/gendb.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func genDb(reset bool, dbSource string, data *Data) {
log.Fatal("Failed to init DB: ", err)
}
} else {
log.Println("DB successfully initialized")
log.Println("Successfully initialized", store.GetAdapterName())

}
if data.Users == nil {
Expand Down

0 comments on commit cb64da9

Please sign in to comment.