<?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 Version20240508135548 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 cotation DROP FOREIGN KEY FK_996DA944726FC894');
$this->addSql('DROP INDEX IDX_996DA944726FC894 ON cotation');
$this->addSql('ALTER TABLE cotation ADD patient_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', ADD created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD deleted_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', DROP patient_prescription_id');
$this->addSql('ALTER TABLE cotation ADD CONSTRAINT FK_996DA9446B899279 FOREIGN KEY (patient_id) REFERENCES `patient` (id)');
$this->addSql('CREATE INDEX IDX_996DA9446B899279 ON cotation (patient_id)');
// add chronic default value to 1
$this->addSql('ALTER TABLE patient ADD chronic TINYINT(1) NOT NULL DEFAULT 1, ADD type_billing INT NOT NULL DEFAULT 1, ADD office_care TINYINT(1) NOT NULL DEFAULT 0');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE cotation DROP FOREIGN KEY FK_996DA9446B899279');
$this->addSql('DROP INDEX IDX_996DA9446B899279 ON cotation');
$this->addSql('ALTER TABLE cotation ADD patient_prescription_id INT NOT NULL, DROP patient_id, DROP created_at, DROP deleted_at');
$this->addSql('ALTER TABLE cotation ADD CONSTRAINT FK_996DA944726FC894 FOREIGN KEY (patient_prescription_id) REFERENCES patient_prescription (id)');
$this->addSql('CREATE INDEX IDX_996DA944726FC894 ON cotation (patient_prescription_id)');
$this->addSql('ALTER TABLE `patient` DROP chronic, DROP type_billing, DROP office_care');
}
}