getWrappedConnection()->getAttribute(\PDO::ATTR_DRIVER_NAME); if ($driver_name === 'mysql') { $stmt = $connection->prepare( "SELECT Column_Default from Information_Schema.Columns where Table_Name = ? AND Column_Name = ?;" ); $stmt->bindValue(1, Utils::table('poll')); $stmt->bindValue(2, 'end_date'); $stmt->execute(); $default = $stmt->fetch(\PDO::FETCH_COLUMN); return $default === null; } return true; } /** * @param Schema $schema * @throws \Doctrine\DBAL\Schema\SchemaException * @throws \Doctrine\DBAL\Migrations\SkipMigrationException * @throws \Doctrine\DBAL\DBALException */ public function up(Schema $schema) { // We don't disable this migration even if legacy because it wasn't working correctly before // $this->skipIf($this->legacyCheck($schema, 'Framadate\Migration\Fix_MySQL_No_Zero_Date'), 'Migration has been executed in an earlier database migration system'); $this->skipIf($this->preCondition($this->connection), "Database server isn't MySQL or poll end_date default value was already NULL"); $poll = $schema->getTable(Utils::table('poll')); $poll->changeColumn('end_date', ['default' => null, 'notnull' => false]); } public function down(Schema $schema) { // nothing } }