astral-api/Astral.DAL/Migrations/2024-12-15.01-userPresence.sql
Mike 81aa0ec1c0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
WIP heartbeat and user presence
2024-12-15 16:06:14 +00:00

22 lines
803 B
SQL

CREATE TABLE userPresence
(
id UUID PRIMARY KEY REFERENCES users (id) ON DELETE CASCADE,
createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
connected BOOL DEFAULT FALSE,
domainId UUID DEFAULT NULL,
placeId UUID DEFAULT NULL,
networkAddress TEXT DEFAULT NULL,
networkPort INT DEFAULT NULL,
nodeId UUID DEFAULT NULL,
availability SMALLINT DEFAULT NULL,
publicKey TEXT DEFAULT NULL,
path TEXT DEFAULT '',
lastHeartbeat TIMESTAMP DEFAULT NULL
);
CREATE TRIGGER userPresence_updated_at
BEFORE UPDATE
ON userPresence
FOR EACH ROW
EXECUTE PROCEDURE updated_at_timestamp();