Add basic sync-token implementation

This commit is contained in:
Lennart
2024-07-28 17:49:15 +02:00
parent a0864d6eeb
commit 33539e8c7a
4 changed files with 121 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
CREATE TABLE calendars (
principal TEXT NOT NULL,
id TEXT NOT NULL,
synctoken INTEGER DEFAULT 0 NOT NULL,
displayname TEXT,
description TEXT,
'order' INT DEFAULT 0 NOT NULL,
@@ -21,3 +22,15 @@ CREATE TABLE events (
FOREIGN KEY (principal, cid) REFERENCES calendars(principal, id)
);
CREATE TABLE eventchangelog (
-- The actual sync token is the SQLite field 'ROWID'
principal TEXT NOT NULL,
cid TEXT NOT NULL,
uid TEXT NOT NULL,
operation INTEGER NOT NULL,
synctoken INTEGER DEFAULT 0 NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (principal, cid, created_at),
FOREIGN KEY (principal, cid) REFERENCES calendars(principal, id) ON DELETE CASCADE
)