skipIf($this->legacyCheck($schema, 'Framadate\Migration\Generate_uniqId_for_old_votes'), 'Migration has been executed in an earlier database migration system'); foreach ([Utils::table('poll'), Utils::table('slot'), Utils::table('vote'), Utils::table('comment')] as $table) { $this->skipIf(!$schema->hasTable($table), 'Missing table ' . $table); } $this->connection->beginTransaction(); $select = $this->connection->query(' SELECT id FROM ' . Utils::table('vote') . ' WHERE uniqid = \'\''); $update = $this->connection->prepare(' UPDATE ' . Utils::table('vote') . ' SET uniqid = :uniqid WHERE id = :id'); while ($row = $select->fetch(\PDO::FETCH_OBJ)) { $token = Token::getToken(16); $update->execute([ 'uniqid' => $token, 'id' => $row->id ]); } $this->connection->commit(); } public function down(Schema $schema) { // TODO: Implement down() method. } }