diff options
author | dartcafe <github@dartcafe.de> | 2020-04-06 10:05:24 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2020-04-06 10:05:24 +0300 |
commit | dc1afd7fec36a6776ab1f9290e37ca0889d89834 (patch) | |
tree | 6eaea942c421233a4e84fe1661bd0255aab9ab93 /lib/Migration | |
parent | 7f48bd8f91cb3d12a6395ff96e2995ae88789798 (diff) |
Change type of description via doctrine
Diffstat (limited to 'lib/Migration')
-rw-r--r-- | lib/Migration/Version0104Date20200314074611.php | 18 |
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; } } |