diff --git a/db/migrate/20150921095553_create_activities.rb b/db/migrate/20150921095553_create_activities.rb new file mode 100644 index 000000000..3fff14205 --- /dev/null +++ b/db/migrate/20150921095553_create_activities.rb @@ -0,0 +1,13 @@ +class CreateActivities < ActiveRecord::Migration + def change + create_table :activities do |t| + t.integer :user_id + t.string :action + t.belongs_to :actionable, polymorphic: true + t.timestamps + end + + add_index :activities, [:actionable_id, :actionable_type] + add_index :activities, :user_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 741f82940..22b6b730c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,11 +11,23 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150917102718) do +ActiveRecord::Schema.define(version: 20150921095553) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" + create_table "activities", force: :cascade do |t| + t.integer "user_id" + t.string "action" + t.integer "actionable_id" + t.string "actionable_type" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "activities", ["actionable_id", "actionable_type"], name: "index_activities_on_actionable_id_and_actionable_type", using: :btree + add_index "activities", ["user_id"], name: "index_activities_on_user_id", using: :btree + create_table "addresses", force: :cascade do |t| t.integer "user_id" t.string "street"