mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 21:42:26 +00:00
split store and store_sqlite implementatio into multiple crates
This commit is contained in:
37
crates/store_sqlite/migrations/1_init.sql
Normal file
37
crates/store_sqlite/migrations/1_init.sql
Normal file
@@ -0,0 +1,37 @@
|
||||
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,
|
||||
color TEXT,
|
||||
timezone TEXT NOT NULL,
|
||||
deleted_at DATETIME,
|
||||
PRIMARY KEY (principal, id)
|
||||
);
|
||||
|
||||
CREATE TABLE calendarobjects (
|
||||
principal TEXT NOT NULL,
|
||||
cal_id TEXT NOT NULL,
|
||||
id TEXT NOT NULL,
|
||||
ics TEXT NOT NULL,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at DATETIME,
|
||||
PRIMARY KEY (principal, cal_id, id),
|
||||
FOREIGN KEY (principal, cal_id)
|
||||
REFERENCES calendars (principal, id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE calendarobjectchangelog (
|
||||
-- The actual sync token is the SQLite field 'ROWID'
|
||||
principal TEXT NOT NULL,
|
||||
cal_id TEXT NOT NULL,
|
||||
object_id TEXT NOT NULL,
|
||||
operation INTEGER NOT NULL,
|
||||
synctoken INTEGER DEFAULT 0 NOT NULL,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (principal, cal_id, created_at),
|
||||
FOREIGN KEY (principal, cal_id)
|
||||
REFERENCES calendars (principal, id) ON DELETE CASCADE
|
||||
);
|
||||
Reference in New Issue
Block a user