mirror of
https://github.com/beatriceo/polyglot.git
synced 2025-10-21 09:19:59 +00:00
created channel for action cable and friendship relationship in database
This commit is contained in:
8
db/migrate/20180827151325_create_connections.rb
Normal file
8
db/migrate/20180827151325_create_connections.rb
Normal 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
|
11
db/schema.rb
11
db/schema.rb
@@ -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
|
||||
|
Reference in New Issue
Block a user