<?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 Version20220127125119 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('ALTER TABLE customer ADD created_by_id INT DEFAULT NULL, ADD updated_by_id INT DEFAULT NULL, ADD updated_at DATETIME NOT NULL DEFAULT NOW(), CHANGE date created_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE customer ADD CONSTRAINT FK_81398E09B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE customer ADD CONSTRAINT FK_81398E09896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('CREATE INDEX IDX_81398E09B03A8386 ON customer (created_by_id)');
$this->addSql('CREATE INDEX IDX_81398E09896DBBDE ON customer (updated_by_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE customer DROP FOREIGN KEY FK_81398E09B03A8386');
$this->addSql('ALTER TABLE customer DROP FOREIGN KEY FK_81398E09896DBBDE');
$this->addSql('DROP INDEX IDX_81398E09B03A8386 ON customer');
$this->addSql('DROP INDEX IDX_81398E09896DBBDE ON customer');
$this->addSql('ALTER TABLE customer ADD date DATETIME NOT NULL, DROP created_by_id, DROP updated_by_id, DROP created_at, DROP updated_at');
}
public function isTransactional(): bool
{
return false;
}
}