Subversion Repositories oidplus

Rev

Rev 1219 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1219 Rev 1231
Line 25... Line 25...
25
 * @return int new version set
25
 * @return int new version set
26
 * @throws \ViaThinkSoft\OIDplus\OIDplusException
26
 * @throws \ViaThinkSoft\OIDplus\OIDplusException
27
 */
27
 */
28
function oidplus_dbupdate_201(OIDplusDatabaseConnection $db): int {
28
function oidplus_dbupdate_201(OIDplusDatabaseConnection $db): int {
29
        if ($db->transaction_supported()) $db->transaction_begin();
29
        if ($db->transaction_supported()) $db->transaction_begin();
30
 
30
        try {
31
        // Change bit(1) types to boolean/tinyint(1)
31
                // Change bit(1) types to boolean/tinyint(1)
32
        if ($db->getSlang()->id() == 'pgsql') {
32
                if ($db->getSlang()->id() == 'pgsql') {
33
                $db->query("alter table ###config  alter protected    drop default");
33
                        $db->query("alter table ###config  alter protected    drop default");
34
                $db->query("alter table ###config  alter protected    type boolean using get_bit(protected   ,0)::boolean");
34
                        $db->query("alter table ###config  alter protected    type boolean using get_bit(protected   ,0)::boolean");
35
                $db->query("alter table ###config  alter protected    set default false");
35
                        $db->query("alter table ###config  alter protected    set default false");
Line 79... Line 79...
79
 
79
 
80
        $version = 202;
80
                $version = 202;
81
        $db->query("UPDATE ###config SET value = ? WHERE name = 'database_version'", array("$version"));
81
                $db->query("UPDATE ###config SET value = ? WHERE name = 'database_version'", array("$version"));
82
 
82
 
83
        if ($db->transaction_supported()) $db->transaction_commit();
83
                if ($db->transaction_supported()) $db->transaction_commit();
-
 
84
        } catch (\Exception $e) {
-
 
85
                if ($db->transaction_supported()) $db->transaction_rollback();
-
 
86
                throw new $e;
-
 
87
        }
84
 
88
 
85
        return $version;
89
        return $version;
86
}
90
}