feat: MAC lookup in scan FDB (API mac-locations, UI table, index)
Made-with: Cursor
This commit is contained in:
@@ -20,6 +20,9 @@ var scanPortDevicesBridgePortSQL string
|
||||
//go:embed sql/005_scan_port_devices_vlan.sql
|
||||
var scanPortDevicesVlanSQL string
|
||||
|
||||
//go:embed sql/006_scan_port_devices_mac_index.sql
|
||||
var scanPortDevicesMacIndexSQL string
|
||||
|
||||
func RunMigrations(db *sql.DB) error {
|
||||
if _, err := db.Exec(initSQL); err != nil {
|
||||
return err
|
||||
@@ -36,5 +39,8 @@ func RunMigrations(db *sql.DB) error {
|
||||
if _, err := db.Exec(scanPortDevicesVlanSQL); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := db.Exec(scanPortDevicesMacIndexSQL); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -15,3 +15,6 @@ create index if not exists idx_scan_port_devices_scan_ip_if
|
||||
|
||||
create index if not exists idx_scan_port_devices_scan_ip_mac
|
||||
on scan_port_devices (scan_id, ip, mac);
|
||||
|
||||
create index if not exists idx_scan_port_devices_scan_mac
|
||||
on scan_port_devices (scan_id, mac);
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
-- Ускорение поиска MAC по scan_id (таблица FDB).
|
||||
create index if not exists idx_scan_port_devices_scan_mac
|
||||
on scan_port_devices (scan_id, mac);
|
||||
Reference in New Issue
Block a user