Class: AddScopeByToCustomAutoIncrements

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/protokoll/migration/templates/add_scope_by_to_custom_auto_increments.rb

Instance Method Summary collapse

Instance Method Details

#downObject



8
9
10
11
# File 'lib/generators/protokoll/migration/templates/add_scope_by_to_custom_auto_increments.rb', line 8

def down
  remove_index :custom_auto_increments, name: :counter_model_name_scope
  remove_column :custom_auto_increments, :counter_model_scope, :string
end

#upObject



2
3
4
5
6
# File 'lib/generators/protokoll/migration/templates/add_scope_by_to_custom_auto_increments.rb', line 2

def up
  add_column :custom_auto_increments, :counter_model_scope, :string
  add_index :custom_auto_increments, [:counter_model_name, :counter_model_scope],
            :unique => true, :name => :counter_model_name_scope
end