From 4313fa89d97156765c32d198f152c6fef38670c1 Mon Sep 17 00:00:00 2001 From: jerome Date: Fri, 11 Sep 2009 09:46:01 +0000 Subject: [PATCH] webservice MDL-12886 fix bad database manual generation by xmleditor generation + update web services database --- lib/db/install.xml | 26 +++++++------- lib/db/upgrade.php | 90 ++++++++++++++++++++++++++++++++++++++++++++++ version.php | 4 +-- 3 files changed, 105 insertions(+), 15 deletions(-) diff --git a/lib/db/install.xml b/lib/db/install.xml index 83cb16afea..e5d4b8767b 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -1,5 +1,5 @@ - @@ -2264,36 +2264,36 @@ - +
- + - - + +
- +
- - - + + +
- +
- - - + + + diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 20504dfc0c..58fecf4c22 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2554,6 +2554,96 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL"); } upgrade_main_savepoint($result, 2009090800); } + + if ($result && $oldversion < 2009090803) { + + /// Define table external_functions to be dropped + $table = new xmldb_table('external_functions'); + + /// Conditionally launch drop table for external_functions + if ($dbman->table_exists($table)) { + $dbman->drop_table($table); + } + + + + /// Define table external_services to be dropped + $table = new xmldb_table('external_services'); + + /// Conditionally launch drop table for external_services + if ($dbman->table_exists($table)) { + $dbman->drop_table($table); + } + + + /// Define table external_services_functions to be dropped + $table = new xmldb_table('external_services_functions'); + + /// Conditionally launch drop table for external_services_functions + if ($dbman->table_exists($table)) { + $dbman->drop_table($table); + } + + + /// Define table external_functions to be created + $table = new xmldb_table('external_functions'); + + /// Adding fields to table external_functions + $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); + $table->add_field('component', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null); + $table->add_field('name', XMLDB_TYPE_CHAR, '150', null, XMLDB_NOTNULL, null, null); + $table->add_field('phpfile', XMLDB_TYPE_CHAR, '255', null, null, null, null); + $table->add_field('contextrestriction', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null); + + /// Adding keys to table external_functions + $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); + + /// Conditionally launch create table for external_functions + if (!$dbman->table_exists($table)) { + $dbman->create_table($table); + } + + + /// Define table external_services to be created + $table = new xmldb_table('external_services'); + + /// Adding fields to table external_services + $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); + $table->add_field('name', XMLDB_TYPE_CHAR, '150', null, XMLDB_NOTNULL, null, null); + $table->add_field('enabled', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null); + $table->add_field('custom', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null); + $table->add_field('customname', XMLDB_TYPE_CHAR, '150', null, null, null, null); + + /// Adding keys to table external_services + $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); + + /// Conditionally launch create table for external_services + if (!$dbman->table_exists($table)) { + $dbman->create_table($table); + } + + + /// Define table external_services_functions to be created + $table = new xmldb_table('external_services_functions'); + + /// Adding fields to table external_services_functions + $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); + $table->add_field('externalserviceid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null); + $table->add_field('externalfunctionid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null); + $table->add_field('enabled', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null); + + /// Adding keys to table external_services_functions + $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); + + /// Conditionally launch create table for external_services_functions + if (!$dbman->table_exists($table)) { + $dbman->create_table($table); + } + + /// Main savepoint reached + upgrade_main_savepoint($result, 2009090803); + } + return $result; } diff --git a/version.php b/version.php index a20f81ae99..b1ff9261e9 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2009090800; // YYYYMMDD = date of the last version bump + $version = 2009090803; // YYYYMMDD = date of the last version bump // XX = daily increments - $release = '2.0 dev (Build: 20090911)'; // Human-friendly version name + $release = '2.0 dev (Build: 20090912)'; // Human-friendly version name -- 2.39.5