Feature: Invariant data model and database schema As a developer I want an Invariant SQLAlchemy model with a corresponding database schema So that invariant rules can be persisted and queried efficiently Background: Given a fresh in-memory invariant database Scenario: Create an Invariant with all required fields Given a new Invariant with description "All plans must have a goal" When I persist the Invariant Then I can retrieve the Invariant by its ID And the persisted Invariant description should be "All plans must have a goal" Scenario: is_active defaults to True Given a new Invariant with description "Default active invariant" When I persist the Invariant Then I can retrieve the Invariant by its ID And the persisted Invariant is_active should be True Scenario: created_at is auto-populated on insert Given a new Invariant with description "Timestamped invariant" When I persist the Invariant Then I can retrieve the Invariant by its ID And the persisted Invariant created_at should not be empty Scenario: id is a UUID string Given a new Invariant with description "UUID invariant" When I persist the Invariant Then I can retrieve the Invariant by its ID And the persisted Invariant id should be a valid UUID Scenario: description is required and cannot be empty Given a new Invariant with an empty description When I try to persist the Invariant Then a ValueError should be raised for empty description Scenario: Query active invariants Given 3 active Invariants and 2 inactive Invariants When I query Invariants filtered by is_active True Then I should get 3 Invariants Scenario: Query inactive invariants Given 3 active Invariants and 2 inactive Invariants When I query Invariants filtered by is_active False Then I should get 2 Invariants Scenario: Deactivate an Invariant Given a persisted active Invariant When I set is_active to False on the Invariant Then the Invariant is_active should be False Scenario: Migration upgrade creates invariants table Given a fresh in-memory invariant database Then the invariants table should exist Scenario: Migration creates index on is_active Given a fresh in-memory invariant database Then the invariants table should have an index on is_active