Blogs
This commit is contained in:
15
db/migrate/20181111150322_create_blogs.rb
Normal file
15
db/migrate/20181111150322_create_blogs.rb
Normal file
@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CreateBlogs < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :blogs do |t|
|
||||
t.string :title, null: false
|
||||
t.text :article, null: false
|
||||
t.string :published_date, null: false, default: ""
|
||||
t.integer :user_id
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :blogs, :user_id
|
||||
end
|
||||
end
|
12
db/schema.rb
12
db/schema.rb
@ -10,7 +10,17 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2018_11_10_183741) do
|
||||
ActiveRecord::Schema.define(version: 2018_11_11_150322) do
|
||||
|
||||
create_table "blogs", force: :cascade do |t|
|
||||
t.string "title", null: false
|
||||
t.text "article", null: false
|
||||
t.string "published_date", default: "", null: false
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["user_id"], name: "index_blogs_on_user_id"
|
||||
end
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "display_name", null: false
|
||||
|
Reference in New Issue
Block a user