astral-api/Astral.DAL/Migrations/2024-12-15.01-userPresence.sql

23 lines
803 B
MySQL
Raw Permalink Normal View History

2024-12-15 17:06:14 +01:00
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();