Guest User

Untitled

a guest
Feb 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. require 'rubygems'
  4. require 'active_support'
  5. require 'active_record'
  6. require 'action_controller'
  7. require 'action_mailer'
  8.  
  9. # ok paths need changing
  10. RAILS_ROOT = '/www/sites/production/admin/current'
  11.  
  12. # Get data models.
  13. require RAILS_ROOT + '/app/models/f.rb'
  14.  
  15. RAILS_ENV = ENV['RAILS_ENV'] || 'production'
  16.  
  17. ActiveRecord::Base.configurations = File.open(RAILS_ROOT+"/config/database.yml") { |f| YAML::load(f) }
  18. ActiveRecord::Base.establish_connection ActiveRecord::Base.configurations[$RAILS_ENV]
  19.  
  20.  
  21. all = F.find_by_sql("SELECT * FROM article_versions WHERE id > 65486")
  22.  
  23. all.each do |a|
  24. t = all.send :sanitize_sql, ["REPLACE INTO articles (id, type, created_at, updated_at, published_at, premiere_position, approved, submitted, sub_category_id, custom_author, author_id, assignment_id, links_data, article_pages_data, title,subtitle,artist,abstract,record_label,release_year,reissue_label,reissue_year, rating, best_new_music,best_new_music_featurette, best_new_music_added_at, bside_artist, bside_title, download_url, download_type_id, source,genre,image_id, alt_image_id, version, old_path, photo_credit, media_links_data, vault_release, weekly_feature, bside_rating, suppress_byline, pin_article, cache_dirty, is_special) values (?,?,NOW(),?,?,?,?,?,?,?,?,-2,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,0)", a.article_id, a.versioned_type, a.updated_at, a.published_at, a.premiere_position, a.approved, a.submitted, a.sub_category_id, a.custom_author, a.author_id, a.links_data, a.article_pages_data, a.title, a.subtitle, a.artist, a.abstract, a.record_label, a.release_year, a.reissue_label, a.reissue_year, a.rating, a.best_new_music, a.best_new_music_featurette, a.best_new_music_added_at, a.bside_artist, a.bside_title, a.download_url, a.download_type_id, a.source, a.genre, a.image_id, a.alt_image_id, a.version, a.old_path, a.photo_credit, a.media_links_data, a.vault_release, a.weekly_feature, a.bside_rating, a.suppress_byline, a.pin_article]
  25.  
  26. ActiveRecord::Base.connection.execute(t)
  27.  
  28. end
Add Comment
Please, Sign In to add comment