ALTER TABLE observations
    ADD COLUMN details JSON NULL;

ALTER TABLE timeline_events
    ADD COLUMN details JSON NULL;

CREATE TABLE IF NOT EXISTS asset_firmware_states (
    asset_id BIGINT NOT NULL,
    device_name VARCHAR(255) NOT NULL,
    firmware_version VARCHAR(255) NOT NULL,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (asset_id, device_name),
    CONSTRAINT fk_asset_firmware_states_asset
        FOREIGN KEY (asset_id) REFERENCES assets(id)
        ON DELETE CASCADE ON UPDATE CASCADE
);
