# class AddCreatedAtToAllTables

### Public Class Methods

down() click to toggle source

    # File lib/puppet/rails/database/001_add_created_at_to_all_tables.rb, line 8
    def self.down
      ActiveRecord::Base.connection.tables.each do |t|
        remove_column t.to_s, :created_at unless ActiveRecord::Base.connection.columns(t).collect {|c| c.name}.include?("created_at")
      end
    end

up() click to toggle source

    # File lib/puppet/rails/database/001_add_created_at_to_all_tables.rb, line 2
    def self.up
      ActiveRecord::Base.connection.tables.each do |t|
        add_column t.to_s, :created_at, :datetime unless ActiveRecord::Base.connection.columns(t).collect {|c| c.name}.include?("created_at")
      end
    end