Enhance Docker Compose setup by adding initialization services for PostgreSQL and NATS, improving JetStream configuration, and updating the Taskfile to use Docker Compose instead of Podman. Modify database schema to enforce unique constraints on (uuid, received_at) for telegrams and telegrams_raw tables.

This commit is contained in:
windyboy
2025-11-15 14:24:11 +08:00
parent 184c5453fb
commit cdb0cea8f7
5 changed files with 103 additions and 25 deletions
+2 -4
View File
@@ -20,8 +20,7 @@ CREATE TABLE aviation.telegrams (
parsed_at TIMESTAMPTZ,
dispatched_at TIMESTAMPTZ,
need_dispatch BOOLEAN,
PRIMARY KEY (uuid, received_at),
CONSTRAINT telegrams_uuid_unique UNIQUE (uuid)
PRIMARY KEY (uuid, received_at)
);
SELECT create_hypertable('aviation.telegrams', 'received_at', if_not_exists => TRUE);
@@ -41,6 +40,5 @@ CREATE TABLE IF NOT EXISTS aviation.telegrams_raw (
content TEXT NOT NULL,
received_at TIMESTAMPTZ NOT NULL,
metadata JSONB,
PRIMARY KEY (uuid, received_at),
CONSTRAINT telegrams_raw_uuid_unique UNIQUE (uuid)
PRIMARY KEY (uuid, received_at)
);