Revision: 1131
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1131&view=rev
Author:   jberanek
Date:     2009-06-25 22:33:26 +0000 (Thu, 25 Jun 2009)

Log Message:
-----------
* Moved creation of mrbs_users table into the SQL schema update
 number 5.

Modified Paths:
--------------
    mrbs/trunk/tables.my.sql
    mrbs/trunk/tables.pg.73and_above.sql
    mrbs/trunk/tables.pg.sql
    mrbs/trunk/web/dbsys.inc
    mrbs/trunk/web/edit_users.php

Added Paths:
-----------
    mrbs/trunk/web/upgrade/5/
    mrbs/trunk/web/upgrade/5/mysql.sql
    mrbs/trunk/web/upgrade/5/pgsql.inc
    mrbs/trunk/web/upgrade/5/post.inc

Modified: mrbs/trunk/tables.my.sql
===================================================================
--- mrbs/trunk/tables.my.sql    2009-06-25 19:36:34 UTC (rev 1130)
+++ mrbs/trunk/tables.my.sql    2009-06-25 22:33:26 UTC (rev 1131)
@@ -88,7 +88,19 @@
   PRIMARY KEY (id)
 );
 
+CREATE TABLE mrbs_users
+(
+  /* The first four fields are required. Don't remove. */
+  id        int NOT NULL auto_increment
+  level     smallint DEFAULT '0' NOT NULL,  /* play safe and give no rights */
+  name      varchar(30),
+  password  varchar(40),
+  email     varchar(75),
+
+  PRIMARY KEY (id)
+);
+
 INSERT INTO mrbs_variables (variable_name, variable_content)
-  VALUES ( 'db_version', '3');
+  VALUES ( 'db_version', '5');
 INSERT INTO mrbs_variables (variable_name, variable_content)
   VALUES ( 'local_db_version', '1');

Modified: mrbs/trunk/tables.pg.73and_above.sql
===================================================================
--- mrbs/trunk/tables.pg.73and_above.sql        2009-06-25 19:36:34 UTC (rev 
1130)
+++ mrbs/trunk/tables.pg.73and_above.sql        2009-06-25 22:33:26 UTC (rev 
1131)
@@ -93,7 +93,20 @@
   variable_name    varchar(80),
   variable_content text
 );
+
+CREATE TABLE mrbs_users
+(
+  /* The first four fields are required. Don't remove. */
+  id        serial primary key,
+  level     smallint DEFAULT '0' NOT NULL,  /* play safe and give no rights */
+  name      varchar(30),
+  password  varchar(40),
+  email     varchar(75),
+
+  PRIMARY KEY (id)
+);
+
 INSERT INTO mrbs_variables (variable_name, variable_content)
-  VALUES ('db_version', '3');
+  VALUES ('db_version', '5');
 INSERT INTO mrbs_variables (variable_name, variable_content)
   VALUES ('local_db_version', '1');

Modified: mrbs/trunk/tables.pg.sql
===================================================================
--- mrbs/trunk/tables.pg.sql    2009-06-25 19:36:34 UTC (rev 1130)
+++ mrbs/trunk/tables.pg.sql    2009-06-25 22:33:26 UTC (rev 1131)
@@ -81,7 +81,20 @@
   variable_name    varchar(80),
   variable_content text
 );
+
+CREATE TABLE mrbs_users
+(
+  /* The first four fields are required. Don't remove. */
+  id        serial primary key,
+  level     smallint DEFAULT '0' NOT NULL,  /* play safe and give no rights */
+  name      varchar(30),
+  password  varchar(40),
+  email     varchar(75),
+
+  PRIMARY KEY (id)
+);
+
 INSERT INTO mrbs_variables (variable_name, variable_content)
-  VALUES ('db_version', '3');
+  VALUES ('db_version', '5');
 INSERT INTO mrbs_variables (variable_name, variable_content)
   VALUES ('local_db_version', '1');

Modified: mrbs/trunk/web/dbsys.inc
===================================================================
--- mrbs/trunk/web/dbsys.inc    2009-06-25 19:36:34 UTC (rev 1130)
+++ mrbs/trunk/web/dbsys.inc    2009-06-25 22:33:26 UTC (rev 1131)
@@ -15,7 +15,7 @@
 $tbl_variables = $db_tbl_prefix . "variables";
 
 
