<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
public static function create(bool $verbose, bool $action)
{
+ // Delete previously used views that aren't used anymore
+ foreach(['post-view', 'post-thread-view'] as $view) {
+ if (self::isView($view)) {
+ $sql = sprintf("DROP VIEW IF EXISTS `%s`", DBA::escape($view));
+ if (!empty($sql) && $verbose) {
+ echo $sql . ";\n";
+ }
+
+ if (!empty($sql) && $action) {
+ DBA::e($sql);
+ }
+ }
+ }
+
$definition = self::definition();
foreach ($definition as $name => $structure) {
$sql = sprintf("DROP TABLE IF EXISTS `%s`", DBA::escape($name));
}
- if ($verbose) {
+ if (!empty($sql) && $verbose) {
echo $sql . ";\n";
}
- if ($action) {
+ if (!empty($sql) && $action) {
DBA::e($sql);
}