<?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 Version20200830194419 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('UPDATE clients SET date=\'2003-12-10 16:08:00\' WHERE id=1');
$this->addSql('ALTER TABLE clients DROP FOREIGN KEY FK_C82E744B25A18D');
$this->addSql('DROP TABLE clientcategoryprice');
$this->addSql('DROP INDEX IDX_C82E744B25A18D ON clients');
$this->addSql('ALTER TABLE clients DROP client_category_price_id, DROP hasOpenAccount, DROP isAa, DROP requiresFastFacturation');
$this->addSql('ALTER TABLE orders DROP FOREIGN KEY FK_E52FFDEE19EB6921');
$this->addSql('DROP INDEX IDX_E52FFDEE19EB6921 ON orders');
$this->addSql('ALTER TABLE orders CHANGE client_id customer_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE orders ADD CONSTRAINT FK_E52FFDEE9395C3F3 FOREIGN KEY (customer_id) REFERENCES clients (id)');
$this->addSql('CREATE INDEX IDX_E52FFDEE9395C3F3 ON orders (customer_id)');
}
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_E52FFDEE9395C3F3');
$this->addSql('DROP INDEX IDX_E52FFDEE9395C3F3 ON orders');
$this->addSql('ALTER TABLE orders CHANGE customer_id client_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE orders ADD CONSTRAINT FK_E52FFDEE19EB6921 FOREIGN KEY (client_id) REFERENCES clients (id)');
$this->addSql('CREATE INDEX IDX_E52FFDEE19EB6921 ON orders (client_id)');
$this->addSql('CREATE TABLE clientcategoryprice (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(50) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, description VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, percentage NUMERIC(10, 2) NOT NULL, UNIQUE INDEX UNIQ_F727E82D5E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE clients ADD client_category_price_id INT DEFAULT NULL, ADD hasOpenAccount TINYINT(1) NOT NULL, ADD isAa TINYINT(1) NOT NULL, ADD requiresFastFacturation TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE clients ADD CONSTRAINT FK_C82E744B25A18D FOREIGN KEY (client_category_price_id) REFERENCES clientcategoryprice (id)');
$this->addSql('CREATE INDEX IDX_C82E744B25A18D ON clients (client_category_price_id)');
}
}