-$db_schema_version = 4;
+$db_schema_version = 5;
 $local_db_schema_version = 1;
 
 

Modified: mrbs/trunk/web/edit_users.php
===================================================================
--- mrbs/trunk/web/edit_users.php       2009-06-25 19:36:34 UTC (rev 1130)
+++ mrbs/trunk/web/edit_users.php       2009-06-25 22:33:26 UTC (rev 1131)
@@ -83,40 +83,8 @@
 }
 
 
-/*---------------------------------------------------------------------------*\
-|                     Create the users database if needed                     |
-\*---------------------------------------------------------------------------*/
-
 $nusers = sql_query1("select count(*) from $tbl_users");
 
-if ($nusers == -1)   /* If the table does not exist */
-{         /* Then create it */
-  $cmd = "
-CREATE TABLE $tbl_users
-(
-  /* The first four fields are required. Don't remove. */
-  id        ".sql_syntax_createtable_autoincrementcolumn().",
-  level     smallint DEFAULT '0' NOT NULL,  /* play safe and give no rights */
-  name      varchar(30),
-  password  varchar(40),
-  email     varchar(75),
-
-  /* The following fields are application-specific. However only int and 
varchar are editable. */
-
-
-  PRIMARY KEY (id)
-);";
-  $r = sql_command($cmd);
-  if ($r == -1)
-  {
-    // No need to localize this: Only the admin running this for the first 
time would see it.
-    print "<p class=\"error\">Error creating the $tbl_users table.</p>\n";
-    print "<p class=\"error\">" . sql_error() . "</p>\n";
-    exit();
-  }
-  $nusers = 0;
-}
-
 // Get the list of fields in the table
 get_fields();
 

Added: mrbs/trunk/web/upgrade/5/mysql.sql
===================================================================
--- mrbs/trunk/web/upgrade/5/mysql.sql                          (rev 0)
+++ mrbs/trunk/web/upgrade/5/mysql.sql  2009-06-25 22:33:26 UTC (rev 1131)
@@ -0,0 +1 @@
+# $Id$


Property changes on: mrbs/trunk/web/upgrade/5/mysql.sql
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Added: mrbs/trunk/web/upgrade/5/pgsql.inc
===================================================================
--- mrbs/trunk/web/upgrade/5/pgsql.inc                          (rev 0)
+++ mrbs/trunk/web/upgrade/5/pgsql.inc  2009-06-25 22:33:26 UTC (rev 1131)
@@ -0,0 +1 @@
+-- $Id$


Property changes on: mrbs/trunk/web/upgrade/5/pgsql.inc
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Added: mrbs/trunk/web/upgrade/5/post.inc
===================================================================
--- mrbs/trunk/web/upgrade/5/post.inc                           (rev 0)
+++ mrbs/trunk/web/upgrade/5/post.inc   2009-06-25 22:33:26 UTC (rev 1131)
@@ -0,0 +1,37 @@
+<?php
+
+// $Id$
+
+global $admin_handle;
+global $tbl_users;
+
+$nusers = sql_query1("select count(*) from $tbl_users", $admin_handle);
+
+if ($nusers == -1)   /* If the table does not exist */
+{         /* Then create it */
+  $cmd = "
+CREATE TABLE $tbl_users
+(
+  /* The first four fields are required. Don't remove. */
+  id        ".sql_syntax_createtable_autoincrementcolumn().",
+  level     smallint DEFAULT '0' NOT NULL,  /* play safe and give no rights */
+  name      varchar(30),
+  password  varchar(40),
+  email     varchar(75),
+
+  /* The following fields are application-specific. However only int and 
varchar are editable. */
+
+
+  PRIMARY KEY (id)
+);";
+  $r = sql_command($cmd, $admin_handle);
+  if ($r == -1)
+  {
+    // No need to localize this: Only the admin running this for the first 
time would see it.
+    print "<p class=\"error\">Error creating the $tbl_users table.</p>\n";
+    print "<p class=\"error\">" . sql_error($admin_handle) . "</p>\n";
+    exit();
+  }
+}
+
+?>


Property changes on: mrbs/trunk/web/upgrade/5/post.inc
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to