Guest User

Untitled

a guest
Jan 23rd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. class AddTranslationTableToBlog < ActiveRecord::Migration
  2. def self.up
  3.  
  4. BlogPost.create_translation_table!({
  5. :title => :string,
  6. :body => :text,
  7. :custom_teaser => :text
  8. }, :migrate_data => true)
  9.  
  10. # Not sure if needed... thought maybe might prevent it from squawking...
  11. ::BlogPost::Translation.module_eval do
  12. is_seo_meta
  13. end
  14.  
  15. ::SeoMetum.update_all :seo_meta_type => 'BlogPost::Translation', :seo_meta_type => 'BlogPost'
  16.  
  17. remove_column :blog_posts, :title
  18. remove_column :blog_posts, :body
  19. remove_column :blog_posts, :custom_teaser
  20.  
  21. BlogCategory.create_translation_table!({
  22. :title => :string
  23. }, :migrate_data => true)
  24.  
  25. remove_column :blog_categories, :title
  26.  
  27. end
  28.  
  29. def self.down
  30. # ...
  31. end
  32.  
  33.  
  34. end
Add Comment
Please, Sign In to add comment