<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20200618122708 extends AbstractMigration
{
/**
* @param Schema $schema
*/
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('UPDATE object SET `creation_date` = "1970-01-02" WHERE CAST(creation_date AS CHAR(20)) = "0000-00-00 00:00:00"');
$this->addSql('ALTER TABLE object CHANGE dimension_length_cm dimension_length_cm DOUBLE PRECISION DEFAULT NULL, CHANGE dimension_width_cm dimension_width_cm DOUBLE PRECISION DEFAULT NULL, CHANGE dimension_diameter_cm dimension_diameter_cm DOUBLE PRECISION DEFAULT NULL');
$this->addSql('ALTER TABLE object_image ADD uri VARCHAR(255) DEFAULT NULL, ADD comment LONGTEXT DEFAULT NULL');
}
/**
* @param Schema $schema
*/
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 object CHANGE dimension_length_cm dimension_length_cm INT DEFAULT NULL, CHANGE dimension_width_cm dimension_width_cm INT DEFAULT NULL, CHANGE dimension_diameter_cm dimension_diameter_cm INT DEFAULT NULL');
$this->addSql('ALTER TABLE object_image DROP uri, DROP comment');
}
}