/** * Remove data. * * @param Schema $schema */ public function down(Schema $schema) { if (Version::isSupportGetInstanceFunction()) { $app = Application::getInstance(); $meta = $this->getMetadata($app['orm.em']); $tool = new SchemaTool($app['orm.em']); $schemaFromMetadata = $tool->getSchemaFromMetadata($meta); // テーブル削除 foreach ($schemaFromMetadata->getTables() as $table) { if ($schema->hasTable($table->getName())) { $schema->dropTable($table->getName()); } } // シーケンス削除 foreach ($schemaFromMetadata->getSequences() as $sequence) { if ($schema->hasSequence($sequence->getName())) { $schema->dropSequence($sequence->getName()); } } } else { // this down() migration is auto-generated, please modify it to your needs $schema->dropTable(self::NAME); } }