Forum archive 2000-2006

Danny Glin - Primary Keys in WeBWorK database

Danny Glin - Primary Keys in WeBWorK database

by Arnold Pizer -
Number of replies: 0
inactiveTopicPrimary Keys in WeBWorK database topic started 10/6/2006; 5:42:51 PM
last post 10/6/2006; 8:41:28 PM
userDanny Glin - Primary Keys in WeBWorK database  blueArrow
10/6/2006; 5:42:51 PM (reads: 165, responses: 1)
We've done some work at U of C integrating class lists and grades between WeBWorK and blackboard, which includes some manual writing to the webwork database, and we came across an interesting issue. Due to some unexpected situations one of our scripts wrote the same user into the database multiple times. Thus in several tables we have the same user_id appearing multiple times. As the user_id column is intended to be a unique identifier of a student within a course, it would make sense that this column be either a primary key or a unique index, whereas by default the key type for this column is set to 'MUL', allowing multiple instances of the same value.

Has anyone experimented with changing this value to either 'UNI' or 'PRI', or can anyone foresee any undesired side effects in doing so?

<| Post or View Comments |>


userSam Hathaway - Re: Primary Keys in WeBWorK database  blueArrow
10/6/2006; 8:41:28 PM (reads: 241, responses: 0)
Hi Danny,

You can go ahead and make user_id a primary key or unique index. You might also want to shorten the length of the user_id field to 255 characters or less, so that the index length encompasses the whole field. I'm currently working on revisions to the database layer that among other things make this the default. They are scheduled for inclusion in WW 2.4. -sam

<| Post or View Comments |>