change migration
This commit is contained in:
René Gieling 2021-03-07 19:34:07 +01:00 коммит произвёл GitHub
Родитель 612c6c470e
Коммит b07a825a51
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 195 добавлений и 88 удалений

Просмотреть файл

@ -1,15 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.
## [2.0.0] - tbd
### supported NC version 21
Same as 1.8.0
## [1.8.0] - tbd
### supported NC versions 19 - 20
## [1.8.0 - beta1] - 2021-03-07
- [ux] #1164 - Wording: use list and table layout instead of desktop and mobile (#1443)
- [ux] #1430 - Move poll informations to icon bar (info icon) (#1443)
- [ux] #1418 - Allow changing emailaddress in public polls (#1431)
- [ux] #1418 - Allow changing emailaddress in public polls (#1431)
- [ux] #1401 - Change registation dialog layout (#1429)
- [ux] #1400 - Optimizations for registration dialog on mobiles (#1429)
- [enhancement] #325 - added markdown support for poll description (#1443)

Просмотреть файл

@ -23,19 +23,15 @@
<screenshot>https://raw.githubusercontent.com/nextcloud/polls/master/screenshots/vote.png</screenshot>
<screenshot>https://raw.githubusercontent.com/nextcloud/polls/master/screenshots/edit-poll.png</screenshot>
<dependencies>
<nextcloud min-version="19" max-version="20" />
<nextcloud min-version="19" max-version="21" />
</dependencies>
<background-jobs>
<job>OCA\Polls\Cron\NotificationCron</job>
</background-jobs>
<repair-steps>
<pre-migration>
<step>OCA\Polls\Migration\RemoveIndices</step>
<step>OCA\Polls\Migration\DeleteDuplicates</step>
</pre-migration>
<post-migration>
<step>OCA\Polls\Migration\CreateIndices</step>
</post-migration>
</repair-steps>
<navigations>
<navigation>

Просмотреть файл

@ -1,67 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2017 René Gieling <github@dartcafe.de>
*
* @author René Gieling <github@dartcafe.de>
*
* @license GNU AGPL version 3 or any later version
*
* 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\Polls\Migration;
use OCP\DB\ISchemaWrapper;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
class Version0108Date20210207134703 extends SimpleMigrationStep {
/** @var IDBConnection */
protected $connection;
/** @var IConfig */
protected $config;
public function __construct(IDBConnection $connection, IConfig $config) {
$this->connection = $connection;
$this->config = $config;
}
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
if ($schema->hasTable('polls_polls')) {
$table = $schema->getTable('polls_polls');
if (!$table->hasColumn('allow_comment')) {
$table->addColumn('allow_comment', 'integer', [
'length' => 11,
'notnull' => true,
'default' => 1
]);
}
if (!$table->hasColumn('hide_booked_up')) {
$table->addColumn('hide_booked_up', 'integer', [
'length' => 11,
'notnull' => true,
'default' => 1
]);
}
}
return $schema;
}
}

Просмотреть файл

@ -0,0 +1,114 @@
<?php
/**
* @copyright Copyright (c) 2017 René Gieling <github@dartcafe.de>
*
* @author René Gieling <github@dartcafe.de>
*
* @license GNU AGPL version 3 or any later version
*
* 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\Polls\Migration;
use OCP\DB\ISchemaWrapper;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
class Version0108Date20210307130001 extends SimpleMigrationStep {
/** @var IDBConnection */
protected $connection;
/** @var IConfig */
protected $config;
public function __construct(IDBConnection $connection, IConfig $config) {
$this->connection = $connection;
$this->config = $config;
}
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
if ($schema->hasTable('polls_options')) {
$table = $schema->getTable('polls_options');
foreach ($table->getIndexes() as $index) {
if (strpos($index->getName(), 'UNIQ_') === 0) {
$table->dropIndex($index->getName());
}
}
}
if ($schema->hasTable('polls_log')) {
$table = $schema->getTable('polls_log');
foreach ($table->getIndexes() as $index) {
if (strpos($index->getName(), 'UNIQ_') === 0) {
$table->dropIndex($index->getName());
}
}
}
if ($schema->hasTable('polls_notif')) {
$table = $schema->getTable('polls_notif');
foreach ($table->getIndexes() as $index) {
if (strpos($index->getName(), 'UNIQ_') === 0) {
$table->dropIndex($index->getName());
}
}
}
if ($schema->hasTable('polls_share')) {
$table = $schema->getTable('polls_share');
foreach ($table->getIndexes() as $index) {
if (strpos($index->getName(), 'UNIQ_') === 0) {
$table->dropIndex($index->getName());
}
}
}
if ($schema->hasTable('polls_votes')) {
$table = $schema->getTable('polls_votes');
foreach ($table->getIndexes() as $index) {
if (strpos($index->getName(), 'UNIQ_') === 0) {
$table->dropIndex($index->getName());
}
}
}
if ($schema->hasTable('polls_preferences')) {
$table = $schema->getTable('polls_preferences');
foreach ($table->getIndexes() as $index) {
if (strpos($index->getName(), 'UNIQ_') === 0) {
$table->dropIndex($index->getName());
}
}
}
if ($schema->hasTable('polls_watch')) {
$table = $schema->getTable('polls_watch');
foreach ($table->getIndexes() as $index) {
if (strpos($index->getName(), 'UNIQ_') === 0) {
$table->dropIndex($index->getName());
}
}
}
return $schema;
}
}

