Skip to content
This repository
tree: fbee8ab703
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 25 lines (20 sloc) 0.731 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
class AddFlatFunctionsView < ActiveRecord::Migration
  def self.up

    connection.execute "DROP VIEW IF EXISTS flat_functions_view;"

    
    #flat_function_view is used by the api to simplify querying
    puts "Adding flat_function_view view."
    connection.execute <<-EOC
CREATE VIEW flat_functions_view as
SELECT functions.*,
libraries.name as library,
namespaces.name as ns,
libraries.id as library_id
FROM functions
LEFT JOIN namespaces ON functions.namespace_id = namespaces.id
LEFT JOIN libraries ON namespaces.library_id = libraries.id;
EOC
  end

  def self.down
    connection.execute "DROP VIEW IF EXISTS flat_functions_view;"
  end
end
Something went wrong with that request. Please try again.