
CREATE TABLE IF NOT EXISTS antennas (
    id BIGSERIAL PRIMARY KEY NOT NULL,
    name TEXT NOT NULL,
    ip TEXT NOT NULL UNIQUE,
    error TEXT
);


CREATE TABLE IF NOT EXISTS client_readings (
    id BIGSERIAL PRIMARY KEY NOT NULL,
    ip TEXT NOT NULL,
    mac TEXT NOT NULL,
    antenna_ip TEXT NOT NULL REFERENCES antennas(ip), 
    db_reading INTEGER NOT NULL,
    read_at TIMESTAMP NOT NULL DEFAULT NOW()
);
