skipIf($this->legacyCheck($schema, 'Framadate\Migration\Alter_Comment_table_adding_date'), 'Migration has been executed in an earlier database migration system'); $commentTable = $schema->getTable(Utils::table('comment')); $this->skipIf($commentTable->hasColumn('date'), 'Column date in comment table already exists'); // The default for datetime types is only available for MySQL 5.6 // See the "Functionality Added or Changed" section, // "Important Change: In MySQL, the TIMESTAMP data type" element, on // https://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-6.html $commentTable->addColumn('date', 'datetime', ['default' => 0]); } /** * @param Schema $schema * @throws \Doctrine\DBAL\Schema\SchemaException */ public function down(Schema $schema) { $commentTable = $schema->getTable(Utils::table('comment')); $commentTable->dropColumn('comment'); } }