orbit-basic/lib/tasks/data_migration.rake

47 lines
1.8 KiB
Ruby

# encoding: utf-8
require 'resque_scheduler/tasks'
namespace :data_migration do
task :add_order_to_announcement_tag_0703 => :environment do
AnnouncementTag.first({conditions:{ key: 'students' }}).update_attributes(:order=>1)
AnnouncementTag.first({conditions:{ key: 'alumni' }}).update_attributes(:order=>2)
AnnouncementTag.first({conditions:{ key: 'employee' }}).update_attributes(:order=>3)
AnnouncementTag.first({conditions:{ key: 'guest' }}).update_attributes(:order=>4)
end
task :add_archive_func_to_bulletin_category_0704 => :environment do
BulletinCategory.all.each{|bc| bc.disable=false;bc.save!}
end
task :add_archive_func_to_news_bulletin_category_0704 => :environment do
NewsBulletinCategory.all.each{|bc| bc.disable=false;bc.save!}
end
task :add_search_widget_to_news_and_announcement => :environment do
app = ModuleApp.first({:conditions=>{:title => 'news'}})
app.widgets << "news_bulletins_search_block" if !app.widgets.include?("news_bulletins_search_block")
app.save!
app = ModuleApp.first({:conditions=>{:title => 'Announcement'}})
app.widgets << "bulletins_search_block" if !app.widgets.include?("bulletins_search_block")
app.save!
p "==DO NOT FORGET TO RUN: rake redis_search:index"
end
task :add_search_func => :environment do
ModuleApp.create!(:key=>'search',:title => 'search',:enable_frontend=> true,:app_pages=>["full_search","optional_search"])
end
task :rename_test_role_name => :environment do
sr = SubRole.first({conditions:{key: 'good_teacher' }})
sr.i18n_variable[:zh_tw] = '銳論數位'
sr.i18n_variable[:en] = 'RulingCom'
sr.save!
sr = SubRole.first({conditions:{key: 'bad_teacher' }})
sr.i18n_variable[:zh_tw] = '銳論數位'
sr.i18n_variable[:en] = 'RulingCom'
sr.save!
end
end