diff --git a/migrations/2023_06_07_000000_remove_tag_id_constraint.php b/migrations/2023_06_07_000000_remove_tag_id_constraint.php new file mode 100644 index 0000000..6614057 --- /dev/null +++ b/migrations/2023_06_07_000000_remove_tag_id_constraint.php @@ -0,0 +1,38 @@ + static function (Builder $schema) { + $schema->table('webhooks', function (Blueprint $table) use ($schema) { + $indexes = $schema->getConnection()->getDoctrineSchemaManager()->listTableIndexes($table->getTable()); + + /** + * @var \Doctrine\DBAL\Schema\Index $index + */ + $index = collect($indexes)->first(function ($index) { + return in_array('tag_id', $index->getColumns(), true); + }); + + if ($index) { + $table->dropForeign(['tag_id']); + $table->dropIndex($index->getName()); + } + }); + }, + 'down' => static function (Builder $schema) { + // + }, +];