Sha256: 469604f2e9531e31834f0d8b118832a55002083aeb4458287d6c6f6e0d2d5329

Contents?: true

Size: 931 Bytes

Versions: 1

Compression:

Stored size: 931 Bytes

Contents

class ScideaSchools02RemoveMenu < ActiveRecord::Migration

  def up
    execute "delete from menu_elements where display_name = 'Educational Institutions';"
  end

  def down

    sql = <<-SQL
      set @course_and_scitent_admins = (select group_concat(id) from roles where symbol in ('course_admin', 'scitent_admin'));
      set @product_and_scitent_admins = (select group_concat(id) from roles where symbol in ('product_admin', 'scitent_admin'));

      SELECT @admin_nav_secondary_id:=id FROM menus WHERE name = 'Admin Navigation: Secondary' LIMIT 1;

      INSERT INTO menu_elements (display_name, menu_id, url, view_role_list, edit_role_list, order_sequence) VALUES ('Educational Institutions', @admin_nav_secondary_id, '/admin/schools', @course_and_scitent_admins, @product_and_scitent_admins, 102);
    SQL

    sql.split("\n").reject{|s| s.strip.start_with?('#') || s.strip.empty? }.each{ |s| execute s.strip }

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scidea-schools-1.1 lib/generators/scidea/schools/templates/scidea_schools_02_remove_menu.rb