<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210521165434 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE star (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, stream_id INT DEFAULT NULL, project_id INT DEFAULT NULL, created_at DATETIME NOT NULL, type VARCHAR(255) NOT NULL, INDEX IDX_C9DB5A14A76ED395 (user_id), INDEX IDX_C9DB5A14D0ED463E (stream_id), INDEX IDX_C9DB5A14166D1F9C (project_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE star ADD CONSTRAINT FK_C9DB5A14A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE star ADD CONSTRAINT FK_C9DB5A14D0ED463E FOREIGN KEY (stream_id) REFERENCES stream (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE star ADD CONSTRAINT FK_C9DB5A14166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('DROP TABLE star');
}
}