<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230530124806 extends AbstractMigration
{
public function getDescription(): string
{
return 'Announcements-to-lists join table';
}
public function up(Schema $schema): void
{
$this->addSql("
CREATE TABLE `announcement_roster` (
`announcement_id` bigint UNSIGNED NOT NULL,
`roster_id` bigint UNSIGNED NOT NULL,
PRIMARY KEY (`announcement_id`, `roster_id`) USING BTREE,
INDEX `announcement_roster_ibfk_2`(`roster_id`) USING BTREE,
CONSTRAINT `announcement_roster_ibfk_1` FOREIGN KEY (`announcement_id`) REFERENCES `announcement` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `announcement_roster_ibfk_2` FOREIGN KEY (`roster_id`) REFERENCES `roster` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
");
}
public function down(Schema $schema): void
{
$this->addSql("DROP TABLE IF EXISTS `announcement_roster`");
}
}