Sha256: 939da5295e8b55e58ef5927e42fe83fec9b47a73ae30d4147045aeedc81fe194

Contents?: true

Size: 754 Bytes

Versions: 2

Compression:

Stored size: 754 Bytes

Contents

# This migration comes from tb_cms (originally 20120912121313)
class ModifySiteIdForSpudPages < ActiveRecord::Migration
  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

2 entries across 2 versions & 1 rubygems

Version Path
tb_cms-1.3.0 spec/dummy/db/migrate/20141231214475_modify_site_id_for_spud_pages.tb_cms.rb
tb_cms-1.3.beta1 spec/dummy/db/migrate/20141231214475_modify_site_id_for_spud_pages.tb_cms.rb