Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b24d9741e6
Fetching contributors…

Cannot retrieve contributors at this time

22 lines (19 sloc) 0.82 kb
class CreateQuestionBodies < ActiveRecord::Migration
def self.up
create_table :question_bodies do |t|
t.text :body
t.text :formatted_html
t.integer :question_id
t.timestamps
end
ActiveRecord::Base.connection.execute("INSERT INTO question_bodies(body, formatted_html, question_id) SELECT body, formatted_html, id FROM questions")
remove_column :questions, :body
remove_column :questions, :formatted_html
end
def self.down
add_column :questions, :formatted_html
add_column :questions, :body
ActiveRecord::Base.connection.execute("UPDATE questions, question_bodies SET questions.body = question_bodies.body, questions.formatted_html = question_bodies.formatted_html WHERE questions.id = question_bodies.question_id")
drop_table :question_bodies
end
end
Jump to Line
Something went wrong with that request. Please try again.