Sha256: 5c23686626e198ade91470a291e5be8097fdc5e6a16e0baa750dc6b57c47ae36

Contents?: true

Size: 712 Bytes

Versions: 5

Compression:

Stored size: 712 Bytes

Contents

class ModifySiteIdForSpudPages < ActiveRecord::Migration[4.2]
  def up
    change_column :spud_pages,:site_id,:integer,:default => 0,:null => false
    change_column :spud_templates,:site_id,:integer,:default => 0,:null => false
    change_column :spud_menus,:site_id,:integer,:default => 0,:null => false
    SpudPage.where(:site_id => nil).each {|f| f.site_id = 0 ; f.save}
    SpudMenu.where(:site_id => nil).each {|f| f.site_id = 0 ; f.save}
  end

  def down
    change_column :spud_pages,:site_id,:integer,:default => nil,:null => true
    change_column :spud_templates,:site_id,:integer,:default => nil,:null => true
    change_column :spud_menus,:site_id,:integer,:default => nil,:null => true
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tb_cms-1.3.6 db/migrate/20120912121313_modify_site_id_for_spud_pages.rb
tb_cms-1.3.5 db/migrate/20120912121313_modify_site_id_for_spud_pages.rb
tb_cms-1.3.3 db/migrate/20120912121313_modify_site_id_for_spud_pages.rb
tb_cms-1.3.2 db/migrate/20120912121313_modify_site_id_for_spud_pages.rb
tb_cms-1.3.1 db/migrate/20120912121313_modify_site_id_for_spud_pages.rb