Skip to content

Commit

Permalink
Implement courses table in PP.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwinn committed Jan 15, 2019
1 parent 0370f94 commit 8148c47
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
17 changes: 16 additions & 1 deletion db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<INDEX NAME="externalid" UNIQUE="false" FIELDS="externalid" />
</INDEXES>
</TABLE>
<TABLE NAME="plagiarism_turnitin_config" COMMENT="info about submitted files" PREVIOUS="plagiarism_turnitin_files">
<TABLE NAME="plagiarism_turnitin_config" COMMENT="info about submitted files" PREVIOUS="plagiarism_turnitin_files" NEXT="plagiarism_turnitin_courses">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="cm"/>
<FIELD NAME="cm" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="id" NEXT="name"/>
Expand All @@ -49,5 +49,20 @@
<KEY NAME="cm" TYPE="foreign" FIELDS="cm" REFTABLE="course_modules" REFFIELDS="id" ONDELETE="cascade" PREVIOUS="primary"/>
</KEYS>
</TABLE>
<TABLE NAME="plagiarism_turnitin_courses" COMMENT="Turnitin Plagiarism Plugin Courses" PREVIOUS="plagiarism_turnitin_config">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" NEXT="courseid"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" PREVIOUS="id" NEXT="ownerid"/>
<FIELD NAME="ownerid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" PREVIOUS="courseid" NEXT="turnitin_ctl"/>
<FIELD NAME="turnitin_ctl" TYPE="text" LENGTH="medium" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" PREVIOUS="ownerid" NEXT="turnitin_cid"/>
<FIELD NAME="turnitin_cid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" PREVIOUS="turnitin_ctl"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
</KEYS>
<INDEXES>
<INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid" />
</INDEXES>
</TABLE>
</TABLES>
</XMLDB>
21 changes: 21 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,27 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) {
}
}

if ($oldversion < 2018053101) {
// Define table plagiarism_turnitin_courses to be created.
$table = new xmldb_table('plagiarism_turnitin_courses');

// Adding fields to table plagiarism_turnitin_courses.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, false, null, null, 'id');
$table->add_field('ownerid', XMLDB_TYPE_INTEGER, '10', null, false, null, null, 'courseid');
$table->add_field('turnitin_ctl', XMLDB_TYPE_TEXT, null, null, false, null, null, 'ownerid');
$table->add_field('turnitin_cid', XMLDB_TYPE_INTEGER, '10', null, false, null, null, 'turnitin_ctl');

// Adding keys and indexes to table plagiarism_turnitin_courses.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->add_index('courseid', XMLDB_INDEX_NOTUNIQUE, array('courseid'));

// Conditionally launch create table for file_conversion.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
}

return $result;
}

Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @copyright 2012 iParadigms LLC
*/

$plugin->version = 2018053001;
$plugin->version = 2018053101;
$plugin->release = "2.7+";
$plugin->requires = 2014051200;
$plugin->component = 'plagiarism_turnitin';
Expand Down

0 comments on commit 8148c47

Please sign in to comment.