<?php
declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20201217084815 extends AbstractMigration
{
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('ALTER TABLE legal_entity_order_invoice ADD created_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', ADD updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE date date DATE NOT NULL COMMENT \'(DC2Type:carbondate)\', CHANGE sent_date sent_date DATE DEFAULT NULL COMMENT \'(DC2Type:carbondate)\', CHANGE payment_date payment_date DATE DEFAULT NULL COMMENT \'(DC2Type:carbondate)\', CHANGE cancellation_date cancellation_date DATE DEFAULT NULL COMMENT \'(DC2Type:carbondate)\', CHANGE file_timestamp file_timestamp DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE alpha_last_attempt alpha_last_attempt DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\'');
$this->addSql('UPDATE legal_entity_order_invoice SET created_at = legal_entity_order_invoice.date WHERE created_at IS NULL ');
$this->addSql('UPDATE legal_entity_order_invoice SET updated_at = legal_entity_order_invoice.date WHERE updated_at IS NULL ');
$this->addSql('ALTER TABLE legal_entity_order_invoice MODIFY created_at DATETIME NOT NULL COMMENT \'(DC2Type:carbondatetime)\', MODIFY updated_at DATETIME NOT NULL COMMENT \'(DC2Type:carbondatetime)\'');
}
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('ALTER TABLE legal_entity_order_invoice DROP created_at, DROP updated_at, CHANGE date date DATE NOT NULL COMMENT \'(DC2Type:carbondate)\', CHANGE sent_date sent_date DATE DEFAULT NULL COMMENT \'(DC2Type:carbondate)\', CHANGE payment_date payment_date DATE DEFAULT NULL COMMENT \'(DC2Type:carbondate)\', CHANGE cancellation_date cancellation_date DATE DEFAULT NULL COMMENT \'(DC2Type:carbondate)\', CHANGE alpha_last_attempt alpha_last_attempt DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE file_timestamp file_timestamp DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\'');
}
}