This is a database change script to update from 1.1 to HEAD, This will solve a lot of issues that existed. This will also migrate your data to the new database scheme.
Thank you BenjaminW for your help on this.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | quiz_update_N.pgsql_.patch | 11.14 KB | miccil |
| #14 | quiz_update_N.patch | 13.35 KB | westwesterson |
| #1 | quiz_update_N.patch | 13.24 KB | westwesterson |
| #3 | quiz_update_N.patch | 13.38 KB | westwesterson |
| quiz_update_N.patch | 13.22 KB | kylebrowning |
Comments
Comment #1
westwesterson commentedI actually had a chance to look this over again, and i haven't tested this yet, but i think you need to add additional { } around the database names in certain areas. This allows for users with a database prefix to use the tables without hacking the update file. I have provided a patch which should fix for this. For example:
$old_value = db_fetch_object(db_query("SELECT name,id FROM {sequences} WHERE name='%s'",'quiz_question_answer_aid'));should be
$old_value = db_fetch_object(db_query("SELECT name,id FROM {sequences} WHERE name='%s'",'{quiz_question_answer}_aid'));instead.
*Note this thread was originally at http://drupal.org/node/175568 but has been moved to this one, as it has more current information.
Comment #2
westwesterson commentedAdditionally, we should figure out if pgsql is going into this next release, and if that is the case either we need to make sure that grab_old_quiz_data() is cross compatible with both databases or contained within the mysql switch.
And also we probably want to rename grab old quiz data to something different like quiz_update_schema_1-1_2-0() in case of another schema update later down the road. This also makes sure that it is within the quiz namespace.
Comment #3
westwesterson commentedhere i implemented the above changes to the patch. Renamed grab_old_quiz_data() to quiz_data_update_2() and moved the function call inside of mysql switch case. If this is a universal patch please correct this.
I also ran the module through coder and found a few nit-picky coding standards fixes. And fixed a few more documentation errors.
Comment #4
kylebrowning commentedI tested this and it is still working.
:)
Comment #5
westwesterson commentedWorks beautifully even on complicated installs. Committed after thorough testing. Good Job!
Comment #7
westwesterson commentedI have found a number of errors with the update_N function, despite my above comments. The number of questions after conversions is skewed. I have a quiz with 2 questions, but after the update it thinks there are 4 in the quiz.
The user results also don't show up correctly. I will look into this more, i have again taken this patch out from the head as it is not stable, I consider potentially loosing results unstable. (This may simply be a shift of result ids, but i have to look into this more.)
Comment #8
senpai commentedMarking as critical, cause anything that sorta looses data is sorta a bad thing. And stuff.
Comment #9
kylebrowning commentedWell, the reason it doubles i believe is b/c we dont delete the old tables maybe?
Comment #10
westwesterson commentedthis might have something to do with some faulty info from quiz version 1.1. In that version number_of_questions was a mess, and is not a reliable method for counting the number of questions. And this number if i remember correctly applied to the whole module, not just random questions. So basically I think this is a quiz 1.1 flaw, the conversion here seems right, but the way the numbering system worked in 1.1 was really buggy.
Comment #11
kylebrowning commentedIs there any sort of way we can handle this programmatically or should we offer a patch to 1.1 with this upgrade script?
Comment #12
westwesterson commentedWe shouldn't rely on operations which take the number of questions from the previous database, and instead we can extract that information when we de-serialize arrays. We should check into similar functionality for result ids to see whats going on there too.
Comment #13
kscheirersounds like we should generate a new number_of_questions based on the actual number found for that node. To go along with that we should be setting the number of random questions as
(old)number_of_questions - #actually founddoes that make sense?
Comment #14
westwesterson commentedheres a modified patch which sets the number of random questions to zero. (Not ideal but works better than messing up every quiz. Though there is still data loss, the data just might not be worth keeping.)
If we are to correct this we probably will need to add another level of recursion. Is an O(n^2) query still something that can be handled on a large site? Is this ok, because it is a one time operation? or should we let users re-do their number of random questions?
Comment #15
westwesterson commentedcommiting this so it can be tested. We still need to make this compatable with postgresql.
Comment #16
miccil commentedThis is my version con pgsql update code.
For db schema update it seems to work,
but for data I don't know because quiz 5x-1.1
is too much buggy for inserting something with pgsql.
Comment #17
westwesterson commentedassuming this works well enough for beta, i'm going to submit this as well
Comment #18
senpai commentedYeah, go head. I mean, this is the only way to get things tested in real-time. Commit it.
Comment #19
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.