Class: AchievableMigration

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

Class Method Summary collapse

Class Method Details

.downObject



24
25
26
27
# File 'lib/generators/templates/migration.rb', line 24

def self.down
  drop_table :achievings
  drop_table :achievements
end

.upObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/generators/templates/migration.rb', line 3

def self.up
  create_table :achievements do |t|
    t.string   :name
    t.string   :image_url
    t.string   :description
    t.integer  :achievings_count, :default => 0
    t.string   :category
    t.timestamps
  end

  create_table :achievings do |t|
    t.integer  :achiever_id
    t.integer  :achievement_id
    t.boolean  :notify,   :default => false
    t.string   :achiever_type
    t.timestamps
  end
  
  add_index :achievements, :name
end