Data Prerequisites
The data that Asyncher must process obviously needs some more information to be able to synchronize it. In addition to having its attributes, the data must have additional fields that are needed to perform the synchronization.
The choice of the names of the fields that I am about to list is totally free. See the configuration here.
Client & Server Side
unique: string
: In general your data will need a field that uniquely identifies the data itself.
An incremental ID cannot be used as a unique key, because the data in the database on the server will have a different ID from the database on the client.
Client Side
is_new: boolean
: The data arriving from the client is actually new and must be added to the server.updated: boolean
: The data arriving from the client has been edited and must be updated on the server.deleted: boolean
: The data has been deleted on the client and must also be deleted on the server.
If you need not directly delete the data on the server but would like to have a trash bin or simply a history of all your data, see auditing.
These fields are managed directly by you. So if any of your data is edited you will have to set the updated
attribute to true
before synchronizing. As well as for is_new
and deleted
.
Server side
The data on the database server doesn't need any particular fields. However, there are optional fields that can be configured.
Example
Let's take an example. The data we want to synchronize has 3 fields (id, name, surname)
. The data model on the server and client will be:
Data model client side | Data model server side |
---|---|
id | id |
name | name |
surname | surname |
unique | unique |
is_new | |
updated | |
deleted |
Last updated