Files
myep-team/migrations/Version20231102162040.php
T

44 lines
2.4 KiB
PHP

<?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 Version20231102162040 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->addSql('CREATE TABLE feedback_set (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, items JSON NOT NULL COMMENT \'(DC2Type:json)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE feedback ADD assignment_id INT DEFAULT NULL, ADD ratings JSON NOT NULL COMMENT \'(DC2Type:json)\', DROP body, DROP author_name, DROP author_email');
$this->addSql('ALTER TABLE feedback ADD CONSTRAINT FK_D2294458D19302F8 FOREIGN KEY (assignment_id) REFERENCES assignment (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_D2294458D19302F8 ON feedback (assignment_id)');
$this->addSql('ALTER TABLE job_profile ADD feedback_set_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE job_profile ADD CONSTRAINT FK_1BB81D942DB73956 FOREIGN KEY (feedback_set_id) REFERENCES feedback_set (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_1BB81D942DB73956 ON job_profile (feedback_set_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE job_profile DROP FOREIGN KEY FK_1BB81D942DB73956');
$this->addSql('DROP TABLE feedback_set');
$this->addSql('ALTER TABLE feedback DROP FOREIGN KEY FK_D2294458D19302F8');
$this->addSql('DROP INDEX IDX_D2294458D19302F8 ON feedback');
$this->addSql('ALTER TABLE feedback ADD body LONGTEXT NOT NULL, ADD author_name VARCHAR(255) NOT NULL, ADD author_email VARCHAR(255) NOT NULL, DROP assignment_id, DROP ratings');
$this->addSql('DROP INDEX IDX_1BB81D942DB73956 ON job_profile');
$this->addSql('ALTER TABLE job_profile DROP feedback_set_id');
}
}