<?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 Version20200226172006 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($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE orders ADD created_by INT DEFAULT NULL, ADD updated_by INT DEFAULT NULL, ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE orders ADD CONSTRAINT FK_E52FFDEEDE12AB56 FOREIGN KEY (created_by) REFERENCES fos_user (id)');
$this->addSql('ALTER TABLE orders ADD CONSTRAINT FK_E52FFDEE16FE72E1 FOREIGN KEY (updated_by) REFERENCES fos_user (id)');
$this->addSql('CREATE INDEX IDX_E52FFDEEDE12AB56 ON orders (created_by)');
$this->addSql('CREATE INDEX IDX_E52FFDEE16FE72E1 ON orders (updated_by)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE orders DROP FOREIGN KEY FK_E52FFDEEDE12AB56');
$this->addSql('ALTER TABLE orders DROP FOREIGN KEY FK_E52FFDEE16FE72E1');
$this->addSql('DROP INDEX IDX_E52FFDEEDE12AB56 ON orders');
$this->addSql('DROP INDEX IDX_E52FFDEE16FE72E1 ON orders');
$this->addSql('ALTER TABLE orders DROP created_by, DROP updated_by, DROP created_at, DROP updated_at');
}
}