Sha256: 33fa3f26a497812d22fd464226a33a15f9fe4766466203ae1f43c6b240742bd4

Contents?: true

Size: 459 Bytes

Versions: 6

Compression:

Stored size: 459 Bytes

Contents

class AddTextfilterToUsers < ActiveRecord::Migration
  def self.up
    f = TextFilter.find(:first, :conditions => ["name = ?", "none"])
    add_column :users, :text_filter_id, :string, :default => f.id

    unless Blog.default.nil?
      t = TextFilter.find(:first, :conditions => "name= '#{Blog.default.text_filter}'")
      User.update_all("text_filter_id = #{t.id}")
    end    
  end

  def self.down
    remove_column :text_filter_id, :integer
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
typo-5.5 db/migrate/078_add_textfilter_to_users.rb
typo-5.4.4 db/migrate/078_add_textfilter_to_users.rb
typo-5.4.3 db/migrate/078_add_textfilter_to_users.rb
typo-5.4.2 db/migrate/078_add_textfilter_to_users.rb
typo-5.4.1 db/migrate/078_add_textfilter_to_users.rb
typo-5.4 db/migrate/078_add_textfilter_to_users.rb