created channel for action cable and friendship relationship in database

This commit is contained in:
Beatrice Olivera
2018-08-27 16:55:44 +01:00
parent 7d67f04c63
commit f9cbb7c680
7 changed files with 59 additions and 2 deletions

View File

@@ -0,0 +1,8 @@
class CreateConnections < ActiveRecord::Migration[5.2]
def change
create_table :connections do |t|
t.references :user, foreign_key: true, index: true
t.references :contact, foreign_key: { to_table: :users }, index: true
end
end
end

View File

@@ -10,11 +10,18 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_08_27_143700) do
ActiveRecord::Schema.define(version: 2018_08_27_151325) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "connections", force: :cascade do |t|
t.bigint "user_id"
t.bigint "contact_id"
t.index ["contact_id"], name: "index_connections_on_contact_id"
t.index ["user_id"], name: "index_connections_on_user_id"
end
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
@@ -27,4 +34,6 @@ ActiveRecord::Schema.define(version: 2018_08_27_143700) do
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
add_foreign_key "connections", "users"
add_foreign_key "connections", "users", column: "contact_id"
end