Skip to content

Commit c4d0268

Browse files
committed
Delete user integer and add user references to lists
1 parent fa559b7 commit c4d0268

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class DeleteUserFromLists < ActiveRecord::Migration[6.1]
2+
def change
3+
remove_column :lists, :user, :integer
4+
end
5+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddUserReferencesToLists < ActiveRecord::Migration[6.1]
2+
def change
3+
add_reference :lists, :user, foreign_key: true
4+
end
5+
end

db/schema.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 2022_05_27_080540) do
13+
ActiveRecord::Schema.define(version: 2022_06_01_093156) do
1414

1515
# These are extensions that must be enabled in order to support this database
1616
enable_extension "plpgsql"
@@ -57,7 +57,8 @@
5757
t.string "name"
5858
t.datetime "created_at", precision: 6, null: false
5959
t.datetime "updated_at", precision: 6, null: false
60-
t.integer "user"
60+
t.bigint "user_id"
61+
t.index ["user_id"], name: "index_lists_on_user_id"
6162
end
6263

6364
create_table "movies", force: :cascade do |t|
@@ -87,4 +88,5 @@
8788
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
8889
add_foreign_key "bookmarks", "lists"
8990
add_foreign_key "bookmarks", "movies"
91+
add_foreign_key "lists", "users"
9092
end

0 commit comments

Comments
 (0)