Class: AddType

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/wpb.rb

Class Method Summary collapse

Class Method Details

.downObject



34
35
36
# File 'lib/wpb.rb', line 34

def self.down
  remove_column :wp_posts, :type
end

.upObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/wpb.rb', line 21

def self.up
	suppress_messages do
		unless column_exists? :wp_posts, :type
			add_column :wp_posts, :type, :string
			PagePost.reset_column_information
		end
		PagePost.all.each do |p|
			p.type = p.post_type.capitalize
			p.save
		end
	end
end