예제 #1
0
<?php

if (sql_num_query("SHOW COLUMNS FROM `Shifts` LIKE 'Date_'") == 2) {
    if (sql_num_query("DESCRIBE `Shifts` `Len`") != 0) {
        if (sql_num_query("SELECT * FROM `Shifts` WHERE DATE_SUB(`DateE`, INTERVAL (`Len`*60) MINUTE) != `DateS`") != 0) {
            die("Inconsistent data in Shifts table, won't do update " . __FILE__);
        } else {
            sql_query("ALTER TABLE `Shifts` DROP `Len`");
        }
    }
    _datetime_to_int("Shifts", "DateS");
    _datetime_to_int("Shifts", "DateE");
    sql_query("ALTER TABLE `Shifts` CHANGE `DateS` `start` INT NOT NULL, CHANGE `DateE` `end` INT NOT NULL");
    $applied = true;
}
if (sql_num_query("DESCRIBE `Shifts` `Man`") === 1 && sql_num_query("DESCRIBE `Shifts` `name`") === 0) {
    sql_query("ALTER TABLE `Shifts` CHANGE `Man` `name` VARCHAR(1024) NULL");
    $applied = true;
}
$res = sql_select("DESCRIBE `Shifts` `PSID`");
if ($res[0]['Type'] == 'text') {
    sql_query("ALTER TABLE `Shifts` CHANGE `PSID` `PSID` INT NULL");
    $applied = true;
}
_add_index("Shifts", array("PSID"), "UNIQUE");
_add_index("Shifts", array("RID"));
예제 #2
0
<?php

_datetime_to_int("Wecken", "Date");
_add_index("Wecken", array("UID"));
예제 #3
0
<?php

_datetime_to_int("News", "Datum");
_add_index("News", array("UID"));
예제 #4
0
<?php

if (sql_num_query("DESCRIBE `Messages` `id`") === 0) {
    sql_query("ALTER TABLE `Messages`\n        DROP PRIMARY KEY,\n        ADD `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST\n    ");
    $applied = true;
}
_add_index("Messages", array("SUID"));
_add_index("Messages", array("RUID"));
_datetime_to_int("Messages", "Datum");
_add_index("Messages", array("Datum"));
예제 #5
0
<?php

_datetime_to_int("User", "lastLogin");
if (sql_num_query("DESCRIBE `User` `ical_key`") === 0) {
    sql_query("ALTER TABLE `User` ADD `ical_key` VARCHAR( 32 ) NOT NULL");
    #    _add_index("User", array("ical_key"), "UNIQUE");
    # XXX: not everybody has an ical_key, why?
    $applied = true;
}
$res = sql_select("DESCRIBE `User` `DECT`");
if ($res[0]['Type'] == 'varchar(4)') {
    sql_query("ALTER TABLE `User` CHANGE `DECT` `DECT` VARCHAR(5) NULL");
    $applied = true;
}