Merged revisions 10677-11457 via svnmerge from
[wvapps.git] / gracefultavi / install / dbupgrade / upgrade3.php
blob337e44f69aab101a73cb19020fd10587633716d3
1 <?php
3 /**
4 * GracefulTavi Database Upgrade
6 * Version 3
8 * Occured in release: 1.06
10 * Author:
11 * Michel Emond
12 * Net Integration Technologies
13 * www.net-itech.com
15 * Description:
16 * Adds a new field in the "remote_pages" table and creates the "version"
17 * table for the new versioning system.
20 global $PgTbl, $RemTbl, $VeTbl;
22 $rs = mysql_query("SELECT restricted FROM $RemTbl", $db->handle);
23 if (!$rs)
25 $db->query("ALTER TABLE $RemTbl
26 ADD restricted TINYINT(1) NOT NULL DEFAULT 0
27 AFTER site");
30 $rs = mysql_query("SELECT version FROM $VeTbl", $db->handle);
31 if (!$rs)
33 $db->query("DROP TABLE IF EXISTS $VeTbl");
34 $db->query("CREATE TABLE $VeTbl
35 (version TINYINT(3) UNSIGNED DEFAULT 0)");
38 $rs = mysql_query("SELECT attributes FROM $PgTbl", $db->handle);
39 if (!$rs)
41 // the default value of attributes is 1: bit 1 = mutable
42 $db->query("ALTER TABLE $PgTbl
43 ADD attributes TINYINT UNSIGNED NOT NULL DEFAULT 1
44 AFTER mutable");
46 $db->query("UPDATE $PgTbl
47 SET attributes = 0
48 WHERE mutable = 'off'");
50 $db->query("ALTER TABLE $PgTbl
51 DROP mutable");