diff --git a/db/migrate/20111012133633_create_event_logs.rb b/db/migrate/20111012133633_create_event_logs.rb index 2c81b40f9..0cca66f5e 100644 --- a/db/migrate/20111012133633_create_event_logs.rb +++ b/db/migrate/20111012133633_create_event_logs.rb @@ -1,9 +1,9 @@ class CreateEventLogs < ActiveRecord::Migration def self.up create_table :event_logs do |t| - t.references :user + t.references :user, foreign_key: false, index: true t.string :user_name - t.references :object, polymorphic: true + t.references :object, polymorphic: true, index: true t.string :object_name t.string :ip t.string :kind @@ -14,8 +14,6 @@ class CreateEventLogs < ActiveRecord::Migration t.timestamps end - # add_index :event_logs, :user_id - # add_index :event_logs, [:object_id, :object_type] end def self.down diff --git a/db/schema.rb b/db/schema.rb index 17d3bebb4..1ba55e942 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -361,8 +361,8 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.text "message" t.datetime "created_at" t.datetime "updated_at" - t.index ["user_id"], :name => "fk__event_logs_user_id" - t.foreign_key ["user_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_event_logs_user_id" + t.index ["eventable_id", "eventable_type"], :name => "index_event_logs_on_eventable_id_and_eventable_type" + t.index ["user_id"], :name => "index_event_logs_on_user_id" end create_table "flash_notifies", force: true do |t|