Project

General

Profile

« Previous | Next » 

Revision 3ace60a5

Added by Ohad Levy almost 12 years ago

  • ID 3ace60a5690ded35e264cc8188d11ae4b8ba5dd7

minimal fix for unexplained db migrations failures, refs #1736

View differences:

db/migrate/20120624094034_add_os_family_to_ptable.rb
class AddOsFamilyToPtable < ActiveRecord::Migration
def self.up
add_column :ptables, :os_family, :string
remove_column :ptables, :operatingsystem_id
add_column :ptables, :os_family, :string unless column_exists? :ptables, :os_family
remove_column :ptables, :operatingsystem_id if column_exists? :ptables, :operatingsystem_id
Ptable.reset_column_information
Ptable.all.each do |p|
family = p.operatingsystems.map(&:family).uniq.first rescue nil
......
end
def self.down
remove_column :ptables, :os_family
add_column :ptables, :operatingsystem_id, :integer
remove_column :ptables, :os_family if column_exists? :ptables, :os_family
add_column :ptables, :operatingsystem_id, :integer unless column_exists? :ptables, :operatingsystem_id
end
end

Also available in: Unified diff