зеркало из https://github.com/nextcloud/forms.git
Remove old forms tables
Signed-off-by: Jonas Rittershofer <jotoeri@users.noreply.github.com>
This commit is contained in:
Родитель
fbc28f8a07
Коммит
d53aa304b0
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2022 Jonas Rittershofer <jotoeri@users.noreply.github.com>
|
||||
*
|
||||
* @author Jonas Rittershofer <jotoeri@users.noreply.github.com>
|
||||
*
|
||||
* @license AGPL-3.0-or-later
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
namespace OCA\Forms\Migration;
|
||||
|
||||
use Closure;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\IOutput;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
|
||||
class Version030000Date20220402151229 extends SimpleMigrationStep {
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|ISchemaWrapper
|
||||
*/
|
||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
$update_necessary = false;
|
||||
|
||||
/*
|
||||
* Remove old (Forms < v2) DB-Tables
|
||||
*/
|
||||
if ($schema->hasTable('forms_events')) {
|
||||
$schema->dropTable('forms_events');
|
||||
$update_necessary = true;
|
||||
}
|
||||
if ($schema->hasTable('forms_questions')) {
|
||||
$schema->dropTable('forms_questions');
|
||||
$update_necessary = true;
|
||||
}
|
||||
if ($schema->hasTable('forms_answers')) {
|
||||
$schema->dropTable('forms_answers');
|
||||
$update_necessary = true;
|
||||
}
|
||||
if ($schema->hasTable('forms_votes')) {
|
||||
$schema->dropTable('forms_votes');
|
||||
$update_necessary = true;
|
||||
}
|
||||
|
||||
return $update_necesssary ? $schema : null;
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче