query('SHOW TABLES'); $tables = $stmt->fetchAll(PDO::FETCH_COLUMN); // Check if tables of v0.9 are presents $diff = array_diff([Utils::table('poll'), Utils::table('slot'), Utils::table('vote'), Utils::table('comment')], $tables); return count($diff) === 0; } /** * This method is called only one time in the migration page. * * @param PDO $pdo The connection to database * @return bool true is the execution succeeded */ public function execute(PDO $pdo): bool { $this->alterPollTable($pdo); return true; } private function alterPollTable(PDO $pdo): void { $pdo->exec(' ALTER TABLE `' . Utils::table('poll') . '` ADD `password_hash` VARCHAR(255) NULL DEFAULT NULL , ADD `results_publicly_visible` TINYINT(1) NULL DEFAULT NULL'); } }