2018-02-16 20:42:02 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Zotlabs\Update;
|
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
class _1183
|
|
|
|
{
|
|
|
|
public function run()
|
|
|
|
{
|
2018-02-16 20:42:02 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
if (ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
|
|
|
|
$r1 = q("alter table hook ALTER COLUMN priority TYPE smallint");
|
|
|
|
$r2 = q("alter table hook ALTER COLUMN priority SET NOT NULL");
|
|
|
|
$r3 = q("alter table hook ALTER COLUMN priority SET DEFAULT '0'");
|
|
|
|
$r1 = $r1 && $r2 && $r3;
|
|
|
|
} else {
|
|
|
|
$r1 = q("alter table hook CHANGE priority priority smallint NOT NULL DEFAULT '0' ");
|
|
|
|
}
|
|
|
|
$r2 = q("create index priority_idx on hook (priority)");
|
2018-02-16 20:42:02 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
if ($r1 && $r2) {
|
2021-12-02 23:02:31 +00:00
|
|
|
return UPDATE_SUCCESS;
|
2021-12-03 03:01:39 +00:00
|
|
|
}
|
2021-12-02 23:02:31 +00:00
|
|
|
return UPDATE_FAILED;
|
|
|
|
}
|
2021-12-03 03:01:39 +00:00
|
|
|
}
|