migrations/Version20220323063810.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 Version20220323063810 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'add index on tables block_dates,developer,plan,plan_day,project,task,time_entry,unit';
  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 INDEX idx_block_dates_date_start ON block_dates (date_start)');
  19.         $this->addSql('CREATE INDEX idx_block_dates_date_end ON block_dates (date_end)');
  20.         $this->addSql('CREATE INDEX idx_date_hiring ON developer (date_hiring)');
  21.         $this->addSql('CREATE INDEX idx_date_dismissal ON developer (date_dismissal)');
  22.         $this->addSql('CREATE INDEX idx_plan_date_start ON plan (date_start)');
  23.         $this->addSql('CREATE INDEX idx_plan_date_end ON plan (date_end)');
  24.         $this->addSql('ALTER TABLE plan_day ALTER norm_time DROP DEFAULT');
  25.         $this->addSql('ALTER TABLE plan_day ALTER non_working_type DROP DEFAULT');
  26.         $this->addSql('ALTER TABLE plan_day ADD CONSTRAINT FK_E94192CD5561CCEE FOREIGN KEY (hub_user_id) REFERENCES hub_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  27.         $this->addSql('CREATE INDEX idx_plan_day_non_working_type ON plan_day (non_working_type)');
  28.         $this->addSql('ALTER INDEX idx_e94192cda76ed395 RENAME TO IDX_E94192CD5561CCEE');
  29.         $this->addSql('ALTER INDEX plan_day_day_idx RENAME TO idx_plan_day_day');
  30.         $this->addSql('CREATE INDEX idx_project_archived ON project (archived)');
  31.         $this->addSql('CREATE INDEX idx_project_is_commercial ON project (is_commercial)');
  32.         $this->addSql('CREATE INDEX idx_task_favorite ON task (favorite)');
  33.         $this->addSql('CREATE INDEX idx_task_is_commercial ON task (is_commercial)');
  34.         $this->addSql('CREATE INDEX idx_te_validation_is_approved ON te_validation (is_approved)');
  35.         $this->addSql('CREATE INDEX idx_time_entry_timer_start ON time_entry (timer_start)');
  36.         $this->addSql('CREATE INDEX idx_time_entry_timer_end ON time_entry (timer_end)');
  37.         $this->addSql('CREATE INDEX idx_time_entry_is_fixed ON time_entry (is_fixed)');
  38.         $this->addSql('CREATE INDEX idx_unit_slug ON unit (slug)');
  39.     }
  40.     public function down(Schema $schema): void
  41.     {
  42.         // this down() migration is auto-generated, please modify it to your needs
  43.         $this->addSql('ALTER TABLE plan_day DROP CONSTRAINT FK_E94192CD5561CCEE');
  44.         $this->addSql('DROP INDEX idx_plan_day_non_working_type');
  45.         $this->addSql('ALTER TABLE plan_day ALTER norm_time SET DEFAULT 0');
  46.         $this->addSql('ALTER TABLE plan_day ALTER non_working_type SET DEFAULT \'workday\'');
  47.         $this->addSql('ALTER INDEX idx_e94192cd5561ccee RENAME TO idx_e94192cda76ed395');
  48.         $this->addSql('ALTER INDEX idx_plan_day_day RENAME TO plan_day_day_idx');
  49.         $this->addSql('DROP INDEX idx_time_entry_timer_start');
  50.         $this->addSql('DROP INDEX idx_time_entry_timer_end');
  51.         $this->addSql('DROP INDEX idx_time_entry_is_fixed');
  52.         $this->addSql('DROP INDEX idx_date_hiring');
  53.         $this->addSql('DROP INDEX idx_date_dismissal');
  54.         $this->addSql('DROP INDEX idx_project_archived');
  55.         $this->addSql('DROP INDEX idx_project_is_commercial');
  56.         $this->addSql('DROP INDEX idx_plan_date_start');
  57.         $this->addSql('DROP INDEX idx_plan_date_end');
  58.         $this->addSql('DROP INDEX idx_block_dates_date_start');
  59.         $this->addSql('DROP INDEX idx_block_dates_date_end');
  60.         $this->addSql('DROP INDEX idx_task_favorite');
  61.         $this->addSql('DROP INDEX idx_task_is_commercial');
  62.         $this->addSql('DROP INDEX idx_unit_slug');
  63.         $this->addSql('DROP INDEX idx_te_validation_is_approved');
  64.     }
  65. }