PG::ForeignKeyViolation: ERROR: update or delete on table "gateway_ui_node_log_uploads" violates foreign key
An ActiveRecord::InvalidForeignKey occurred in gateways#destroy:
PG::ForeignKeyViolation: ERROR: update or delete on table "gateway_ui_node_log_uploads" violates foreign key constraint "ui_node_logs_gateway_ui_node_log_upload_id_fkey" on table "ui_node_logs"
DETAIL: Key (id)=(1791814) is still referenced from table "ui_node_logs".
app/controllers/gateways_controller.rb:40:in `destroy'
-------------------------------
Request:
-------------------------------
* URL : https://www.bikelink.org/gateways/58
* HTTP Method: DELETE
* IP address : 107.127.14.133
* Parameters : {"_method"=>"delete", "authenticity_token"=>"NqqjryrmhOHUT3VsHGhrVJuXmMu56wL/UMbbk2+KnyDaAujJieBL7SEwNi55Oam5gqFm7WutO4tCMTRsKQfcJw==", "controller"=>"gateways", "action"=>"destroy", "id"=>"58"}
* Timestamp : 2021-07-27 17:57:00 UTC
* Server : www-3.internal.bikelink.org
* Rails root : /var/www/bikelink
* Process: 31233
-------------------------------
Session:
-------------------------------
* session id: [FILTERED]
* data: {"session_id"=>"fd233a8f7ceda5ab72eed2767ae5fe59",
"warden.user.person.key"=>[[24632], "u22ZsZ7VK1HZ6er12Usf"],
"_csrf_token"=>"uxNURTTNMZbZ8EJBQqpv5klcBfoB28HhS1ZFliJKZ8w="}
-
-------------------------------
Backtrace:
-------------------------------
app/controllers/gateways_controller.rb:40:in `destroy'
Reload