From ad74725b760d98045475360a5e6d6e0771a83752 Mon Sep 17 00:00:00 2001 From: Samuel Rund Date: Wed, 6 May 2015 17:19:46 -0400 Subject: [PATCH] stuff --- .../20150506205248_add_categories_posts_relation.rb | 5 +++++ db/schema.rb | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20150506205248_add_categories_posts_relation.rb diff --git a/db/migrate/20150506205248_add_categories_posts_relation.rb b/db/migrate/20150506205248_add_categories_posts_relation.rb new file mode 100644 index 0000000..1e98b5b --- /dev/null +++ b/db/migrate/20150506205248_add_categories_posts_relation.rb @@ -0,0 +1,5 @@ +class AddCategoriesPostsRelation < ActiveRecord::Migration + def change + add_reference :posts, :category, index: true + end +end diff --git a/db/schema.rb b/db/schema.rb index a9e2b25..837200d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150506185701) do +ActiveRecord::Schema.define(version: 20150506205248) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -27,12 +27,15 @@ end create_table "posts", force: :cascade do |t| - t.string "title", limit: 500 + t.string "title", limit: 500 t.text "body" - t.string "link", limit: 2000 + t.string "link", limit: 2000 t.datetime "created_at" t.datetime "updated_at" - t.integer "post_type", default: 0 + t.integer "post_type", default: 0 + t.integer "category_id" end + add_index "posts", ["category_id"], name: "index_posts_on_category_id", using: :btree + end