ZeroTierOne/ext/central-controller-docker/migrations/0005_controller_log.up.sql
Grant Limberg cb2de5aae1
Some checks failed
/ build_macos (push) Has been cancelled
/ build_windows (push) Has been cancelled
/ Central Controller Build (push) Has been cancelled
/ build_ubuntu (push) Has been cancelled
/ multi-arch-docker (push) Has been cancelled
fix migration
2025-09-13 10:29:45 -07:00

19 lines
894 B
SQL

CREATE TABLE IF NOT EXISTS controller_log (
controller_id CHAR(10) NOT NULL REFERENCES controllers_ctl(id) ON DELETE CASCADE,
check_time TIMESTAMP WITH TIME ZONE NOT NULL,
load_factor REAL,
PRIMARY KEY (controller_id, check_time)
);
CREATE INDEX IF NOT EXISTS ctl_check_time_ix ON public.controller_log USING btree (check_time);
CREATE INDEX IF NOT EXISTS ctl_id_ix ON public.controller_log USING btree (controller_id);
CREATE TABLE IF NOT EXISTS sso_expiry (
nonce TEXT PRIMARY KEY,
nonce_expiration TIMESTAMP WITH TIME ZONE NOT NULL,
network_id CHARACTER(16) NOT NULL,
member_id CHARACTER(10) NOT NULL,
creation_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT (current_timestamp AT TIME ZONE 'UTC'),
email TEXT,
authentication_expiry_time TIMESTAMP WITH TIME ZONE,
FOREIGN KEY (network_id, member_id) REFERENCES network_memberships_ctl(network_id, device_id) ON DELETE CASCADE
);