Sha256: d9939c52c16da4fb6aae20571fa9923690d365f1a4efb925ea85f13e7f930419

Contents?: true

Size: 472 Bytes

Versions: 122

Compression:

Stored size: 472 Bytes

Contents

class AddOwnersToTasks < ActiveRecord::Migration
  def up
    add_column :dorsale_flyboy_tasks, :owner_type, :string

    if column_exists? :dorsale_flyboy_tasks, :owner_id
      Dorsale::Flyboy::Task.where("owner_id is not null").update_all(owner_type: 'User')
    else
      add_column :dorsale_flyboy_tasks, :owner_id, :integer
    end
  end

  def down
    remove_column :dorsale_flyboy_tasks, :owner_id
    remove_column :dorsale_flyboy_tasks, :owner_type
  end

end

Version data entries

122 entries across 122 versions & 1 rubygems

Version Path
dorsale-4.0.0 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.20.0 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.19.1 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.19.0 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.18.0 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.17.0 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.16.0 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.15.0 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.14.11 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.14.10 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.14.9 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.14.8 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.14.7 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.14.6 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.14.5 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.14.4 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.14.3 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.14.2 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.14.1 db/migrate/20150803152643_add_owners_to_tasks.rb
dorsale-3.14.0 db/migrate/20150803152643_add_owners_to_tasks.rb