Corrected migration, to populate the new tags table
This commit is contained in:
parent
4f8cf33f90
commit
606c812dca
@ -1,14 +1,14 @@
|
||||
# Migrate tags from inline attribute to separate table
|
||||
class PopulateTags < ActiveRecord::Migration
|
||||
def self.up
|
||||
change_column_null :events, :tags, true
|
||||
change_column_null :orgas, :tags, true
|
||||
|
||||
execute('SELECT id, tags FROM events;').each do |result|
|
||||
event = Event.find_by id: result[0]
|
||||
event.tag_list = result[1]
|
||||
event.save
|
||||
end
|
||||
|
||||
change_column_null :events, :tags, true
|
||||
change_column_null :orgas, :tags, true
|
||||
end
|
||||
|
||||
def self.down
|
||||
|
Loading…
Reference in New Issue
Block a user