Synchronization

The database can be used on multiple devices that are not connected to the internet and then synchronized when a connection becomes available.

Replica

The various copies of the database become distinct as soon as the first change is made on one of the devices. They are therefore no longer copies but replicas, each of which has undergone changes, additions, and deletions of data.

Synchronization folder

Replicas can propagate their data changes, additions, and deletions to other replicas via a synchronization folder, which can be:

  • A URL pointing to a folder on an FTPS server.
  • A folder on the local network or on a USB drive.

FADAcore does not provide a synchronization folder. It is up to you to provide one and specify it in the synchronization settings.

Synchronization Key


A fulid field (FADA Unique Line Identifier) is added to all tables in FADA applications.
This field contains a randomly generated unique identifier (64 bits). This field is read-only and allows rows from different replicas to be reconciled, even if their primary keys have been modified on some replicas.

Risk of Error

The fulid is always used in conjunction with the table name. For a table with 1 million rows (including deleted rows), the probability of having two unique identifiers is 1 in 37 million.

How It Works

During synchronization, all tables are compared row by row and field by field. If a value differs between the two replicas, the synchronization rules determine which value should be retained.

The default rule is Newer: the most recent value wins.

Example

Data is created on device A:

First synchronization (simple copy from the database to the synchronization folder):

Install the FADA app on Device B, along with a copy of the data:
Independent data changes on both devices:

Device A: Add a line and modify a field.
Device B: Delete a line.

Device A synchronizes:
Device B synchronizes (never exactly at the same time):
 

Synchronization Rules

Each field (column) has its own synchronization rule, defined by the FADA application. These rules cannot be modified by the application user.

The rule applicable to a field is displayed in the tooltip for the column header.

Concurrent Editing and Deletion

A row can be modified by A and deleted by B:
If the modification occurs after the deletion, the modification takes precedence:

The line deleted by B is recreated by A with its modification, regardless of the order of the synchronizations (A before or after B).

If the deletion occurs after the modification, the deletion takes precedence:

The line deleted by B is also deleted by A.