当前位置: 首页>>代码示例>>PHP>>正文


PHP table_column函数代码示例

本文整理汇总了PHP中table_column函数的典型用法代码示例。如果您正苦于以下问题:PHP table_column函数的具体用法?PHP table_column怎么用?PHP table_column使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了table_column函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: slideshow_upgrade

function slideshow_upgrade($oldversion)
{
    /// This function does anything necessary to upgrade
    /// older versions to match current functionality
    global $CFG;
    if ($oldversion < 2006112100) {
        table_column('slideshow', '', 'layout', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    if ($oldversion < 2006092600) {
        table_column('slideshow', '', 'location', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    if ($oldversion < 2006012600) {
        table_column('slideshow', '', 'filename', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    if ($oldversion < 2006112700) {
        modify_database('', "CREATE TABLE " . $CFG->prefix . "slideshow_captions (\r\n              id SERIAL PRIMARY KEY,\r\n              slideshow integer NOT NULL default '0',\r\n              image text NOT NULL,\r\n              title text NOT NULL,\r\n              caption text NOT NULL\r\n            )\r\n        ");
    }
    if ($oldversion < 2007070702) {
        table_column('slideshow', '', 'delaytime', 'int', '2', 'unsigned', '7', 'not null', '');
    }
    if ($oldversion < 2007070703) {
        table_column('slideshow', '', 'centred', 'int', '2', 'unsigned', '0', 'not null', '');
        table_column('slideshow', '', 'autobgcolor', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    return true;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:26,代码来源:postgres7.php

示例2: backup_upgrade

function backup_upgrade($oldversion = 0)
{
    global $CFG;
    $result = true;
    if ($oldversion < 2006011600 and $result) {
        $result = execute_sql("DROP TABLE {$CFG->prefix}backup_files");
        if ($result) {
            $result = execute_sql("CREATE TABLE {$CFG->prefix}backup_files (\n                          id SERIAL PRIMARY KEY,\n                          backup_code integer NOT NULL default '0',\n                          file_type varchar(10) NOT NULL default '',\n                          path varchar(255) NOT NULL default '',\n                          old_id integer default NULL,\n                          new_id integer default NULL,\n                          CONSTRAINT {$CFG->prefix}backup_files_uk UNIQUE (backup_code, file_type, path))");
        }
        if ($result) {
            $result = execute_sql("DROP TABLE {$CFG->prefix}backup_ids");
        }
        if ($result) {
            $result = execute_sql("CREATE TABLE {$CFG->prefix}backup_ids (\n                          id SERIAL PRIMARY KEY,\n                          backup_code integer NOT NULL default '0',\n                          table_name varchar(30) NOT NULL default '',\n                          old_id integer NOT NULL default '0',\n                          new_id integer default NULL,\n                          info text,\n                          CONSTRAINT {$CFG->prefix}backup_ids_uk UNIQUE (backup_code, table_name, old_id))");
        }
    }
    if ($oldversion < 2006042801) {
        table_column('backup_log', 'time', 'time', 'integer', '', '', '0');
        table_column('backup_log', 'laststarttime', 'laststarttime', 'integer', '', '', '0');
        table_column('backup_log', 'courseid', 'courseid', 'integer', '', '', '0');
        table_column('backup_courses', 'lastendtime', 'lastendtime', 'integer', '', '', '0');
        table_column('backup_courses', 'laststarttime', 'laststarttime', 'integer', '', '', '0');
        table_column('backup_courses', 'courseid', 'courseid', 'integer', '', '', '0');
        table_column('backup_courses', 'nextstarttime', 'nextstarttime', 'integer', '', '', '0');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    //Finally, return result
    return $result;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:29,代码来源:postgres7.php

示例3: slideshow_upgrade

function slideshow_upgrade($oldversion)
{
    /// This function does anything necessary to upgrade
    /// older versions to match current functionality
    global $CFG;
    if ($oldversion < 2006112100) {
        table_column('slideshow', '', 'layout', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    if ($oldversion < 2006092600) {
        table_column('slideshow', '', 'location', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    if ($oldversion < 2006012600) {
        table_column('slideshow', '', 'filename', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    if ($oldversion < 2006120500) {
        modify_database('', "CREATE TABLE `" . $CFG->prefix . "slideshow_captions` (\r\n                    `id` int(10) unsigned NOT NULL auto_increment,\r\n                    `slideshow` int(10) unsigned NOT NULL default '0',\r\n                    `image` text NOT NULL,\r\n                    `title` text NOT NULL,\r\n                    `caption` text NOT NULL,\r\n                    PRIMARY KEY  (`id`),\r\n                    KEY slideshow (slideshow)\r\n                    );\r\n        ");
    }
    if ($oldversion < 2007070702) {
        table_column('slideshow', '', 'delaytime', 'int', '2', 'unsigned', '7', 'not null', '');
    }
    if ($oldversion < 2007070703) {
        table_column('slideshow', '', 'centred', 'int', '2', 'unsigned', '0', 'not null', '');
        table_column('slideshow', '', 'autobgcolor', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    return true;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:26,代码来源:mysql.php

示例4: resource_upgrade

function resource_upgrade($oldversion)
{
    // This function does anything necessary to upgrade
    // older versions to match current functionality
    global $CFG;
    if ($oldversion < 2004013101) {
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('resource', 'update', 'resource', 'name');");
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('resource', 'add', 'resource', 'name');");
    }
    if ($oldversion < 2004071000) {
        table_column("resource", "", "popup", "text", "", "", "", "", "alltext");
        if ($resources = get_records_select("resource", "type='3' OR type='5'", "", "id, alltext")) {
            foreach ($resources as $resource) {
                $resource->popup = addslashes($resource->alltext);
                $resource->alltext = "";
                if (!update_record("resource", $resource)) {
                    notify("Error updating popup field for resource id = {$resource->id}");
                }
            }
        }
        require_once "{$CFG->dirroot}/course/lib.php";
        rebuild_course_cache();
    }
    if ($oldversion < 2004071300) {
        table_column("resource", "", "options", "varchar", "255", "", "", "", "popup");
    }
    if ($oldversion < 2004071303) {
        table_column("resource", "type", "type", "varchar", "30", "", "", "", "");
        modify_database("", "UPDATE prefix_resource SET type='reference' WHERE type='1';");
        modify_database("", "UPDATE prefix_resource SET type='file', options='frame' WHERE type='2';");
        modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='3';");
        modify_database("", "UPDATE prefix_resource SET type='text', options='0' WHERE type='4';");
        modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='5';");
        modify_database("", "UPDATE prefix_resource SET type='html' WHERE type='6';");
        modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='7';");
        modify_database("", "UPDATE prefix_resource SET type='text', options='3' WHERE type='8';");
        modify_database("", "UPDATE prefix_resource SET type='directory' WHERE type='9';");
    }
    if ($oldversion < 2004080801) {
        modify_database("", "UPDATE prefix_resource SET alltext=reference,type='html' WHERE type='reference';");
        rebuild_course_cache();
    }
    if ($oldversion < 2004111200) {
        //drop first to avoid conflicts when upgrading
        execute_sql("DROP INDEX {$CFG->prefix}resource_course_idx;", false);
        modify_database('', 'CREATE INDEX prefix_resource_course_idx ON prefix_resource (course);');
    }
    if ($oldversion < 2005041100) {
        // replace wiki-like with markdown
        include_once "{$CFG->dirroot}/lib/wiki_to_markdown.php";
        $wtm = new WikiToMarkdown();
        $wtm->update('resource', 'alltext', 'options');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:56,代码来源:postgres7.php

示例5: qtype_multichoice_upgrade

function qtype_multichoice_upgrade($oldversion = 0)
{
    global $CFG;
    $success = true;
    if ($success && $oldversion < 2006081900) {
        $success = $success && table_column('question_multichoice', '', 'correctfeedback', 'text', '', '', '');
        $success = $success && table_column('question_multichoice', '', 'partiallycorrectfeedback', 'text', '', '', '');
        $success = $success && table_column('question_multichoice', '', 'incorrectfeedback', 'text', '', '', '');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return $success;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:12,代码来源:postgres7.php

示例6: chat_upgrade

function chat_upgrade($oldversion)
{
    // This function does anything necessary to upgrade
    // older versions to match current functionality
    global $CFG;
    if ($oldversion < 2003072100) {
        modify_database("", " INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'report', 'chat', 'name'); ");
    }
    if ($oldversion < 2003072101) {
        table_column("chat", "messages", "keepdays", "integer", "10", "unsigned", "0", "not null");
    }
    if ($oldversion < 2003072102) {
        table_column("chat", "", "studentlogs", "integer", "4", "unsigned", "0", "not null", "keepdays");
    }
    if ($oldversion < 2003072500) {
        table_column("chat", "", "chattime", "integer", "10", "unsigned", "0", "not null", "studentlogs");
        table_column("chat", "", "schedule", "integer", "4", "", "0", "not null", "studentlogs");
    }
    if ($oldversion < 2004022300) {
        table_column("chat_messages", "", "groupid", "integer", "10", "unsigned", "0", "not null", "userid");
        table_column("chat_users", "", "groupid", "integer", "10", "unsigned", "0", "not null", "userid");
    }
    if ($oldversion < 2004042500) {
        include_once "{$CFG->dirroot}/mod/chat/lib.php";
        chat_refresh_events();
    }
    if ($oldversion < 2004043000) {
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'talk', 'chat', 'name');");
    }
    if ($oldversion < 2004111200) {
        execute_sql("ALTER TABLE {$CFG->prefix}chat DROP INDEX `course`;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}chat_messages DROP INDEX  `chatid`;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}chat_messages DROP INDEX `userid`;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}chat_messages DROP INDEX `groupid`;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}chat_users DROP INDEX  `chatid`;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}chat_users DROP INDEX  `groupid`;", false);
        modify_database('', 'ALTER TABLE prefix_chat ADD INDEX `course` (`course`);');
        modify_database('', 'ALTER TABLE prefix_chat_messages ADD INDEX  `chatid` (`chatid`);');
        modify_database('', 'ALTER TABLE prefix_chat_messages ADD INDEX `userid` (`userid`);');
        modify_database('', 'ALTER TABLE prefix_chat_messages ADD INDEX `groupid` (`groupid`);');
        modify_database('', 'ALTER TABLE prefix_chat_users ADD INDEX  `chatid` (`chatid`);');
        modify_database('', 'ALTER TABLE prefix_chat_users ADD INDEX  `groupid` (`groupid`);');
    }
    if ($oldversion < 2005020300) {
        table_column('chat_users', '', 'course', 'integer', '10', 'unsigned', '0', 'not null', '');
        table_column('chat_users', '', 'lang', 'varchar', '10', '', '', 'not null', '');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:50,代码来源:mysql.php

示例7: exercise_upgrade

function exercise_upgrade($oldversion)
{
    // This function does anything necessary to upgrade
    // older versions to match current functionality
    global $CFG;
    if ($oldversion < 2003111400) {
        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD INDEX (`userid`)");
        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` DROP INDEX `title`");
        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_assessments` ADD INDEX (`submissionid`)");
        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_assessments` ADD INDEX (`userid`)");
        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_grades` ADD INDEX (`assessmentid`)");
    }
    if ($oldversion < 2003121000) {
        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD `late` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0'");
    }
    if ($oldversion < 2004062300) {
        table_column("exercise", "", "gradinggrade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
        table_column("exercise", "", "assessmentcomps", "INTEGER", "4", "UNSIGNED", "2", "NOT NULL", "usemaximum");
        execute_sql("ALTER TABLE `{$CFG->prefix}exercise` DROP COLUMN `teacherweight`");
        execute_sql("ALTER TABLE `{$CFG->prefix}exercise` DROP COLUMN `gradingweight`");
    }
    if ($oldversion < 2004090200) {
        table_column("exercise", "", "usepassword", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL");
        table_column("exercise", "", "password", "VARCHAR", "32", "", "", "NOT NULL");
    }
    if ($oldversion < 2004091000) {
        table_column("exercise_assessments", "generalcomment", "generalcomment", "text", "", "", "", "NOT NULL");
        table_column("exercise_assessments", "teachercomment", "teachercomment", "text", "", "", "", "NOT NULL");
    }
    if ($oldversion < 2004100800) {
        include_once "{$CFG->dirroot}/mod/exercise/lib.php";
        exercise_refresh_events();
    }
    if ($oldversion < 2004111200) {
        execute_sql("ALTER TABLE {$CFG->prefix}exercise DROP INDEX course;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}exercise_submissions DROP INDEX exerciseid;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}exercise_assessments DROP INDEX exerciseid;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}exercise_elements DROP INDEX exerciseid;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}exercise_rubrics DROP INDEX exerciseid;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}exercise_grades DROP INDEX exerciseid;", false);
        modify_database('', 'ALTER TABLE prefix_exercise ADD INDEX course (course);');
        modify_database('', 'ALTER TABLE prefix_exercise_submissions ADD INDEX exerciseid (exerciseid);');
        modify_database('', 'ALTER TABLE prefix_exercise_assessments ADD INDEX exerciseid (exerciseid);');
        modify_database('', 'ALTER TABLE prefix_exercise_elements ADD INDEX exerciseid (exerciseid);');
        modify_database('', 'ALTER TABLE prefix_exercise_rubrics ADD INDEX exerciseid (exerciseid);');
        modify_database('', 'ALTER TABLE prefix_exercise_grades ADD INDEX exerciseid (exerciseid);');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:50,代码来源:mysql.php

示例8: chat_upgrade

function chat_upgrade($oldversion)
{
    // This function does anything necessary to upgrade
    // older versions to match current functionality
    global $CFG;
    if ($oldversion < 2004022300) {
        table_column("chat_messages", "", "groupid", "integer", "10", "unsigned", "0", "not null", "userid");
        table_column("chat_users", "", "groupid", "integer", "10", "unsigned", "0", "not null", "userid");
    }
    if ($oldversion < 2004042500) {
        include_once "{$CFG->dirroot}/mod/chat/lib.php";
        chat_refresh_events();
    }
    if ($oldversion < 2004043000) {
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'talk', 'chat', 'name');");
    }
    if ($oldversion < 2004111200) {
        //drop them first to avoid collisions with upgrades from 1.4.2+
        execute_sql("DROP INDEX {$CFG->prefix}chat_course_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_messages_chatid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_messages_userid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_messages_groupid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_messages_timemodifiedchatid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_users_chatid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_users_userid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_users_groupid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_users_lastping_idx;", false);
        modify_database('', 'CREATE INDEX prefix_chat_course_idx ON prefix_chat(course);');
        modify_database('', 'CREATE INDEX prefix_chat_messages_chatid_idx ON prefix_chat_messages (chatid);');
        modify_database('', 'CREATE INDEX prefix_chat_messages_userid_idx ON prefix_chat_messages (userid);');
        modify_database('', 'CREATE INDEX prefix_chat_messages_groupid_idx ON prefix_chat_messages (groupid);');
        modify_database('', 'CREATE INDEX prefix_chat_messages_timemodifiedchatid_idx ON prefix_chat_messages(timestamp,chatid);');
        modify_database('', 'CREATE INDEX prefix_chat_users_chatid_idx ON prefix_chat_users (chatid);');
        modify_database('', 'CREATE INDEX prefix_chat_users_userid_idx ON prefix_chat_users (userid);');
        modify_database('', 'CREATE INDEX prefix_chat_users_groupid_idx ON prefix_chat_users (groupid);');
        modify_database('', 'CREATE INDEX prefix_chat_users_lastping_idx ON prefix_chat_users (lastping);');
    }
    if ($oldversion < 2005020300) {
        table_column('chat_users', '', 'course', 'integer', '10', 'unsigned', '0', 'not null', '');
        table_column('chat_users', '', 'lang', 'varchar', '10', '', '', 'not null', '');
    }
    if ($oldversion < 2005031001) {
        // Mass cleanup of bad upgrade scripts
        modify_database('', 'ALTER TABLE prefix_chat_users ALTER course SET NOT NULL');
        modify_database('', 'ALTER TABLE prefix_chat_users ALTER lang SET NOT NULL');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:49,代码来源:postgres7.php

示例9: journal_upgrade

function journal_upgrade($oldversion)
{
    // This function does anything necessary to upgrade
    // older versions to match current functionality
    global $CFG;
    $result = true;
    if ($oldversion < 2003081705) {
        $defaultscale = NULL;
        $defaultscale->courseid = 0;
        $defaultscale->userid = 0;
        $defaultscale->timemodified = time();
        $defaultscale->name = get_string("journalrating2", "journal");
        $defaultscale->scale = get_string("journalrating1", "journal") . "," . get_string("journalrating2", "journal") . "," . get_string("journalrating3", "journal");
        if ($defaultscale->id = insert_record("scale", $defaultscale)) {
            execute_sql("UPDATE {$CFG->prefix}journal SET assessed = '-{$defaultscale->id}'", false);
        } else {
            notify("An error occurred while inserting the default journal scale");
            $result = false;
        }
    }
    if ($oldversion < 2004011400) {
        table_column("journal", "", "introformat", "integer", "2", "", "1", "not null", "intro");
    }
    if ($oldversion < 2004111200) {
        execute_sql("DROP INDEX {$CFG->prefix}journal_course_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}journal_entries_journal_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}journal_entries_userid_idx;", false);
        modify_database('', 'CREATE INDEX prefix_journal_course_idx ON prefix_journal (course);');
        modify_database('', 'CREATE INDEX prefix_journal_entries_journal_idx ON prefix_journal_entries (journal);');
        modify_database('', 'CREATE INDEX prefix_journal_entries_userid_idx ON prefix_journal_entries (userid);');
    }
    if ($oldversion < 2005041100) {
        // replace wiki-like with markdown
        include_once "{$CFG->dirroot}/lib/wiki_to_markdown.php";
        $wtm = new WikiToMarkdown();
        // journal intro
        $wtm->update('journal', 'intro', 'introformat');
        // journal entries
        $sql = "select course from {$CFG->prefix}journal, {$CFG->prefix}journal_entries ";
        $sql .= "where {$CFG->prefix}journal.id = {$CFG->prefix}journal_entries.journal ";
        $sql .= "and {$CFG->prefix}journal_entries.id = ";
        $wtm->update('journal_entries', 'text', 'format', $sql);
    }
    if ($oldversion < 2006092100) {
        table_column('journal_entries', 'comment', 'entrycomment', 'text', '', '', '', 'null');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return $result;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:49,代码来源:postgres7.php

示例10: main_upgrade

function main_upgrade($oldversion = 0)
{
    global $CFG, $db, $METATABLES;
    $result = true;
    if ($oldversion < 2007062601) {
        modify_database("", "\n            CREATE TABLE `{$CFG->prefix}extauth_hash` (\n              `id` int(11) NOT NULL auto_increment,\n              `login` varchar(15) NOT NULL default '',\n              `hash` varchar(32) NOT NULL default '',\n              `time` timestamp NOT NULL default CURRENT_TIMESTAMP,\n              PRIMARY KEY (`id`));");
        $METATABLES = $db->Metatables();
        // table added/removed without using modify_database()
        // set initial value for auth config
        set_config('auth', '');
    }
    if ($oldversion < 2007062602) {
        table_column('ponente', 'domicilio', 'domicilio', 'varchar', '255', '', '');
    }
    return $result;
}
开发者ID:BackupTheBerlios,项目名称:yupana,代码行数:16,代码来源:mysql.php

示例11: survey_upgrade

function survey_upgrade($oldversion)
{
    // This function does anything necessary to upgrade
    // older versions to match current functionality
    global $CFG;
    if ($oldversion < 2004021601) {
        modify_database("", "INSERT INTO `prefix_survey` (`course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (0, 0, 0, 985017600, 985017600, 'ciqname', 'ciqintro', '69,70,71,72,73')");
        modify_database("", "INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (69, 'ciq1', 'ciq1short', '', '', 0, '')");
        modify_database("", "INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (70, 'ciq2', 'ciq2short', '', '', 0, '')");
        modify_database("", "INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (71, 'ciq3', 'ciq3short', '', '', 0, '')");
        modify_database("", "INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (72, 'ciq4', 'ciq4short', '', '', 0, '')");
        modify_database("", "INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (73, 'ciq5', 'ciq5short', '', '', 0, '')");
    }
    if ($oldversion < 2004021602) {
        table_column("survey_answers", "answer1", "answer1", "text", "", "", "");
        table_column("survey_answers", "answer2", "answer2", "text", "", "", "");
    }
    if ($oldversion < 2004021900) {
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'add', 'survey', 'name');");
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'update', 'survey', 'name');");
    }
    if ($oldversion < 2004111200) {
        execute_sql("DROP INDEX {$CFG->prefix}survey_course_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}survey_analysis_survey_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}survey_analysis_userid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}survey_answers_userid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}survey_answers_survey_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}survey_answers_question_idx;", false);
        modify_database('', 'CREATE INDEX prefix_survey_course_idx ON prefix_survey (course);');
        modify_database('', 'CREATE INDEX prefix_survey_analysis_survey_idx ON prefix_survey_analysis (survey);');
        modify_database('', 'CREATE INDEX prefix_survey_analysis_userid_idx ON prefix_survey_analysis (userid);');
        modify_database('', 'CREATE INDEX prefix_survey_answers_userid_idx ON prefix_survey_answers (userid);');
        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 < 2005031600) {
        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))');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:42,代码来源:postgres7.php

示例12: label_upgrade

function label_upgrade($oldversion)
{
    /// This function does anything necessary to upgrade
    /// older versions to match current functionality
    global $CFG;
    if ($oldversion < 2003091400) {
        table_column("label", "", "course", "integer", "10", "unsigned", "0", "not null", "id");
    }
    if ($oldversion < 2004021900) {
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('label', 'add', 'label', 'name');");
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('label', 'update', 'label', 'name');");
    }
    if ($oldversion < 2004111200) {
        //DROP first
        execute_sql("DROP INDEX {$CFG->prefix}label_course_idx;", false);
        modify_database('', 'CREATE INDEX prefix_label_course_idx ON prefix_label (course);');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:20,代码来源:postgres7.php

示例13: tab_upgrade

function tab_upgrade($oldversion)
{
    /// This function does anything necessary to upgrade
    /// older versions to match current functionality
    global $CFG;
    if ($oldversion < 2008071159) {
        table_column("tab", "", "course", "integer", "10", "unsigned", "0", "not null", "id");
    }
    if ($oldversion < 2008071159) {
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('tab', 'add', 'quiz', 'name');");
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('tab', 'update', 'quiz', 'name');");
    }
    if ($oldversion < 2008071159) {
        //DROP first
        execute_sql("ALTER TABLE {$CFG->prefix}tab DROP INDEX course;", false);
        modify_database('', 'ALTER TABLE prefix_tab ADD INDEX course (course);');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:20,代码来源:mysql.php

示例14: elluminate_upgrade

function elluminate_upgrade($oldversion)
{
    /// This function does anything necessary to upgrade
    /// older versions to match current functionality
    global $CFG;
    $result = true;
    if ($oldversion < 2006062100) {
        $result = modify_database('', "\n            CREATE TABLE `prefix_elluminate` (\n                `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,\n                `course` INT(10) UNSIGNED NOT NULL DEFAULT '0',\n                `creator` INT(10) UNSIGNED NOT NULL DEFAULT '0',\n                `name` VARCHAR(64) NOT NULL DEFAULT '',\n                `description` TEXT NOT NULL DEFAULT '',\n                `meetingid` VARCHAR(20) NOT NULL DEFAULT 0,\n                `private` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,\n                `grade` INT(10) NOT NULL DEFAULT '0',\n                `timemodified` INT(10) UNSIGNED NOT NULL DEFAULT '0',\n                PRIMARY KEY  (`id`),\n                KEY `meetingid` (`meetingid`)\n            )\n        ");
        if ($result) {
            $result = modify_database('', "\n                CREATE TABLE `prefix_elluminate_recordings` (\n                    `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,\n                    `meetingid` VARCHAR(20) NOT NULL DEFAULT '',\n                    `recordingid` VARCHAR(30) NOT NULL DEFAULT '',\n                    `created` INT(10) UNSIGNED NOT NULL DEFAULT '0',\n                    PRIMARY KEY `id` (`id`),\n                    KEY `meetingid` (`meetingid`),\n                    KEY `recordingid` (`recordingid`)\n                )\n            ");
        }
        if ($result) {
            $result = modify_database('', "\n                CREATE TABLE `prefix_elluminate_users` (\n                    `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,\n                    `userid` INT(10) UNSIGNED NOT NULL DEFAULT '0',\n                    `elm_id` VARCHAR(20) NOT NULL DEFAULT '',\n                    `elm_password` VARCHAR(10) NOT NULL DEFAULT '',\n                    `timecreated` INT(10) UNSIGNED NOT NULL DEFAULT '0',\n                    PRIMARY KEY `id` (`id`),\n                    KEY `userid` (`userid`),\n                    KEY `elm_id` (`elm_id`)\n                )\n            ");
        }
        if ($result) {
            $result = modify_database('', "\n                CREATE TABLE `prefix_elluminate_attendance` (\n                    `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,\n                    `userid` INT(10) UNSIGNED NOT NULL DEFAULT '0',\n                    `elluminateid` INT(10) UNSIGNED NOT NULL DEFAULT '0',\n                    `grade` INT(11) NOT NULL DEFAULT '0',\n                    `timemodified` INT(10) UNSIGNED NOT NULL DEFAULT '0',\n                    PRIMARY KEY `id` (`id`),\n                    KEY `userid_elluminateid` (`userid`, `elluminateid`)\n                )\n            ");
        }
        /*
                if ($result) {
                    $result = modify_database('', "
                        CREATE TABLE `prefix_event_reminder` (
                            `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
                            `event` INT(10) UNSIGNED NOT NULL DEFAULT '0',
                            `type` INT(1) UNSIGNED NOT NULL DEFAULT '0',
                            `timedelta` INT(10) UNSIGNED NOT NULL DEFAULT '0',
                            `timeinterval` INT(10) UNSIGNED NOT NULL DEFAULT '0',
                            `timeend` INT(10) UNSIGNED NOT NULL DEFAULT '0',
                            PRIMARY KEY(`id`)
                        );
                    ");
                }
        */
    }
    if ($oldversion < 2006062101) {
        $result = table_column('elluminate_users', '', 'elm_username', 'VARCHAR', '50', '', '', 'NOT NULL', 'elm_id');
    }
    if ($oldversion < 2006062102) {
        $result = table_column('elluminate', '', 'seats', 'INTEGER', '10', 'UNSIGNED', '0', 'NOT NULL', 'meetingid');
    }
    return $result;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:41,代码来源:mysql.php

示例15: exercise_upgrade

function exercise_upgrade($oldversion)
{
    // This function does anything necessary to upgrade
    // older versions to match current functionality
    global $CFG;
    if ($oldversion < 2004062300) {
        table_column("exercise", "", "gradinggrade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
        table_column("exercise", "", "assessmentcomps", "INTEGER", "4", "UNSIGNED", "2", "NOT NULL", "usemaximum");
    }
    if ($oldversion < 2004090200) {
        table_column("exercise", "", "usepassword", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL");
        table_column("exercise", "", "password", "VARCHAR", "32", "", "", "NOT NULL");
    }
    if ($oldversion < 2004091000) {
        table_column("exercise_assessments", "generalcomment", "generalcomment", "text", "", "", "", "NOT NULL");
        table_column("exercise_assessments", "teachercomment", "teachercomment", "text", "", "", "", "NOT NULL");
    }
    if ($oldversion < 2004100800) {
        include_once "{$CFG->dirroot}/mod/exercise/lib.php";
        exercise_refresh_events();
    }
    if ($oldversion < 2004111200) {
        execute_sql("DROP INDEX {$CFG->prefix}exercise_course_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}exercise_submissions_exerciseid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}exercise_assessments_exerciseid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}exercise_rubrics_exerciseid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}exercise_grades_exerciseid_idx;", false);
        modify_database('', 'CREATE INDEX prefix_exercise_course_idx ON prefix_exercise (course);');
        modify_database('', 'CREATE INDEX prefix_exercise_submissions_exerciseid_idx ON prefix_exercise_submissions (exerciseid);');
        modify_database('', 'CREATE INDEX prefix_exercise_assessments_exerciseid_idx ON prefix_exercise_assessments (exerciseid);');
        modify_database('', 'CREATE INDEX prefix_exercise_rubrics_exerciseid_idx ON prefix_exercise_rubrics (exerciseid);');
        modify_database('', 'CREATE INDEX prefix_exercise_grades_exerciseid_idx ON prefix_exercise_grades (exerciseid);');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:36,代码来源:postgres7.php


注:本文中的table_column函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。