Class: RailsAiBridge::Doctor::Checkers::SchemaChecker

Inherits:
BaseChecker
  • Object
show all
Defined in:
lib/rails_ai_bridge/doctor/checkers/schema_checker.rb

Overview

Verifies a schema file exists for schema-driven AI context. Accepts either db/schema.rb (+schema_format = :ruby+) or db/structure.sql (+schema_format = :sql+).

Instance Attribute Summary

Attributes inherited from BaseChecker

#app

Instance Method Summary collapse

Methods inherited from BaseChecker

#initialize

Constructor Details

This class inherits a constructor from RailsAiBridge::Doctor::Checkers::BaseChecker

Instance Method Details

#callDoctor::Check

Returns :pass when a schema file exists; :warn otherwise.

Returns:

  • (Doctor::Check)

    :pass when a schema file exists; :warn otherwise



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rails_ai_bridge/doctor/checkers/schema_checker.rb', line 11

def call
  schema_file = present_schema_file
  check(
    'Schema',
    schema_file,
    pass: { message: "#{schema_file} found" },
    fail: {
      status: :warn,
      message: 'db/schema.rb or db/structure.sql not found',
      fix: 'Run `rails db:migrate` (or `rails db:schema:dump`) to generate one'
    }
  )
end