Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Db setup #134

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions db/migrate/20210824213659_create_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateUsers < ActiveRecord::Migration[5.2]
def change
create_table :users do |t|
t.string :email
t.string :password_digest

t.timestamps
end
end
end
10 changes: 10 additions & 0 deletions db/migrate/20210824213804_create_friends.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateFriends < ActiveRecord::Migration[5.2]
def change
create_table :friends do |t|
t.references :user, foreign_key: true
t.references :friend, foreign_key: {to_table: :users}

t.timestamps
end
end
end
12 changes: 12 additions & 0 deletions db/migrate/20210824214725_create_viewing_party.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreateViewingParty < ActiveRecord::Migration[5.2]
def change
create_table :viewing_parties do |t|
t.references :host, foreign_key: {to_table: :users}
t.integer :duration
t.date :date
t.time :start_time

t.timestamps
end
end
end
10 changes: 10 additions & 0 deletions db/migrate/20210824215009_create_guests.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateGuests < ActiveRecord::Migration[5.2]
def change
create_table :guests do |t|
t.references :party, foreign_key: {to_table: :viewing_parties}
t.references :guest, foreign_key: {to_table: :users}

t.timestamps
end
end
end
58 changes: 58 additions & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2021_08_24_215009) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "friends", force: :cascade do |t|
t.bigint "user_id"
t.bigint "friend_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["friend_id"], name: "index_friends_on_friend_id"
t.index ["user_id"], name: "index_friends_on_user_id"
end

create_table "guests", force: :cascade do |t|
t.bigint "party_id"
t.bigint "guest_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["guest_id"], name: "index_guests_on_guest_id"
t.index ["party_id"], name: "index_guests_on_party_id"
end

create_table "users", force: :cascade do |t|
t.string "email"
t.string "password_digest"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "viewing_parties", force: :cascade do |t|
t.bigint "host_id"
t.integer "duration"
t.date "date"
t.time "start_time"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["host_id"], name: "index_viewing_parties_on_host_id"
end

add_foreign_key "friends", "users"
add_foreign_key "friends", "users", column: "friend_id"
add_foreign_key "guests", "users", column: "guest_id"
add_foreign_key "guests", "viewing_parties", column: "party_id"
add_foreign_key "viewing_parties", "users", column: "host_id"
end
15 changes: 15 additions & 0 deletions pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## All Submissions:
* [ ] Merge the target branch into the PR branch. Fix any conflicts that might appear.

### New Feature Submissions:
* [ ] Have you added an explanation of what your changes do?
* [ ] Have you lint your code locally prior to submission?

### Testing:
* [ ] Have you written new tests for your core changes, as applicable?
* [ ] Have you successfully ran tests with your changes locally?
* [ ] All new and existing tests passed.
* [ ] Have you run `rubocop` and fixed offenses?
**Test coverage** =
--------------------------------------------------------------------------------
### Change Log