journalduhacker/db/migrate/20121112165212_add_tag_media_types.rb

16 lines
288 B
Ruby

class AddTagMediaTypes < ActiveRecord::Migration
def up
add_column :tags, :is_media, :boolean, :default => false
[ "pdf", "video" ].each do |t|
if tag = Tag.where(:tag => t).first
tag.is_media = true
tag.save
end
end
end
def down
end
end