diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20231014140431_add_user_to_blog.rb | 5 | ||||
-rw-r--r-- | db/schema.rb | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/db/migrate/20231014140431_add_user_to_blog.rb b/db/migrate/20231014140431_add_user_to_blog.rb new file mode 100644 index 0000000..74af555 --- /dev/null +++ b/db/migrate/20231014140431_add_user_to_blog.rb | |||
@@ -0,0 +1,5 @@ | |||
1 | class AddUserToBlog < ActiveRecord::Migration[7.0] | ||
2 | def change | ||
3 | add_reference :blogs, :user, foreign_key: true | ||
4 | end | ||
5 | end | ||
diff --git a/db/schema.rb b/db/schema.rb index 2a9b1df..56fd9bb 100644 --- a/db/schema.rb +++ b/db/schema.rb | |||
@@ -10,7 +10,7 @@ | |||
10 | # | 10 | # |
11 | # It's strongly recommended that you check this file into your version control system. | 11 | # It's strongly recommended that you check this file into your version control system. |
12 | 12 | ||
13 | ActiveRecord::Schema[7.0].define(version: 2023_10_12_190529) do | 13 | ActiveRecord::Schema[7.0].define(version: 2023_10_14_140431) do |
14 | create_table "audits", force: :cascade do |t| | 14 | create_table "audits", force: :cascade do |t| |
15 | t.integer "auditable_id" | 15 | t.integer "auditable_id" |
16 | t.string "auditable_type" | 16 | t.string "auditable_type" |
@@ -41,6 +41,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_12_190529) do | |||
41 | t.datetime "updated_at", precision: nil, null: false | 41 | t.datetime "updated_at", precision: nil, null: false |
42 | t.boolean "published", default: false, null: false | 42 | t.boolean "published", default: false, null: false |
43 | t.datetime "published_at", precision: nil | 43 | t.datetime "published_at", precision: nil |
44 | t.integer "user_id" | ||
45 | t.index ["user_id"], name: "index_blogs_on_user_id" | ||
44 | end | 46 | end |
45 | 47 | ||
46 | create_table "ckeditor_assets", force: :cascade do |t| | 48 | create_table "ckeditor_assets", force: :cascade do |t| |
@@ -358,6 +360,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_12_190529) do | |||
358 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true | 360 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true |
359 | end | 361 | end |
360 | 362 | ||
363 | add_foreign_key "blogs", "users" | ||
361 | add_foreign_key "comments", "blogs" | 364 | add_foreign_key "comments", "blogs" |
362 | add_foreign_key "pokeviewer_items", "pokeviewer_moves", column: "move_id" | 365 | add_foreign_key "pokeviewer_items", "pokeviewer_moves", column: "move_id" |
363 | add_foreign_key "pokeviewer_pokedex_entries", "pokeviewer_species", column: "species_id" | 366 | add_foreign_key "pokeviewer_pokedex_entries", "pokeviewer_species", column: "species_id" |