2019-04-16 06:03:16 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Zotlabs\Update;
|
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
class _1232
|
|
|
|
{
|
2019-04-16 06:03:16 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
public function run()
|
|
|
|
{
|
2019-04-16 06:03:16 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
q("START TRANSACTION");
|
2019-04-16 06:03:16 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
if (ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
|
|
|
|
$r1 = q("ALTER TABLE photo ADD expires timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
|
|
|
|
$r2 = q("create index \"photo_expires_idx\" on photo (\"expires\")");
|
|
|
|
|
|
|
|
$r = ($r1 && $r2);
|
|
|
|
} else {
|
|
|
|
$r = q("ALTER TABLE `photo` ADD `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' ,
|
2019-04-16 06:03:16 +00:00
|
|
|
ADD INDEX `expires` (`expires`)");
|
2021-12-02 23:02:31 +00:00
|
|
|
}
|
2019-04-16 06:03:16 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
if ($r) {
|
|
|
|
q("COMMIT");
|
|
|
|
return UPDATE_SUCCESS;
|
|
|
|
}
|
2019-04-16 06:03:16 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
q("ROLLBACK");
|
|
|
|
return UPDATE_FAILED;
|
|
|
|
}
|
2019-04-16 06:03:16 +00:00
|
|
|
}
|