Skip to content

Instantly share code, notes, and snippets.

@jbis9051
Last active September 22, 2019 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbis9051/db3c14b77b5ba132653ad9cd19415c1c to your computer and use it in GitHub Desktop.
Save jbis9051/db3c14b77b5ba132653ad9cd19415c1c to your computer and use it in GitHub Desktop.
db.all('SELECT `chat`.`chat_identifier`,`chat`.`ROWID`,`chat`.`service_name` FROM `chat`').then(chats => {
chats.forEach(chat => {
db.all(`SELECT message.text,message.\`is_from_me\`,message.service,message.date FROM chat_message_join INNER JOIN message ON chat_message_join.message_id = message.ROWID WHERE chat_message_join.chat_id = ${chat.ROWID} ORDER BY message.date ASC`).then(messages => {
addThread(chat.chat_identifier, chat.ROWID, chat.service_name, messages)
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment