Sha256: 732b4e601ca89d82491ddc80fb631d07a2c75f62935b3d03da55f07d35918c23

Contents?: true

Size: 570 Bytes

Versions: 18

Compression:

Stored size: 570 Bytes

Contents

module Comatose
  class Page < ActiveRecord::Base
    set_table_name 'comatose_pages'
  end
end

class <%= class_name %> < ActiveRecord::Migration

  # Upgrades schema from version 0.4 to version 0.6 
  def self.up
    add_column :comatose_pages, "created_on", :datetime
    puts "Setting created_on times..."
    Comatose::Page.find(:all).each do |page|
      page.update_attribute('created_on', page.updated_on || Time.now)
    end
  end

  # Downgrades schema from version 0.6 to version 0.4
  def self.down
    remove_column :comatose_pages, "created_on"
  end

end

Version data entries

18 entries across 18 versions & 6 rubygems

Version Path
aslakjo-aslakjo-comatose-2.0.5.1 generators/comatose_migration/templates/v6_upgrade.rb
aslakjo-comatose-2.0.5.2 generators/comatose_migration/templates/v6_upgrade.rb
aslakjo-comatose-2.0.5.3 generators/comatose_migration/templates/v6_upgrade.rb
darthapo-comatose-2.0.3 generators/comatose_migration/templates/v6_upgrade.rb
darthapo-comatose-2.0.4 generators/comatose_migration/templates/v6_upgrade.rb
darthapo-comatose-2.0.5 generators/comatose_migration/templates/v6_upgrade.rb
darthapo-comatose-2.0 generators/comatose_migration/templates/v6_upgrade.rb
jcnetdev-comatose-2.0.1 generators/comatose_migration/templates/v6_upgrade.rb
staugaard-comatose-2.0.2 generators/comatose_migration/templates/v6_upgrade.rb
staugaard-comatose-2.0.3 generators/comatose_migration/templates/v6_upgrade.rb
comatose-2.0.5 generators/comatose_migration/templates/v6_upgrade.rb
comatose-2.0.1 generators/comatose_migration/templates/v6_upgrade.rb
aslakjo-comatose-2.0.5.12 generators/comatose_migration/templates/v6_upgrade.rb
aslakjo-comatose-2.0.5.11 generators/comatose_migration/templates/v6_upgrade.rb
aslakjo-comatose-2.0.5.10 generators/comatose_migration/templates/v6_upgrade.rb
aslakjo-comatose-2.0.5.9 generators/comatose_migration/templates/v6_upgrade.rb
aslakjo-comatose-2.0.5.8 generators/comatose_migration/templates/v6_upgrade.rb
aslakjo-comatose-2.0.5.7 generators/comatose_migration/templates/v6_upgrade.rb