migrations/Version20220922141807.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 Version20220922141807 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('CREATE SEQUENCE project_department_price_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  19.         $this->addSql('CREATE SEQUENCE project_report_department_price_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  20.         $this->addSql('CREATE TABLE project_department_price (id INT NOT NULL, project_id INT DEFAULT NULL, department_id INT DEFAULT NULL, price INT DEFAULT NULL, PRIMARY KEY(id))');
  21.         $this->addSql('CREATE INDEX IDX_6CEE5EAC166D1F9C ON project_department_price (project_id)');
  22.         $this->addSql('CREATE INDEX IDX_6CEE5EACAE80F5DF ON project_department_price (department_id)');
  23.         $this->addSql('CREATE TABLE project_report_department_price (id INT NOT NULL, project_report_id INT DEFAULT NULL, department_id INT DEFAULT NULL, price INT DEFAULT NULL, PRIMARY KEY(id))');
  24.         $this->addSql('CREATE INDEX IDX_8BD6E9B85AEEE117 ON project_report_department_price (project_report_id)');
  25.         $this->addSql('CREATE INDEX IDX_8BD6E9B8AE80F5DF ON project_report_department_price (department_id)');
  26.         $this->addSql('ALTER TABLE project_department_price ADD CONSTRAINT FK_6CEE5EAC166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  27.         $this->addSql('ALTER TABLE project_department_price ADD CONSTRAINT FK_6CEE5EACAE80F5DF FOREIGN KEY (department_id) REFERENCES department (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  28.         $this->addSql('ALTER TABLE project_report_department_price ADD CONSTRAINT FK_8BD6E9B85AEEE117 FOREIGN KEY (project_report_id) REFERENCES project_report (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  29.         $this->addSql('ALTER TABLE project_report_department_price ADD CONSTRAINT FK_8BD6E9B8AE80F5DF FOREIGN KEY (department_id) REFERENCES department (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  30.         $this->addSql('ALTER TABLE department ADD price INT DEFAULT NULL');
  31.     }
  32.     public function down(Schema $schema): void
  33.     {
  34.         // this down() migration is auto-generated, please modify it to your needs
  35.         $this->addSql('CREATE SCHEMA public');
  36.         $this->addSql('DROP SEQUENCE project_department_price_id_seq CASCADE');
  37.         $this->addSql('DROP SEQUENCE project_report_department_price_id_seq CASCADE');
  38.         $this->addSql('ALTER TABLE project_department_price DROP CONSTRAINT FK_6CEE5EAC166D1F9C');
  39.         $this->addSql('ALTER TABLE project_department_price DROP CONSTRAINT FK_6CEE5EACAE80F5DF');
  40.         $this->addSql('ALTER TABLE project_report_department_price DROP CONSTRAINT FK_8BD6E9B85AEEE117');
  41.         $this->addSql('ALTER TABLE project_report_department_price DROP CONSTRAINT FK_8BD6E9B8AE80F5DF');
  42.         $this->addSql('DROP TABLE project_department_price');
  43.         $this->addSql('DROP TABLE project_report_department_price');
  44.         $this->addSql('ALTER TABLE "user" DROP CONSTRAINT FK_8D93D6498C03F15C');
  45.         $this->addSql('DROP INDEX UNIQ_8D93D649E7927C74');
  46.         $this->addSql('DROP INDEX UNIQ_8D93D6498C03F15C');
  47.         $this->addSql('DROP INDEX "primary"');
  48.         $this->addSql('ALTER TABLE department DROP price');
  49.     }
  50. }