Fix for bug 2742 - sequences out of sequences in postgres

This commit is contained in:
mjollnir_
2005-03-15 22:57:15 +00:00
parent 0e6a20f493
commit 92ac9fe4f4
3 changed files with 18 additions and 1 deletions
+5
View File
@@ -32,6 +32,11 @@ function survey_upgrade($oldversion) {
modify_database('','CREATE INDEX prefix_survey_answers_survey_idx ON prefix_survey_answers (survey);');
modify_database('','CREATE INDEX prefix_survey_answers_question_idx ON prefix_survey_answers (question);');
}
if ($oldversion < 2004060402) {
execute_sql('SELECT setval(\''.$CFG->prefix.'survey_id_seq\', (select max(id) from '.$CFG->prefix.'survey))');
execute_sql('SELECT setval(\''.$CFG->prefix.'survey_questions_id_seq\', (select max(id) from '.$CFG->prefix.'survey_questions))');
}
return true;
}
+12
View File
@@ -39,6 +39,12 @@ INSERT INTO prefix_survey (id, course, template, days, timecreated, timemodified
INSERT INTO prefix_survey (id, course, template, days, timecreated, timemodified, name, intro, questions) VALUES (5, 0, 0, 0, 985017600, 985017600, 'ciqname', 'ciqintro', '69,70,71,72,73');
# Reset the sequence. doing it this way rather than simply taking out
# id from the preceeding sql to avoid missing fks.
SELECT setval('prefix_survey_id_seq', (select max(id) from prefix_survey));
#
# Table structure for table survey_analysis
@@ -177,6 +183,12 @@ INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, op
INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (72, 'ciq4', 'ciq4short', '', '', 0, '');
INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (73, 'ciq5', 'ciq5short', '', '', 0, '');
# Reset the sequence. doing it this way rather than simply taking out
# id from the preceeding sql to avoid missing fks.
SELECT setval('prefix_survey_questions_id_seq', (select max(id) from prefix_survey_questions));
#
# Dumping data for table log_display
#
+1 -1
View File
@@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2004060401;
$module->version = 2004060402;
$module->requires = 2004052505; // Requires this Moodle version
$module->cron = 0;