Permalink
Browse files

Add slug column to the Post model

  • Loading branch information...
rubyhero committed Jun 30, 2018
1 parent cdea51b commit 03daa5cf665271017b82e362b875163be617b594
Showing with 9 additions and 1 deletion.
  1. +6 −0 db/migrate/20180630035041_add_slug_to_post.rb
  2. +3 −1 db/schema.rb
@@ -0,0 +1,6 @@
class AddSlugToPost < ActiveRecord::Migration[5.2]
def change
add_column :posts, :slug, :string, null: false
add_index :posts, :slug, unique: true
end
end
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_06_29_105146) do
ActiveRecord::Schema.define(version: 2018_06_30_035041) do
create_table "comments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.text "body", null: false
@@ -26,6 +26,8 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "user_id"
t.string "slug", null: false
t.index ["slug"], name: "index_posts_on_slug", unique: true
end
create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|

0 comments on commit 03daa5c

Please sign in to comment.