Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2020-04-06 10:05:24 +0300
committerdartcafe <github@dartcafe.de>2020-04-06 10:05:24 +0300
commitdc1afd7fec36a6776ab1f9290e37ca0889d89834 (patch)
tree6eaea942c421233a4e84fe1661bd0255aab9ab93 /lib
parent7f48bd8f91cb3d12a6395ff96e2995ae88789798 (diff)
Change type of description via doctrine
Diffstat (limited to 'lib')
-rw-r--r--lib/Migration/Version0104Date20200314074611.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Migration/Version0104Date20200314074611.php b/lib/Migration/Version0104Date20200314074611.php
index ff61597a..cd587e51 100644
--- a/lib/Migration/Version0104Date20200314074611.php
+++ b/lib/Migration/Version0104Date20200314074611.php
@@ -23,6 +23,7 @@
namespace OCA\Polls\Migration;
+use Doctrine\DBAL\Types\Type;
use OCP\DB\ISchemaWrapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IConfig;
@@ -59,13 +60,14 @@ class Version0104Date20200314074611 extends SimpleMigrationStep {
* @since 13.0.0
*/
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
- // get table prefix, as we are running a raw query
- $prefix = $this->config->getSystemValue('dbtableprefix', 'oc_');
- // check for orphaned entries in all tables referencing
- // the main polls table
- $query = "ALTER TABLE {$prefix}polls_polls
- CHANGE description description TEXT;";
- $stmt = $this->connection->prepare($query);
- $stmt->execute();
+ $schema = $schemaClosure();
+ $table = $schema->getTable('polls_polls');
+ $table->changeColumn('description', [
+ 'type' => Type::getType(Type::TEXT),
+ 'notnull' => true,
+ 'default' => ''
+ ]);
+
+ return $schema;
}
}