Module: Snails::SchemaLoader
- Defined in:
- runtime/snails/schema_loader.rb
Class Method Summary collapse
-
.load_tables ⇒ void
apply
db/schema.sqlthrough the adapter's official client; a tree with no schema dump loads nothing. -
.reject_legacy_layout ⇒ void
refuse to load while the legacy
config/schema layout is still on disk.
Class Method Details
.load_tables ⇒ void
apply db/schema.sql through the adapter's official client; a tree with
no schema dump loads nothing.
39 40 41 42 43 |
# File 'runtime/snails/schema_loader.rb', line 39 def self.load_tables return unless File.exist?("db/schema.sql") apply_file("db/schema.sql") end |
.reject_legacy_layout ⇒ void
refuse to load while the legacy config/ schema layout is still on disk.
A silent skip would boot on stub tables and pass every non-DB case, so the
leftover files raise.
25 26 27 28 29 30 31 32 |
# File 'runtime/snails/schema_loader.rb', line 25 def self.reject_legacy_layout stale = [] stale << "config/schema.sql" if File.exist?("config/schema.sql") stale << "config/views" if Dir.exist?("config/views") return if stale.empty? raise "stale schema layout (#{stale.join(", ")}) — snails loads db/schema.sql; move the files" end |