- $this->addSql('ALTER TABLE `wallabag_entry` ADD `uuid` LONGTEXT DEFAULT NULL');
-
- $em = $this->container->get('doctrine.orm.entity_manager');
- $queryBuilder = $this->connection->createQueryBuilder();
- $queryBuilder
- ->select('e.uuid')
- ->andWhere('e.uuid IS NULL');
- $entries = $queryBuilder->execute();
-
- /** @var Entry $entry */
- foreach ($entries as $entry) {
- $entry->generateUuid();
- $em->persist($entry);
- $em->clear();
+ if ($this->connection->getDatabasePlatform()->getName() == 'postgresql') {
+ $this->addSql('ALTER TABLE "'.$this->getTable('entry').'" ADD uuid UUID DEFAULT NULL');
+ } else {
+ $this->addSql('ALTER TABLE "'.$this->getTable('entry').'" ADD uuid LONGTEXT DEFAULT NULL');