Multi-master replication can be easy with correct data structures.

As example:
CREATE TABLE test
(
  id INTEGER PRIMARY KEY ON CONFLICT REPLACE,
  cid INTEGER UNIQUE -- equal to test_record.id
);
CREATE TABLE test_record
(
  id INTEGER NOT NULL,          -- record version id
  rid INTEGER PRIMARY KEY,  -- equal to test.id - permanent record id
  rev INTEGER,                           -- record revision number
...
  FOREIGN KEY(id) REFERENCES test
);
CREATE VIEW view_test AS
  SELECT r.* FROM test as t, test_record as r WHERE t.cid=r.rid;

For multimaster replication is needed copy all un-exists "test_record"
rows from host A to host B and from B to A and then regenerate some
rows in "test" tables.

And Fossil is well-known example of SQLite database replication :D

-- 
Best regards, Alexey Pechnikov.
http://pechnikov.tel/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to