track topic update history
[websub-hub] / src / db / postgres / sql / schema / 1.0.3 / apply.sql
1 BEGIN;
2 -- Track all content updates over time.
3 CREATE TABLE topic_content_history (
4 topic_id UUID NOT NULL REFERENCES topic(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
5 content_updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
6 content_size INTEGER NOT NULL,
7 content_hash TEXT NOT NULL
8 );
9 CREATE INDEX topic_content_history_topic_id_idx ON topic_content_history(topic_id);
10 CREATE INDEX topic_content_history_content_updated_idx ON topic_content_history(content_updated);
11
12 INSERT INTO _meta_schema_version (major, minor, patch) VALUES (1, 0, 3);
13 COMMIT;