def migrate_up
unless ActiveRecord::Schema.tables.include?('mole_features')
ActiveRecord::Schema.create_table('mole_features') do |t|
t.column :name, :string
t.column :context, :string
t.column :app_name, :string
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
ActiveRecord::Schema.add_index( 'mole_features',
['name', 'context', 'app_name'],
:name => 'feature_idx')
end
unless ActiveRecord::Schema.tables.include?('mole_logs')
ActiveRecord::Schema.create_table('mole_logs') do |t|
t.column :mole_feature_id, :integer
t.column :user_id, :integer
t.column :params, :string, :limit => 1024
t.column :ip_address, :string
t.column :browser_type, :string
t.column :host_name, :string
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
ActiveRecord::Schema.add_index( 'mole_logs',
['mole_feature_id','user_id'],
:name => "log_feature_idx" )
ActiveRecord::Schema.add_index( 'mole_logs',
['mole_feature_id','created_at'],
:name => "log_date_idx",
:unique => true )
end
end