Sha256: 9cddbc34f10091708c32e41182a3516fdbaef51befe2a4c1c3f1d3ae3f7093be

Contents?: true

Size: 690 Bytes

Versions: 1

Compression:

Stored size: 690 Bytes

Contents

class AddEmailSpecs < ActiveRecord::Migration
  def self.up
    # Workaround change_column not allowing change to :null => true
    remove_column :messages, :sender_id
    remove_column :messages, :sender_type
    
    add_column :messages, :sender_id, :integer, :null => true, :default => nil, :references => nil
    add_column :messages, :sender_type, :string, :null => true, :default => nil
    add_column :messages, :sender_spec, :string, :limit => 320
  end

  def self.down
    remove_column :messages, :sender_spec
    
    change_column :messages, :sender_id, :integer, :null => false, :references => nil
    change_column :messages, :sender_type, :string, :null => false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
has_emails-0.0.1 db/migrate/002_add_email_specs.rb