Class: CreateAbingoTables

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

Class Method Summary collapse

Class Method Details

.downObject



25
26
27
28
# File 'lib/generators/abingo_migration/templates/create_abingo_tables.rb', line 25

def self.down
  drop_table :experiments
  drop_table :alternatives
end

.upObject



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

def self.up
  create_table "experiments", :force => true do |t|
    t.string "test_name"
    t.string "status"
    t.timestamps
  end

  add_index "experiments", "test_name"
  #add_index "experiments", "created_on"

  create_table "alternatives", :force => true do |t|
    t.integer :experiment_id
    t.string :content
    t.string :lookup, :limit => 32
    t.integer :weight, :default => 1
    t.integer :participants, :default => 0
    t.integer :conversions, :default => 0
  end

  add_index "alternatives", "experiment_id"
  add_index "alternatives", "lookup"  #Critical for speed, since we'll primarily be updating by that.
end