diff --git a/lib/Migration/Version009000Date20171202105141.php b/lib/Migration/Version0009Date20181125061900.php similarity index 96% rename from lib/Migration/Version009000Date20171202105141.php rename to lib/Migration/Version0009Date20181125061900.php index a70dee130..a5505411d 100644 --- a/lib/Migration/Version009000Date20171202105141.php +++ b/lib/Migration/Version0009Date20181125061900.php @@ -37,14 +37,14 @@ * Installation class for the polls app. * Initial db creation */ -class Version009000Date20171202105141 extends SimpleMigrationStep { - +class Version0009Date20181125061900 extends SimpleMigrationStep { + /** @var IDBConnection */ protected $connection; - + /** @var IConfig */ protected $config; - + /** * @param IDBConnection $connection * @param IConfig $config @@ -53,7 +53,7 @@ public function __construct(IDBConnection $connection, IConfig $config) { $this->connection = $connection; $this->config = $config; } - + /** * @param IOutput $output * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` @@ -109,6 +109,10 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op 'notnull' => false, 'default' => 0, ]); + $table->addColumn('disallow_maybe', Type::INTEGER, [ + 'notnull' => false, + 'default' => 0 + ]); $table->setPrimaryKey(['id']); } @@ -125,9 +129,13 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op 'notnull' => false, // maybe true? 'length' => 256, ]); + $table->addColumn('timestamp', Type::INTEGER, [ + 'notnull' => false, + 'default' => 0 + ]); $table->setPrimaryKey(['id']); } - + if (!$schema->hasTable('polls_votes')) { $table = $schema->createTable('polls_votes'); $table->addColumn('id', Type::INTEGER, [ @@ -143,6 +151,7 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op ]); $table->addColumn('vote_option_id', Type::INTEGER, [ 'notnull' => true, + 'default' => 0, 'length' => 64, ]); $table->addColumn('vote_option_text', Type::STRING, [ @@ -220,7 +229,7 @@ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array } /** - * Copy date options + * Copy date options */ protected function copyDateOptions() { $insert = $this->connection->getQueryBuilder(); @@ -247,7 +256,7 @@ protected function copyDateOptions() { } /** - * Copy text options + * Copy text options */ protected function copyTextOptions() { $insert = $this->connection->getQueryBuilder(); @@ -274,7 +283,7 @@ protected function copyTextOptions() { } /** - * Copy date votes + * Copy date votes */ protected function copyDateVotes() { $insert = $this->connection->getQueryBuilder(); @@ -305,9 +314,9 @@ protected function copyDateVotes() { } $result->closeCursor(); } - + /** - * Copy text votes + * Copy text votes */ protected function copyTextVotes() { $insert = $this->connection->getQueryBuilder(); @@ -338,14 +347,11 @@ protected function copyTextVotes() { } $result->closeCursor(); } + /** * @param int $voteType * @return string */ - - - - protected function findOptionId($pollId, $text) { $queryFind = $this->connection->getQueryBuilder(); $queryFind->select(['id']) @@ -360,7 +366,7 @@ protected function findOptionId($pollId, $text) { return $row['id']; } - + protected function translateVoteTypeToAnswer($voteType) { switch ($voteType) { case 0: diff --git a/lib/Migration/Version009000Date20180202213017.php b/lib/Migration/Version0009Date20181125062101.php similarity index 91% rename from lib/Migration/Version009000Date20180202213017.php rename to lib/Migration/Version0009Date20181125062101.php index 7ebb78e70..c8427b197 100644 --- a/lib/Migration/Version009000Date20180202213017.php +++ b/lib/Migration/Version0009Date20181125062101.php @@ -27,11 +27,11 @@ use OCP\Migration\IOutput; /** - * Deleting unused tables 'polls_dts', 'polls_txts', 'polls_particip' and 'polls_particip_text' - * after migration in 'Version009000Date20171202105141.php' + * Deleting unused tables 'polls_dts', 'polls_txts', 'polls_particip' and 'polls_particip_text' + * after migration in 'Version000009Date20171202105141.php' */ -class Version009000Date20180202213017 extends SimpleMigrationStep { +class Version0009Date20181125062101 extends SimpleMigrationStep { /** * @param IOutput $output * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` diff --git a/lib/Migration/Version009000Date20180421050115.php b/lib/Migration/Version009000Date20180421050115.php deleted file mode 100644 index fdc8e6a02..000000000 --- a/lib/Migration/Version009000Date20180421050115.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * @author Joas Schilling - * - * @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 . - * - */ -namespace OCA\Polls\Migration; - -use Doctrine\DBAL\Exception\TableNotFoundException; -use Doctrine\DBAL\Platforms\PostgreSqlPlatform; -use Doctrine\DBAL\Types\Type; -use OCP\DB\ISchemaWrapper; -use OCP\IConfig; -use OCP\IDBConnection; -use OCP\Migration\SimpleMigrationStep; -use OCP\Migration\IOutput; - -/** - * Auto-generated migration step: Please modify to your needs! - * Adding column 'disallow_maybe' to table 'polls_events' - */ -class Version009000Date20180421050115 extends SimpleMigrationStep { - /** @var IDBConnection */ - protected $connection; - - /** @var IConfig */ - protected $config; - - /** - * @param IDBConnection $connection - * @param IConfig $config - */ - public function __construct(IDBConnection $connection, IConfig $config) { - $this->connection = $connection; - $this->config = $config; - } - /** - * @param IOutput $output - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @param array $options - * @since 13.0.0 - */ - public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { - } - - /** - * @param IOutput $output - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @param array $options - * @return null|ISchemaWrapper - * @since 13.0.0 - */ - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { - /** @var ISchemaWrapper $schema */ - $schema = $schemaClosure(); - - $table = $schema->getTable('polls_events'); - $table->addColumn('disallow_maybe', Type::INTEGER, [ - 'notnull' => false, - 'default' => 0 - ]); - - return $schema; - } - - /** - * @param IOutput $output - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @param array $options - * @since 13.0.0 - */ - public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { - } -} diff --git a/lib/Migration/Version009000Date20180501201949.php b/lib/Migration/Version009000Date20180501201949.php deleted file mode 100644 index afe1e6f76..000000000 --- a/lib/Migration/Version009000Date20180501201949.php +++ /dev/null @@ -1,68 +0,0 @@ -connection = $connection; - $this->config = $config; - } - /** - * @param IOutput $output - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @param array $options - * @since 13.0.0 - */ - public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { - } - - /** - * @param IOutput $output - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @param array $options - * @return null|ISchemaWrapper - * @since 13.0.0 - */ - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { - /** @var ISchemaWrapper $schema */ - $schema = $schemaClosure(); - - $table = $schema->getTable('polls_options'); - $table->addColumn('timestamp', Type::INTEGER, [ - 'notnull' => false, - 'default' => 0 - ]); - - return $schema; - } - - /** - * @param IOutput $output - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @param array $options - * @since 13.0.0 - */ - public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { - } -}