Class: SorceryActivityLogging

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/sorcery_migration/templates/activity_logging.rb

Class Method Summary collapse

Class Method Details

.downObject



10
11
12
13
14
15
16
# File 'lib/generators/sorcery_migration/templates/activity_logging.rb', line 10

def self.down
  remove_index :users, [:last_logout_at, :last_activity_at]
  
  remove_column :users, :last_activity_at
  remove_column :users, :last_logout_at
  remove_column :users, :last_login_at
end

.upObject



2
3
4
5
6
7
8
# File 'lib/generators/sorcery_migration/templates/activity_logging.rb', line 2

def self.up
  add_column :users, :last_login_at,     :datetime, :default => nil
  add_column :users, :last_logout_at,    :datetime, :default => nil
  add_column :users, :last_activity_at,  :datetime, :default => nil
  
  add_index :users, [:last_logout_at, :last_activity_at]
end