module Rafter::Schema

Public Class Methods

apply() click to toggle source
# File lib/rafter/schema.rb, line 7
def self.apply
  status = system "ridgepole -c config/database.yml -E #{Rails.env} -f #{schema_file} --apply"
  raise Error.new('ridgepole failed to apply Schemafile.') if status == false
rescue => e
    puts e.full_message
    exit 1
end

Private Class Methods

schema_file() click to toggle source
# File lib/rafter/schema.rb, line 15
def self.schema_file
  not_found = Proc.new { NotFoundError.new("Schemafile was not found") }
  [Rails.root.join('db', 'Schemafile.rb'), ENV['SCHEMA_FILE']].find(not_found) { |f| File.file? f }
end