2021-07-27 12:26:47 +00:00
|
|
|
<?php
|
|
|
|
|
2022-02-16 04:08:28 +00:00
|
|
|
namespace Code\Update;
|
2021-07-27 12:26:47 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
class _1251
|
|
|
|
{
|
2021-07-27 12:26:47 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
public function run()
|
|
|
|
{
|
2021-08-12 20:04:44 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
$default = ((ACTIVE_DBTYPE == DBTYPE_POSTGRES) ? " default ''" : '');
|
2021-08-12 20:04:44 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
q("START TRANSACTION");
|
|
|
|
$r = q("ALTER TABLE dreport ADD dreport_log text NOT NULL $default");
|
2021-07-27 12:26:47 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
if ($r) {
|
|
|
|
q("COMMIT");
|
|
|
|
return UPDATE_SUCCESS;
|
|
|
|
}
|
2021-07-27 12:26:47 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
q("ROLLBACK");
|
|
|
|
return UPDATE_FAILED;
|
|
|
|
}
|
2021-07-27 12:26:47 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
public function verify()
|
|
|
|
{
|
2021-07-27 12:26:47 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
$columns = db_columns('dreport');
|
2021-07-27 12:26:47 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
if (in_array('dreport_log', $columns)) {
|
|
|
|
return true;
|
|
|
|
}
|
2021-07-27 12:26:47 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
return false;
|
|
|
|
}
|
2021-07-27 12:26:47 +00:00
|
|
|
}
|