User database 24 - #25
Conversation
|
tests forthcoming, wanted to get this out to be sure it's what people had in mind |
| class CreateTeams < ActiveRecord::Migration[5.0] | ||
| def change | ||
| create_table :teams do |t| | ||
| t.string :team_name |
There was a problem hiding this comment.
Should probably just call this 'name' so rails magic works
There was a problem hiding this comment.
aha, actually, unless someone has an objection I think I'll keep this name - just discovered that in the users table 'name' is actually the slack name, not the user's name. I'll add first_name and last_name fields, and maybe rename 'name' to slack_name.
Or would it be better to rename users => slack_users and add a separate users table that can be 1:1 with slack_users (and other online services as we add them)?
There was a problem hiding this comment.
yeah, first_name, last_name and slack_name sounds good. no need for an extra table right now :)
There was a problem hiding this comment.
I agree. Let's rename columns on the users table like you described and let's also shorten this table's team_name to name.
| create_table :team_members, :id => false do |t| | ||
| t.belongs_to :team | ||
| t.belongs_to :user | ||
| t.boolean :poc |
There was a problem hiding this comment.
Should add a default 'false'
| create_table "team_members", force: :cascade do |t| | ||
| t.integer "team_id" | ||
| t.integer "user_id" | ||
| t.boolean "poc" |
There was a problem hiding this comment.
point of contact - if true, this user is a poc for this team
There was a problem hiding this comment.
got it. I think, after the default, it's ready to be merged!
|
Hold off on merging this, still some issues, stand by |
|
Okay, was trying to be clever and remove the id from team_members, but since I'm working with the team_members relation as its own entity (i.e. the point_of_contact field), I'm pretty sure it needs the id field |
|
Do you mean having |
Adds the 'team' and 'team_members' tables, and the ability to edit same for users. Using :through, establish a many:many relationship between users and teams.