Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-tool_lifecycle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-tool_lifecycle
Commits
3db474dc
Commit
3db474dc
authored
7 years ago
by
Tobias Reischmann
Browse files
Options
Downloads
Patches
Plain Diff
Changed db trigger table to support trigger instances
parent
5feec36d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
db/install.xml
+4
-4
4 additions, 4 deletions
db/install.xml
db/upgrade.php
+57
-0
57 additions, 0 deletions
db/upgrade.php
with
61 additions
and
4 deletions
db/install.xml
+
4
−
4
View file @
3db474dc
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB
PATH=
"admin/tool/cleanupcourses/db"
VERSION=
"201802130
1
"
COMMENT=
"XMLDB file for Moodle tool/cleanupcourses"
<XMLDB
PATH=
"admin/tool/cleanupcourses/db"
VERSION=
"201802130
2
"
COMMENT=
"XMLDB file for Moodle tool/cleanupcourses"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
...
...
@@ -32,13 +32,13 @@
<TABLE
NAME=
"tool_cleanupcourses_trigger"
COMMENT=
"Trigger subplugins for the cleanup courses"
>
<FIELDS>
<FIELD
NAME=
"id"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"true"
SEQUENCE=
"true"
/>
<FIELD
NAME=
"instancename"
TYPE=
"char"
LENGTH=
"50"
NOTNULL=
"true"
SEQUENCE=
"false"
COMMENT=
"instancename of the trigger"
/>
<FIELD
NAME=
"subpluginname"
TYPE=
"char"
LENGTH=
"50"
NOTNULL=
"true"
SEQUENCE=
"false"
COMMENT=
"name of the subplugin"
/>
<FIELD
NAME=
"enabled"
TYPE=
"int"
LENGTH=
"1"
NOTNULL=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
COMMENT=
"tells if the subplugin is enabled"
/>
<FIELD
NAME=
"followedby"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"false"
SEQUENCE=
"false"
COMMENT=
"tells which step follows this one in the cleanup process"
/>
<FIELD
NAME=
"sortindex"
TYPE=
"int"
LENGTH=
"3"
NOTNULL=
"false"
SEQUENCE=
"false"
COMMENT=
"Sortindex of the subplugins"
/>
<FIELD
NAME=
"workflowid"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"true"
SEQUENCE=
"false"
COMMENT=
"id of the workflow"
/>
</FIELDS>
<KEYS>
<KEY
NAME=
"primary"
TYPE=
"primary"
FIELDS=
"id"
/>
<KEY
NAME=
"workflowid_fk"
TYPE=
"foreign"
FIELDS=
"workflowid"
REFTABLE=
"tool_cleanupcourses_workflow"
REFFIELDS=
"id"
/>
</KEYS>
</TABLE>
<TABLE
NAME=
"tool_cleanupcourses_step"
COMMENT=
"Step subplugins for the cleanup courses"
>
...
...
This diff is collapsed.
Click to expand it.
db/upgrade.php
+
57
−
0
View file @
3db474dc
...
...
@@ -150,6 +150,63 @@ function xmldb_tool_cleanupcourses_upgrade($oldversion) {
upgrade_plugin_savepoint
(
true
,
2018021301
,
'tool'
,
'cleanupcourses'
);
}
if
(
$oldversion
<
2018021302
)
{
// Define field workflowid to be added to tool_cleanupcourses_trigger.
$table
=
new
xmldb_table
(
'tool_cleanupcourses_trigger'
);
$field
=
new
xmldb_field
(
'workflowid'
,
XMLDB_TYPE_INTEGER
,
'10'
,
null
,
XMLDB_NOTNULL
,
null
,
null
,
'subpluginname'
);
// Conditionally launch add field workflowid.
if
(
!
$dbman
->
field_exists
(
$table
,
$field
))
{
$dbman
->
add_field
(
$table
,
$field
);
}
// Define field instancename to be added to tool_cleanupcourses_trigger.
$table
=
new
xmldb_table
(
'tool_cleanupcourses_trigger'
);
$field
=
new
xmldb_field
(
'instancename'
,
XMLDB_TYPE_CHAR
,
'50'
,
null
,
XMLDB_NOTNULL
,
null
,
null
,
'workflowid'
);
// Conditionally launch add field instancename.
if
(
!
$dbman
->
field_exists
(
$table
,
$field
))
{
$dbman
->
add_field
(
$table
,
$field
);
}
// Define field enabled to be dropped from tool_cleanupcourses_trigger.
$table
=
new
xmldb_table
(
'tool_cleanupcourses_trigger'
);
$field
=
new
xmldb_field
(
'enabled'
);
// Conditionally launch drop field enabled.
if
(
$dbman
->
field_exists
(
$table
,
$field
))
{
$dbman
->
drop_field
(
$table
,
$field
);
}
// Define field sortindex to be dropped from tool_cleanupcourses_trigger.
$table
=
new
xmldb_table
(
'tool_cleanupcourses_trigger'
);
$field
=
new
xmldb_field
(
'sortindex'
);
// Conditionally launch drop field sortindex.
if
(
$dbman
->
field_exists
(
$table
,
$field
))
{
$dbman
->
drop_field
(
$table
,
$field
);
}
// Define field sortindex to be dropped from tool_cleanupcourses_trigger.
$table
=
new
xmldb_table
(
'tool_cleanupcourses_trigger'
);
$field
=
new
xmldb_field
(
'sortindex'
);
// Conditionally launch drop field sortindex.
if
(
$dbman
->
field_exists
(
$table
,
$field
))
{
$dbman
->
drop_field
(
$table
,
$field
);
}
// Define key workflowid_fk (foreign) to be added to tool_cleanupcourses_trigger.
$table
=
new
xmldb_table
(
'tool_cleanupcourses_trigger'
);
$key
=
new
xmldb_key
(
'workflowid_fk'
,
XMLDB_KEY_FOREIGN
,
array
(
'workflowid'
),
'tool_cleanupcourses_workflow'
,
array
(
'id'
));
// Launch add key workflowid_fk.
$dbman
->
add_key
(
$table
,
$key
);
// Cleanupcourses savepoint reached.
upgrade_plugin_savepoint
(
true
,
2018021302
,
'tool'
,
'cleanupcourses'
);
}
return
true
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment