Feature: Database Repository Operations As a developer I want to ensure database repositories work correctly So that data is persisted and retrieved accurately Scenario: Initialize database When I initialize the database Then the database tables should be created And the database should be ready for use Scenario: Create and retrieve a project Given I have a database session And I have a project repository When I create a new project named "test-project" Then the project should be saved to database And I should be able to retrieve the project by ID And I should be able to retrieve the project by name Scenario: Update a project Given I have a database session And I have a project repository And I have an existing project in the database When I update the project settings Then the changes should be persisted And the updated_at timestamp should change Scenario: Create and retrieve plans Given I have a database session And I have a plan repository And I have a project with ID 1 When I create a new plan for the project Then the plan should be saved to database And I should be able to retrieve the plan by ID And I should be able to get all plans for the project Scenario: Set current plan for project Given I have a database session And I have a plan repository And I have multiple plans for a project When I set one plan as current Then only that plan should be marked as current And other plans should not be current Scenario: Add and retrieve context items Given I have a database session And I have a context repository And I have a plan with ID 1 When I add context items to the plan Then the context should be saved to database And I should be able to retrieve all context for the plan Scenario: Clear context for a plan Given I have a database session And I have a context repository And I have a plan with context items When I clear the context for the plan Then the plan should have no context items Scenario: Add and retrieve changes Given I have a database session And I have a change repository And I have a plan with ID 1 When I add changes to the plan Then the changes should be saved to database And I should be able to retrieve all changes for the plan Scenario: Mark changes as applied Given I have a database session And I have a change repository And I have unapplied changes When I mark a change as applied Then the change should be marked as applied And the applied_at timestamp should be set Scenario: Repository transaction rollback Given I have a database session And I have a project repository When I attempt a failing transaction Then the transaction should be rolled back And no data should be persisted