lib/generators/field_test/templates/memberships.rb.tt in field_test-0.2.4 vs lib/generators/field_test/templates/memberships.rb.tt in field_test-0.3.0
- old
+ new
@@ -1,15 +1,16 @@
class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
def change
create_table :field_test_memberships do |t|
- t.string :participant
+ t.string :participant_type
+ t.string :participant_id
t.string :experiment
t.string :variant
t.timestamp :created_at
t.boolean :converted, default: false
end
- add_index :field_test_memberships, [:experiment, :participant], unique: true
- add_index :field_test_memberships, :participant
+ add_index :field_test_memberships, [:participant_type, :participant_id, :experiment],
+ unique: true, name: "index_field_test_memberships_on_participant"
add_index :field_test_memberships, [:experiment, :created_at]
end
end