cr-sqlite allows merging of databases by using conflit-free replicated data types.

The big idea is that you define a table then say which CRDTs should be used to model it.

Notional example (as a custom syntax for crdts):

CREATE CLSet post (
 views COUNTER,
 content PERITEXT,
 owner_id LWW INTEGER

Table CRDTs

Tables can be thought of as a set of rows where the identity of each row is its primary key. When converting a table to a crr, you can specify the semantics of how that set of rows should be merged.

cr-sqlite supports modeling tables as:

  1. Delete Wins Sets
  2. Causal Length Sets (sets where deleted items can later be re-inserted)
  3. Grow Only Sets (sets that can never be removed from)

See Table CRDTs.

Row & Column CRDTs

A row can be thought of as a map. The keys of that map are the column names. The values are the column values for that row.

When defining a table, each column can be assigned a CRDT type. The following CRDTs are supported:

  1. Last Write Wins Register
  2. Distributed Fractional Index
  3. Counter

See Column CRDTs.

Sequence, Tree & Recursive CRDTs

These more exotic types are useful for collaborative text documents and don't have simple mapping to rows and tables.

  1. RGA
  2. Non-interleaved fractional index

See Sequence CRDTs.