diaspora/db/migrate/20110524184202_add_object_id_to_post.rb

11 lines
299 B
Ruby

class AddObjectIdToPost < ActiveRecord::Migration
class Post < ActiveRecord::Base; end
def self.up
add_column(:posts, :objectId, :integer)
execute("UPDATE posts SET objectId = object_url") if Post.count > 0
end
def self.down
remove_column(:posts, :objectId, :integer)
end
end