Merge pull request #2080 from ArianPashae/fix/drop-legacy-outbound-tables

fix(db): drop obsolete legacy outbound tables to prevent foreign key constraint failed (787) on node deletion
This commit is contained in:
Markson Hon authored and GitHub committed 2026-10-09 19:56:54 +08:00
commit 7609aed42c
1 file changed
+7
+7
View File
@@ -199,5 +199,12 @@ func migrateLegacyOutboundTables(db *sql.DB) error {
}
log.Warn("Recovered the setting of outbound %q from the first SQLite migration", name)
}
// Drop obsolete legacy tables so stale foreign keys (e.g. outbound_connections.server_id -> servers.id)
// do not cause "FOREIGN KEY constraint failed (787)" when deleting servers.
if _, err := db.Exec("DROP TABLE IF EXISTS outbound_connections; DROP TABLE IF EXISTS outbound_settings;"); err != nil {
return fmt.Errorf("failed to drop legacy outbound tables: %w", err)
}
return nil
}