Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate and fix migration #425

Merged
merged 6 commits into from
Nov 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`
Expand Down Expand Up @@ -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']);
}

Expand All @@ -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, [
Expand All @@ -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, [
Expand Down Expand Up @@ -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();
Expand All @@ -247,7 +256,7 @@ protected function copyDateOptions() {
}

/**
* Copy text options
* Copy text options
*/
protected function copyTextOptions() {
$insert = $this->connection->getQueryBuilder();
Expand All @@ -274,7 +283,7 @@ protected function copyTextOptions() {
}

/**
* Copy date votes
* Copy date votes
*/
protected function copyDateVotes() {
$insert = $this->connection->getQueryBuilder();
Expand Down Expand Up @@ -305,9 +314,9 @@ protected function copyDateVotes() {
}
$result->closeCursor();
}

/**
* Copy text votes
* Copy text votes
*/
protected function copyTextVotes() {
$insert = $this->connection->getQueryBuilder();
Expand Down Expand Up @@ -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'])
Expand All @@ -360,7 +366,7 @@ protected function findOptionId($pollId, $text) {
return $row['id'];

}

protected function translateVoteTypeToAnswer($voteType) {
switch ($voteType) {
case 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
90 changes: 0 additions & 90 deletions lib/Migration/Version009000Date20180421050115.php

This file was deleted.

68 changes: 0 additions & 68 deletions lib/Migration/Version009000Date20180501201949.php

This file was deleted.