module ObviousData::SchemaMethods

Public Instance Methods

drop_function(signature) click to toggle source
# File lib/obvious_data/schema_methods.rb, line 7
def drop_function(signature)
  execute "DROP FUNCTION IF EXISTS #{signature};"
end
drop_trigger(trigger, table) click to toggle source
# File lib/obvious_data/schema_methods.rb, line 25
def drop_trigger(trigger, table)
  execute "DROP TRIGGER IF EXISTS #{trigger} ON #{table};"
end
drop_view(signature) click to toggle source
# File lib/obvious_data/schema_methods.rb, line 16
def drop_view(signature)
  execute "DROP VIEW IF EXISTS #{signature};"
end
execute_function_file(function) click to toggle source
# File lib/obvious_data/schema_methods.rb, line 2
def execute_function_file(function)
  path = Rails.root.join('db', 'functions', "#{function}.sql")
  execute(File.read(path))
end
execute_trigger_file(trigger) click to toggle source
# File lib/obvious_data/schema_methods.rb, line 20
def execute_trigger_file(trigger)
  path = Rails.root.join('db', 'triggers', "#{trigger}.sql")
  execute(File.read(path))
end
execute_view_file(view) click to toggle source
# File lib/obvious_data/schema_methods.rb, line 11
def execute_view_file(view)
  path = Rails.root.join('db', 'views', "#{view}.sql")
  execute(File.read(path))
end