mirror of
https://github.com/GothenburgBitFactory/taskchampion-sync-server.git
synced 2025-07-31 07:53:27 +02:00

This is built to be more robust than the SQLite storage, and to integrate with other applications. The idea is that for example a web application might interact with the same DB to create and delete clients as customers come and go.
17 lines
562 B
SQL
17 lines
562 B
SQL
CREATE TABLE clients (
|
|
client_id UUID PRIMARY KEY,
|
|
latest_version_id UUID default '00000000-0000-0000-0000-000000000000',
|
|
snapshot_version_id UUID,
|
|
versions_since_snapshot INTEGER,
|
|
snapshot_timestamp BIGINT,
|
|
snapshot BYTEA);
|
|
|
|
CREATE TABLE versions (
|
|
client_id UUID NOT NULL,
|
|
FOREIGN KEY(client_id) REFERENCES clients (client_id) ON DELETE CASCADE,
|
|
version_id UUID NOT NULL,
|
|
parent_version_id UUID,
|
|
history_segment BYTEA,
|
|
CONSTRAINT versions_pkey PRIMARY KEY (client_id, version_id)
|
|
);
|
|
CREATE INDEX versions_by_parent ON versions (parent_version_id);
|