summaryrefslogtreecommitdiffstats
path: root/upgrade/upgrade.php
diff options
context:
space:
mode:
Diffstat (limited to 'upgrade/upgrade.php')
-rw-r--r--upgrade/upgrade.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/upgrade/upgrade.php b/upgrade/upgrade.php
index 45fcadfad..c6350aa60 100644
--- a/upgrade/upgrade.php
+++ b/upgrade/upgrade.php
@@ -13,6 +13,7 @@ namespace OCA\News\Upgrade;
use OCP\IConfig;
use OCA\News\Service\ItemService;
+use OCP\IDBConnection;
class Upgrade {
@@ -23,6 +24,10 @@ class Upgrade {
private $itemService;
private $appName;
+ /**
+ * @var IDBConnection
+ */
+ private $db;
/**
* Upgrade constructor.
@@ -30,10 +35,11 @@ class Upgrade {
* @param $appName
*/
public function __construct(IConfig $config, ItemService $itemService,
- $appName) {
+ IDBConnection $db, $appName) {
$this->config = $config;
$this->appName = $appName;
$this->itemService = $itemService;
+ $this->db = $db;
}
public function upgrade() {
@@ -46,4 +52,20 @@ class Upgrade {
}
}
+ public function preUpgrade() {
+ $previousVersion = $this->config->getAppValue(
+ $this->appName, 'installed_version'
+ );
+
+ $dbType = $this->config->getSystemValue('dbtype');
+ if (version_compare($previousVersion, '8.2.2', '<') &&
+ $dbType !== 'sqlite3'
+ ) {
+ $sql = 'ALTER TABLE `*PREFIX*news_feeds` DROP COLUMN
+ `last_modified`';
+ $query = $this->db->prepare($sql);
+ $query->execute();
+ }
+ }
+
}