Module: LlmCostTracker::Ledger::Schema::ProviderInvoices

Defined in:
lib/llm_cost_tracker/ledger/schema/provider_invoices.rb

Constant Summary collapse

REQUIRED_COLUMNS =
%w[
  source period_start period_end external_id billed_amount currency metadata imported_at
].freeze
UNIQUE_INDEX_COLUMNS =
%i[external_id].freeze
SOURCE_PERIOD_INDEX_COLUMNS =
%i[source period_start].freeze

Class Method Summary collapse

Class Method Details

.current_schema_errorsObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/llm_cost_tracker/ledger/schema/provider_invoices.rb', line 16

def current_schema_errors
  connection = LlmCostTracker::Call.connection
  Adapter.ensure_supported!(connection)
  table_name = LlmCostTracker::ProviderInvoice.table_name
  return ["#{table_name} table is missing"] unless connection.data_source_exists?(table_name)

  errors = []
  errors.concat(column_errors)
  errors.concat((connection))
  errors.concat(index_errors(connection, table_name))
  errors
end