[PR #27] Remove machine_id from SSH config #31

Open
opened 2026-02-28 01:18:06 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/therealpaulgg/ssh-sync-server/pull/27
Author: @Copilot
Created: 5/22/2025
Status: 🔄 Open

Base: mainHead: copilot/fix-23


📝 Commits (7)

  • 40283be Initial plan for issue
  • f948a3c Remove machine_id reference from SSH config in DeleteMachine
  • 9231adc Add tests for DeleteMachine function
  • 5227a84 Fix test implementation for DeleteMachine
  • 116f23f Add proper tests for DeleteMachine function
  • 2d71d79 Improve tests for DeleteMachine function
  • efc5039 Add proper tests for DeleteMachine function

📊 Changes

5 files changed (+442 additions, -6 deletions)

View changed files

📝 go.mod (+11 -1)
📝 go.sum (+147 -0)
pkg/database/mocks/pgx_mock.go (+118 -0)
📝 pkg/database/repository/machine.go (+1 -4)
📝 pkg/database/repository/machine_test.go (+165 -1)

📄 Description

This PR removes the unnecessary reference to machine_id in SSH config that was causing data problems.

Changes

The issue was in the DeleteMachine function where it was trying to delete SSH configs associated with a machine ID:

// Before
if _, err := tx.Exec(context.TODO(), "delete from ssh_configs where machine_id = $1", id); err != nil {
    return err
}

As stated in the issue, this was unnecessary and causing data problems. The fix simply removes this SQL query while keeping the core functionality intact.

The SshConfig model doesn't have a machine_id field, and no other code relies on this relationship, confirming that this reference was problematic and should be removed.

After this change, deleting a machine no longer attempts to delete SSH configs based on machine_id.

Fixes #23.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/therealpaulgg/ssh-sync-server/pull/27 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 5/22/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `copilot/fix-23` --- ### 📝 Commits (7) - [`40283be`](https://github.com/therealpaulgg/ssh-sync-server/commit/40283be7a8e876b67a15214d9b0fda40827887d2) Initial plan for issue - [`f948a3c`](https://github.com/therealpaulgg/ssh-sync-server/commit/f948a3c8e0c7de9d41462e8c911d8bd63f7a25a8) Remove machine_id reference from SSH config in DeleteMachine - [`9231adc`](https://github.com/therealpaulgg/ssh-sync-server/commit/9231adcf4347074e673c5ea77e0ef460bea07a6b) Add tests for DeleteMachine function - [`5227a84`](https://github.com/therealpaulgg/ssh-sync-server/commit/5227a84100ef1e7b5e39d7d4362f9f64a4ac6163) Fix test implementation for DeleteMachine - [`116f23f`](https://github.com/therealpaulgg/ssh-sync-server/commit/116f23feccf7b374bcf9377eec8d55806b6e34e6) Add proper tests for DeleteMachine function - [`2d71d79`](https://github.com/therealpaulgg/ssh-sync-server/commit/2d71d79f976fe5235cd01272faaa751261372123) Improve tests for DeleteMachine function - [`efc5039`](https://github.com/therealpaulgg/ssh-sync-server/commit/efc50397d54d1fea955c684f4015b9f472fa994c) Add proper tests for DeleteMachine function ### 📊 Changes **5 files changed** (+442 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `go.mod` (+11 -1) 📝 `go.sum` (+147 -0) ➕ `pkg/database/mocks/pgx_mock.go` (+118 -0) 📝 `pkg/database/repository/machine.go` (+1 -4) 📝 `pkg/database/repository/machine_test.go` (+165 -1) </details> ### 📄 Description This PR removes the unnecessary reference to `machine_id` in SSH config that was causing data problems. ## Changes The issue was in the `DeleteMachine` function where it was trying to delete SSH configs associated with a machine ID: ```go // Before if _, err := tx.Exec(context.TODO(), "delete from ssh_configs where machine_id = $1", id); err != nil { return err } ``` As stated in the issue, this was unnecessary and causing data problems. The fix simply removes this SQL query while keeping the core functionality intact. The SshConfig model doesn't have a machine_id field, and no other code relies on this relationship, confirming that this reference was problematic and should be removed. After this change, deleting a machine no longer attempts to delete SSH configs based on machine_id. Fixes #23. --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ssh-sync-server#31
No description provided.