cirandas.net

ref: master

db/migrate/20100811211216_set_published_articles_source.rb


1
2
3
4
5
6
7
8
9
class SetPublishedArticlesSource < ActiveRecord::Migration
  def self.up
    update("update articles set source = (select source from articles origin where origin.id = articles.reference_article_id) where articles.type = 'PublishedArticle';")
  end

  def self.down
    say "this migration can't be reverted"
  end
end