Просмотреть файл

@ -29,7 +29,7 @@ use OCP\IDBConnection;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
class Version0108Date20210127135802 extends SimpleMigrationStep {
class Version0108Date20210307130003 extends SimpleMigrationStep {
/** @var IDBConnection */
protected $connection;
@ -45,6 +45,36 @@ class Version0108Date20210127135802 extends SimpleMigrationStep {
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
if ($schema->hasTable('polls_polls')) {
$table = $schema->getTable('polls_polls');
if (!$table->hasColumn('allow_comment')) {
$table->addColumn('allow_comment', 'integer', [
'length' => 11,
'notnull' => true,
'default' => 1
]);
}
if (!$table->hasColumn('hide_booked_up')) {
$table->addColumn('hide_booked_up', 'integer', [
'length' => 11,
'notnull' => true,
'default' => 1
]);
}
}
if ($schema->hasTable('polls_options')) {
$table = $schema->getTable('polls_options');
if (!$table->hasColumn('duration')) {
$table->addColumn('duration', 'integer', [
'length' => 11,
'notnull' => true,
'default' => 0
]);
}
}
if (!$schema->hasTable('polls_watch')) {
$table = $schema->createTable('polls_watch');
$table->addColumn('id', 'integer', [

Просмотреть файл

@ -29,7 +29,7 @@ use OCP\IDBConnection;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
class Version0108Date20210117010101 extends SimpleMigrationStep {
class Version0108Date20210307130009 extends SimpleMigrationStep {
/** @var IDBConnection */
protected $connection;
@ -45,17 +45,56 @@ class Version0108Date20210117010101 extends SimpleMigrationStep {
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
if ($schema->hasTable('polls_options')) {
$table = $schema->getTable('polls_options');
if (!$table->hasColumn('duration')) {
$table->addColumn('duration', 'integer', [
'length' => 11,
'notnull' => true,
'default' => 0
]);
if (!$table->hasIndex('UNIQ_options')) {
$table->addUniqueIndex(['poll_id', 'poll_option_text', 'timestamp'], 'UNIQ_options');
}
}
if ($schema->hasTable('polls_log')) {
$table = $schema->getTable('polls_log');
if (!$table->hasIndex('UNIQ_unprocessed')) {
$table->addUniqueIndex(['processed', 'poll_id', 'user_id', 'message_id'], 'UNIQ_unprocessed');
}
}
if ($schema->hasTable('polls_notif')) {
$table = $schema->getTable('polls_notif');
if (!$table->hasIndex('UNIQ_subscription')) {
$table->addUniqueIndex(['poll_id', 'user_id'], 'UNIQ_subscription');
}
}
if ($schema->hasTable('polls_share')) {
$table = $schema->getTable('polls_share');
if (!$table->hasIndex('UNIQ_shares')) {
$table->addUniqueIndex(['poll_id', 'user_id'], 'UNIQ_shares');
}
}
if ($schema->hasTable('polls_votes')) {
$table = $schema->getTable('polls_votes');
if (!$table->hasIndex('UNIQ_votes')) {
$table->addUniqueIndex(['poll_id', 'user_id', 'vote_option_text'], 'UNIQ_votes');
}
}
if ($schema->hasTable('polls_preferences')) {
$table = $schema->getTable('polls_preferences');
if (!$table->hasIndex('UNIQ_preferences')) {
$table->addUniqueIndex(['user_id'], 'UNIQ_preferences');
}
}
if ($schema->hasTable('polls_watch')) {
$table = $schema->getTable('polls_watch');
if (!$table->hasIndex('UNIQ_watch')) {
$table->addUniqueIndex(['poll_id', 'table'], 'UNIQ_watch');
}
}
return $schema;
}
}