Permalink
Browse files

Postgres support and some indexes for speed.

  • Loading branch information...
1 parent 6365776 commit 3b864d850eb2ae658ce98079c489aa19f6437eb1 ethem committed Dec 2, 2005
Showing with 48 additions and 2 deletions.
  1. +11 −1 enrol/authorize/db/mysql.php
  2. +25 −0 enrol/authorize/db/postgres7.php
  3. +11 −0 enrol/authorize/db/postgres7.sql
  4. +1 −1 enrol/authorize/version.php
@@ -10,7 +10,17 @@ function authorize_upgrade($oldversion=0) {
if ($oldversion == 0) {
modify_database("$CFG->dirroot/enrol/authorize/db/mysql.sql");
- }
+ }
+
+ if ($oldversion < 2005071601) {
+ // Be sure, only last 4 digit is inserted.
+ table_column('enrol_authorize', 'cclastfour', 'cclastfour', 'integer', '4', 'unsigned', '0', 'not null');
+ table_column('enrol_authorize', 'courseid', 'courseid', 'integer', '10', 'unsigned', '0', 'not null');
+ table_column('enrol_authorize', 'userid', 'userid', 'integer', '10', 'unsigned', '0', 'not null');
+ // Add some indexes for speed.
+ execute_sql(" ALTER TABLE `{$CFG->prefix}enrol_authorize` ADD INDEX courseid(courseid) ");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}enrol_authorize` ADD INDEX userid(userid) ");
+ }
return $result;
@@ -0,0 +1,25 @@
+<?PHP //$Id$
+
+// PostgreSQL commands for upgrading this enrolment module
+
+function authorize_upgrade($oldversion=0) {
+ global $CFG, $THEME, $db;
+
+ $result = true;
+
+ if ($oldversion == 0) {
+ modify_database("$CFG->dirroot/enrol/authorize/db/postgres7.sql");
+ }
+
+ if ($oldversion < 2005071601) {
+ // Be sure, only last 4 digit is inserted.
+ table_column('enrol_authorize', 'cclastfour', 'cclastfour', 'integer', '4', 'unsigned', '0', 'not null');
+ table_column('enrol_authorize', 'courseid', 'courseid', 'integer', '10', 'unsigned', '0', 'not null');
+ table_column('enrol_authorize', 'userid', 'userid', 'integer', '10', 'unsigned', '0', 'not null');
+ // Add some indexes for speed.
+ modify_database('',"CREATE INDEX prefix_enrol_authorize_courseid_idx ON prefix_enrol_authorize (courseid);");
+ modify_database('',"CREATE INDEX prefix_enrol_authorize_userid_idx ON prefix_enrol_authorize (userid);");
+ }
+
+ return $result;
+}
@@ -0,0 +1,11 @@
+CREATE TABLE prefix_enrol_authorize (
+ id SERIAL PRIMARY KEY,
+ cclastfour integer default '0',
+ ccexp varchar(6) default '',
+ cvv varchar(4) default '',
+ ccname varchar(255) default '',
+ courseid integer NOT NULL default '0',
+ userid integer NOT NULL default '0',
+ avscode varchar(1) default 'P',
+ transid varchar(255) default ''
+);
@@ -1,6 +1,6 @@
<?PHP // $Id$
-$module->version = 2005071600;
+$module->version = 2005071601;
$module->requires = 2004081800;
?>

0 comments on commit 3b864d8

Please sign in to comment.