Sha256: eb7090b8019d676d81fb0745a3795ce82cea6beba7643a7e07428e9742c9c841

Contents?: true

Size: 614 Bytes

Versions: 6

Compression:

Stored size: 614 Bytes

Contents

class ExtendPages < ActiveRecord::Migration
  def self.up
    change_table :pages do |t|
      t.boolean :show_in_header, :default => false, :null => false
      t.boolean :show_in_footer, :default => false, :null => false
      t.string  :foreign_link
      t.integer :position, :default => 1, :null => false
      Page.all(:order => "updated_at ASC").each_with_index{|page,x| page.update_attribute(:position, x+1)}

    end
  end

  def self.down
    change_table :pages do |t|
      t.remove :show_in_header
      t.remove :show_in_footer
      t.remove :foreign_link
      t.remove :position
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree_static_content-0.60.1 lib/generators/templates/db/migrate/20090625125735_extend_pages.rb
spree_static_content-0.60.0 lib/generators/templates/db/migrate/20090625125735_extend_pages.rb
spree_static_content-0.40.2 lib/generators/templates/db/migrate/20090625125735_extend_pages.rb
spree_static_content-0.40.1 lib/generators/templates/db/migrate/20090625125735_extend_pages.rb
spree_static_content-0.40.0 lib/generators/templates/db/migrate/20090625125735_extend_pages.rb
spree_static_content-0.30.0 lib/generators/templates/db/migrate/20090625125735_extend_pages.rb