fix: remove device_role_source from form params (#110)
- Removed device_role_source assignment in sanitize_device_role/1 - Updated structure.sql to reflect database schema without device_role_source column - Fixes ERROR 42703 (undefined_column) in production workers The form was still trying to set device_role_source in params even though the database column was dropped, causing runtime errors in: - AgentLatencyEvaluator - CapacityInsightWorker - WirelessInsightWorker All device roles are now manually set with default value 'other'. Reviewed-on: graham/towerops-web#110
This commit is contained in:
parent
5a6acf0d7c
commit
7d65e9e4c5
2 changed files with 7643 additions and 130 deletions
|
|
@ -652,17 +652,15 @@ defmodule ToweropsWeb.DeviceLive.Form do
|
|||
end
|
||||
end
|
||||
|
||||
# Set device_role_source based on whether a role was manually selected
|
||||
# Device role sanitization (auto-inference disabled, all roles are manual)
|
||||
defp sanitize_device_role(params) do
|
||||
case Map.get(params, "device_role") do
|
||||
role when is_binary(role) and role != "" ->
|
||||
Map.put(params, "device_role_source", "manual")
|
||||
params
|
||||
|
||||
_ ->
|
||||
# Auto-detect selected (empty string or nil) - clear role, set source to inferred
|
||||
# Empty string or nil - just pass through (schema default will apply)
|
||||
params
|
||||
|> Map.put("device_role", nil)
|
||||
|> Map.put("device_role_source", "inferred")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue