SQLite and MySQL Synchronization

7

I have an application in which I have a database using SQLite and an external service using MySQL. Basically it is a task application, in which I can create a task in offline mode . When the user owns internet it will already automatically send to MySQL.

I have to do the synchronization treatment and I can not resolve this.

USER 1

  • Create a task
  • Synchronize the task with external bank

USER 2

  • Check for foreign bank jobs
  • Synchronize tasks

Problem

After user 2 completes his / her task, he / she must synchronize again with MySQL, and then user 1 (USER 1) must also receive this update in his / her database.

In the simplest possible way, the tables would be:

tbl_task in SQLite

  • internal_id ----------- (unique identifier for internal control)
  • task_name ---------- (task name)
  • status --------------- (status of completion of the pending / done task)
  • user_id ----------- (user who will perform the task)
  • author_id ------------- (user creating the task)
  • external_id ----------- (external identifier if you have already synched)

tbl_task in MySQL

  • id ------------------- (unique identifier)
  • task_name ---------- (name of the task to be performed)
  • status --------------- (status of completion of the pending / done task)
  • user_id ----------- (user who will perform the task)
  • author_id ------------- (user creating the task)

My initial idea would be to create a column in the table with the name SYNC , in which I would have control if it was synchronized or not. But after USER 2 finishes a task, how will USER 1 verify this?

    
asked by anonymous 05.12.2016 / 14:06

1 answer

1

You can create a scheduled task in the App to perform the query in the database and check for new users.

There are two concepts here, one in which they all query the server to know if there was update of the data and a second where the server is the one who notifies everyone that the data has been updated. Both concepts have their advantages and disadvantages, the first one is easier to apply and the second brings more performance to the application. See for example Node.js and Firebase .

    
10.01.2017 / 15:01