mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
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:
1 file changed
+7
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user