Class: CreateBananaSplitTables

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

Class Method Summary collapse

Class Method Details

.downObject



20
21
22
23
24
# File 'lib/generators/templates/migrations/migration.rb', line 20

def self.down
  drop_table :ab_tests
  drop_table :ab_test_variations
  drop_table :ab_test_runs
end

.upObject



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

def self.up
  create_table(:ab_tests) do |t|
    t.string :name
  end
  
  create_table(:ab_test_variations) do |t|
    t.references :ab_test
    t.string :name
  end
  
  create_table(:ab_test_runs) do |t|
    t.string :session_id
    t.references :ab_test
    t.references :ab_test_variation
    t.integer :value, :null => false, :default => 0
  end
end