[]
CREATE TABLE IF NOT EXISTS documents (
id TEXT PRIMARY KEY,
type TEXT NOT NULL,
version INTEGER NOT NULL,
snapshot_version INTEGER NOT NULL
);
CREATE TABLE IF NOT EXISTS operations (
doc_id TEXT NOT NULL,
version INTEGER NOT NULL,
operation TEXT NOT NULL,
PRIMARY KEY (doc_id, version),
FOREIGN KEY (doc_id) REFERENCES documents (id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS snapshot_fragments (
doc_id TEXT NOT NULL,
fragment_id TEXT NOT NULL,
data TEXT NOT NULL,
PRIMARY KEY (doc_id, fragment_id),
FOREIGN KEY (doc_id) REFERENCES documents (id) ON DELETE CASCADE
);
Table Name | Column Name | Data Type | Description |
---|---|---|---|
documents | id | TEXT | Unique identifier for the document |
version | INTEGER | Version number of the document | |
snapshotVersion | INTEGER | Snapshot version number | |
type | TEXT | Type of the document | |
ops | roomId | TEXT | Room ID |
version | INTEGER | Version of the operation | |
data | TEXT | Data related to the operation | |
fragments | roomId | TEXT | Room ID |
fragmentId | TEXT | Unique identifier for the fragment | |
data | TEXT | Data related to the fragment |