Skip to content
Snippets Groups Projects
Commit 67150c35 authored by Tobias Reischmann's avatar Tobias Reischmann
Browse files

Added db tables for workflow and worflow_definition

parent 8639a5c3
No related branches found
No related tags found
No related merge requests found
......@@ -90,5 +90,29 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="tool_cleanupcourses_workflow" COMMENT="Workflow definitions for processes">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Title of a workflow"/>
<FIELD NAME="active" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="active status of a workflow"/>
<FIELD NAME="timeactive" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="timestamp the workflow was set active"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="tool_cleanupcourses_wf_steps" COMMENT="Assignment of steps to a workflow">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="workflowid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="id of the workflow"/>
<FIELD NAME="stepid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Id of the step instance"/>
<FIELD NAME="order" TYPE="int" LENGTH="5" NOTNULL="true" SEQUENCE="false" COMMENT="Order in which the steps are executed"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="workflowid_fk" TYPE="foreign" FIELDS="workflowid" REFTABLE="tool_cleanupcourses_workflow" REFFIELDS="id"/>
<KEY NAME="stepid_fk" TYPE="foreign" FIELDS="stepid" REFTABLE="tool_cleanupcourses_step" REFFIELDS="id"/>
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
\ No newline at end of file
......@@ -29,5 +29,55 @@ function xmldb_tool_cleanupcourses_upgrade($oldversion) {
global $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2017081000) {
// Create table tool_cleanupcourses_wf_steps.
$table = new xmldb_table('tool_cleanupcourses_wf_steps');
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null);
$table->add_field('workflowid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'id');
$table->add_field('stepid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'workflowid');
$table->add_field('sortindex', XMLDB_TYPE_INTEGER, '5', null, XMLDB_NOTNULL, null, null, 'stepid');
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
// Conditionally launch add field id.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// Create table tool_cleanupcourses_workflow.
$table = new xmldb_table('tool_cleanupcourses_workflow');
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null);
$table->add_field('title', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'id');
$table->add_field('active', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'title');
$table->add_field('timeacive', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'active');
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->add_key('workflowid_fk', XMLDB_KEY_FOREIGN, array('workflowid'), 'tool_cleanupcourses_workflow', array('id'));
$table->add_key('stepid_fk', XMLDB_KEY_FOREIGN, array('stepid'), 'tool_cleanupcourses_step', array('id'));
// Conditionally launch add field id.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// Changing precision of field followedby on table tool_cleanupcourses_step to (10).
$table = new xmldb_table('tool_cleanupcourses_step');
$field = new xmldb_field('followedby', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'subpluginname');
// Launch change of precision for field followedby.
$dbman->change_field_precision($table, $field);
// Changing precision of field followedby on table tool_cleanupcourses_trigger to (10).
$table = new xmldb_table('tool_cleanupcourses_trigger');
$field = new xmldb_field('followedby', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'enabled');
// Launch change of precision for field followedby.
$dbman->change_field_precision($table, $field);
// Cleanupcourses savepoint reached.
upgrade_plugin_savepoint(true, 2017081000, 'tool', 'cleanupcourses');
}
return true;
}
\ No newline at end of file
......@@ -23,5 +23,5 @@
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2017062100;
$plugin->version = 2017081000;
$plugin->component = 'tool_cleanupcourses';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment