I don't see any reason why the row cid could not have a primary key, this would make using drupal_write_record easier -> for updates
I don't see any reason why the row cid could not have a primary key, this would make using drupal_write_record easier -> for updates
Comments
Comment #1
dwwYup, sounds like a good idea. Moving to the right queue and giving a more accurate title/category... Feel free to provide a patch for this. Let's just leave this issue for the changes to project_issue_schema() and a DB update function to add the primary key to existing sites. We can do things like drupal_write_record() in followup issues + patches. Thanks.
Comment #2
dww(sorry, wishful thinking typo) ;)
Comment #3
dwwd.o already has this field as the primary key for this table. ;) pretty trivial patch. not sure if there's a trivial way to test for if the table already has a primary key or not.
Comment #4
hunmonk commentedi'm confused. describe project_issue_comments; in my local project install shows that cid is already the primary key on that table -- lord knows that i didn't do that manually. but i don't see the primary key in the schema, so what gives??
Comment #5
dwwProbably a regression during the D6 port.
Comment #6
dwwYup. In D5, we have this:
Comment #7
dwwThere's no easy, portable way to find out if this table already has a primary key in D6 (and probably not D7, either). I don't feel like duplicating 100 lines of schema.module for different DBs to do this, so let's just tell the user they can ignore warnings and failures in this update if they happen. 3 options:
A) Show everything, including the failed query, but drupal_set_message() that everything's okay.
B) If the query fails, return success with a message they can ignore warnings. This way, at least the update isn't listed as a failure, but I fear people will see the red warning at the top of the page and miss the message they can ignore it.
C) If the query fails, drupal_set_message() that they can ignore the warning, and just say the update didn't run any queries at all.
Patches and screenies for each attached...
I think I prefer (C).
Comment #8
hunmonk commenteda) and c) are bad ideas, as the drupal_set_message() gets clobbered if the update batches. it sucks i know, but it's just the way it is -- i've already been bitten by that in another module i maintain. b) is the most reliable way to go...
Comment #9
dwwCommitted B to HEAD, though I wrapped the message in
<strong>tags to be more visible.Should deploy this for real, just so no one worries about the pending DB update or something...
Comment #10
dwwSynced code to SVN and deployed revision 1660 on d.o.