Phase 7 Stream E — Config DB schema for scripts, virtual tags, scripted alarms, and alarm state #183
Reference in New Issue
Block a user
Delete Branch "phase-7-stream-e-config-db"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds the four tables Streams B/C/F consume.
Script(generation-scoped source code),VirtualTag(generation-scoped calculated-tag config),ScriptedAlarm(generation-scoped alarm config), andScriptedAlarmState(logical-id-keyed persistent runtime state per Phase 7 plan decision #14).New entities (net10, EF Core)
Script— stable logicalScriptIdcarries across generations;SourceHashis the compile-cache key so Core.Scripting'sCompiledScriptCachehits on re-publish of unchanged source.VirtualTag— mandatoryEquipmentIdFK (plan decision #2, unified Equipment tree);ChangeTriggered+TimerIntervalMs+Historizeflags. Check constraints: at least one trigger enabled, timer >= 50ms.ScriptedAlarm— requiredAlarmType(AlarmCondition/LimitAlarm/OffNormalAlarm/DiscreteAlarm);Severity1..1000 range check;HistorizeToAvevadefault true per plan decision #15.ScriptedAlarmState— keyed ONLY onScriptedAlarmId(NOT generation-scoped) per plan decision #14: ack state + audit trail must follow alarm identity across Modified generations.CommentsJsonhasISJSONcheck for GxP / 21 CFR Part 11 audit.Migration
EF-generated
20260420231641_AddPhase7ScriptingTablescovers all 4 tables + indexes + check constraints + FKs toConfigGeneration.sp_PublishGenerationrequired no changes — it only flips Draft → Published status; the new entities already carryGenerationIdso they publish atomically with the rest of the config. Stream F's diff extension will add them tosp_ComputeGenerationDiff.Tests — 12/12 (design-time model introspection, no SQL Server required)
Phase7ScriptingEntitiesTestscovers:Generation+LogicalId,Generation+EquipmentPathfor VirtualTag and ScriptedAlarmGeneration+SourceHashfor cache lookupScriptedAlarmStatePK is alarm-id not generation-scoped (ack audit follows identity)ScriptedAlarmdefaults (HistorizeToAveva=true, Retain=true, Severity=500, Enabled=true)Next
Stream F extends
sp_ComputeGenerationDiffto emit Script / VirtualTag / ScriptedAlarm sections + lights up the Admin UI Monaco editor tabs. Stream G wires the engines from Streams B+C into the DriverNodeManager dispatch path.