migrations/Version20230324092514.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20230324092514 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('ALTER TABLE contract ADD project_id INT NOT NULL, ADD currency_id INT NOT NULL, ADD seria VARCHAR(20) NOT NULL, ADD indefinite TINYINT(1) NOT NULL, ADD exchange_rate NUMERIC(10, 6) NOT NULL, DROP year_share');
  19.         $this->addSql('ALTER TABLE contract ADD CONSTRAINT FK_E98F2859166D1F9C FOREIGN KEY (project_id) REFERENCES project (id)');
  20.         $this->addSql('ALTER TABLE contract ADD CONSTRAINT FK_E98F285938248176 FOREIGN KEY (currency_id) REFERENCES currency (id)');
  21.         $this->addSql('CREATE INDEX IDX_E98F2859166D1F9C ON contract (project_id)');
  22.         $this->addSql('CREATE INDEX IDX_E98F285938248176 ON contract (currency_id)');
  23.         $this->addSql('ALTER TABLE offer ADD CONSTRAINT FK_29D6873E82F1BAF4 FOREIGN KEY (language_id) REFERENCES language (id)');
  24.         $this->addSql('CREATE INDEX IDX_29D6873E82F1BAF4 ON offer (language_id)');
  25.         $this->addSql('ALTER TABLE task CHANGE name name LONGTEXT NOT NULL');
  26.         $this->addSql('ALTER TABLE tranche ADD billable_value NUMERIC(10, 2) NOT NULL');
  27.     }
  28.     public function down(Schema $schema): void
  29.     {
  30.         // this down() migration is auto-generated, please modify it to your needs
  31.         $this->addSql('ALTER TABLE contract DROP FOREIGN KEY FK_E98F2859166D1F9C');
  32.         $this->addSql('ALTER TABLE contract DROP FOREIGN KEY FK_E98F285938248176');
  33.         $this->addSql('DROP INDEX IDX_E98F2859166D1F9C ON contract');
  34.         $this->addSql('DROP INDEX IDX_E98F285938248176 ON contract');
  35.         $this->addSql('ALTER TABLE contract ADD year_share DATE DEFAULT NULL, DROP project_id, DROP currency_id, DROP seria, DROP indefinite, DROP exchange_rate');
  36.         $this->addSql('ALTER TABLE offer DROP FOREIGN KEY FK_29D6873E82F1BAF4');
  37.         $this->addSql('DROP INDEX IDX_29D6873E82F1BAF4 ON offer');
  38.         $this->addSql('ALTER TABLE task CHANGE name name VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`');
  39.         $this->addSql('ALTER TABLE tranche DROP billable_value');
  40.     }
  41. }