Module: Usps::Support::Models::Hq::Schemas

Defined in:
lib/usps/support/models/hq/schemas.rb

Overview

Loads the canonical HQ database schemas shared across merit-marks, exams, and other USPS apps that read VHQAB / WebSites. Host apps delegate their per-database schema files to these helpers so the definitions stay in one place and never drift.

Constant Summary collapse

SCHEMA_DIR =
File.join(Usps::Support::ROOT, 'db/hq')

Class Method Summary collapse

Class Method Details

.load_schema(name) ⇒ Object



20
21
22
# File 'lib/usps/support/models/hq/schemas.rb', line 20

def load_schema(name)
  load File.join(SCHEMA_DIR, "#{name}_schema.rb")
end

.load_schemas(*names) ⇒ Object

Load one or more HQ schemas into the currently-active connection. Typically called from a host app’s ‘db/<name>_schema.rb` shim so Rails’s conventional schema loading picks it up.



16
17
18
# File 'lib/usps/support/models/hq/schemas.rb', line 16

def load_schemas(*names)
  names.flatten.each { load_schema(it) }
end