dosubot[bot] commented on issue #7615:
URL: 
https://github.com/apache/incubator-devlake/issues/7615#issuecomment-2166761295

   <!-- Greeting -->
   Hey @karthikbhat0307! I'm a bot designed to help you with bugs, questions, 
and becoming a contributor to the project. I'm here to assist you while you 
wait for a human maintainer.
   
   <!-- Answer -->
   To resolve the error "Unknown column 'connection_id' in 'where clause'" when 
trying to delete a PagerDuty connection, you need to ensure that the 
`connection_id` column exists in the `_tool_pagerduty_scope_configs` table in 
your database schema.
   
   The error occurs in the following part of the `deleteConnection` method in 
the `ConnectionApiHelper` class:
   
   ```go
   count := errors.Must1(c.db.Count(dal.From(scopeModel.TableName()), 
dal.Where("connection_id = ?", connectionId)))
   ```
   
   and
   
   ```go
   err = CallDB(c.db.Delete, scopeConfigModel, dal.Where("connection_id = ?", 
connectionId))
   ```
   
   These lines assume that the `connection_id` column exists in the 
`_tool_pagerduty_scope_configs` table. You need to verify that this table has 
the `connection_id` column. If it does not, you need to add the column to the 
table.
   
   Here is an example of how you might add the `connection_id` column to the 
`_tool_pagerduty_scope_configs` table in SQL:
   
   ```sql
   ALTER TABLE _tool_pagerduty_scope_configs ADD COLUMN connection_id BIGINT;
   ```
   
   Additionally, ensure that the `_tool_pagerduty_connections` table has the 
`connection_id` column as well. If not, you can add it using the following SQL 
command:
   
   ```sql
   ALTER TABLE _tool_pagerduty_connections ADD COLUMN connection_id BIGINT;
   ```
   
   If the `connection_id` column is already present, ensure that the column 
name is correctly spelled and matches the column name used in the `dal.Where` 
clause 
<sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/helpers/srvhelper/connection_service_helper.go)</sup><sup>[[2]](https://github.com/apache/incubator-devlake/blob/main/backend/helpers/pluginhelper/api/connection_helper.go)</sup><sup>[[3]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/pagerduty/models/connection.go)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@devlake.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to