Corrected migration, to populate the new tags table

This commit is contained in:
echarp 2016-12-17 18:18:01 +01:00
parent 4f8cf33f90
commit 606c812dca

View File

@ -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