<?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 Version20220323063810 extends AbstractMigration
{
public function getDescription(): string
{
return 'add index on tables block_dates,developer,plan,plan_day,project,task,time_entry,unit';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE INDEX idx_block_dates_date_start ON block_dates (date_start)');
$this->addSql('CREATE INDEX idx_block_dates_date_end ON block_dates (date_end)');
$this->addSql('CREATE INDEX idx_date_hiring ON developer (date_hiring)');
$this->addSql('CREATE INDEX idx_date_dismissal ON developer (date_dismissal)');
$this->addSql('CREATE INDEX idx_plan_date_start ON plan (date_start)');
$this->addSql('CREATE INDEX idx_plan_date_end ON plan (date_end)');
$this->addSql('ALTER TABLE plan_day ALTER norm_time DROP DEFAULT');
$this->addSql('ALTER TABLE plan_day ALTER non_working_type DROP DEFAULT');
$this->addSql('ALTER TABLE plan_day ADD CONSTRAINT FK_E94192CD5561CCEE FOREIGN KEY (hub_user_id) REFERENCES hub_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX idx_plan_day_non_working_type ON plan_day (non_working_type)');
$this->addSql('ALTER INDEX idx_e94192cda76ed395 RENAME TO IDX_E94192CD5561CCEE');
$this->addSql('ALTER INDEX plan_day_day_idx RENAME TO idx_plan_day_day');
$this->addSql('CREATE INDEX idx_project_archived ON project (archived)');
$this->addSql('CREATE INDEX idx_project_is_commercial ON project (is_commercial)');
$this->addSql('CREATE INDEX idx_task_favorite ON task (favorite)');
$this->addSql('CREATE INDEX idx_task_is_commercial ON task (is_commercial)');
$this->addSql('CREATE INDEX idx_te_validation_is_approved ON te_validation (is_approved)');
$this->addSql('CREATE INDEX idx_time_entry_timer_start ON time_entry (timer_start)');
$this->addSql('CREATE INDEX idx_time_entry_timer_end ON time_entry (timer_end)');
$this->addSql('CREATE INDEX idx_time_entry_is_fixed ON time_entry (is_fixed)');
$this->addSql('CREATE INDEX idx_unit_slug ON unit (slug)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE plan_day DROP CONSTRAINT FK_E94192CD5561CCEE');
$this->addSql('DROP INDEX idx_plan_day_non_working_type');
$this->addSql('ALTER TABLE plan_day ALTER norm_time SET DEFAULT 0');
$this->addSql('ALTER TABLE plan_day ALTER non_working_type SET DEFAULT \'workday\'');
$this->addSql('ALTER INDEX idx_e94192cd5561ccee RENAME TO idx_e94192cda76ed395');
$this->addSql('ALTER INDEX idx_plan_day_day RENAME TO plan_day_day_idx');
$this->addSql('DROP INDEX idx_time_entry_timer_start');
$this->addSql('DROP INDEX idx_time_entry_timer_end');
$this->addSql('DROP INDEX idx_time_entry_is_fixed');
$this->addSql('DROP INDEX idx_date_hiring');
$this->addSql('DROP INDEX idx_date_dismissal');
$this->addSql('DROP INDEX idx_project_archived');
$this->addSql('DROP INDEX idx_project_is_commercial');
$this->addSql('DROP INDEX idx_plan_date_start');
$this->addSql('DROP INDEX idx_plan_date_end');
$this->addSql('DROP INDEX idx_block_dates_date_start');
$this->addSql('DROP INDEX idx_block_dates_date_end');
$this->addSql('DROP INDEX idx_task_favorite');
$this->addSql('DROP INDEX idx_task_is_commercial');
$this->addSql('DROP INDEX idx_unit_slug');
$this->addSql('DROP INDEX idx_te_validation_is_approved');
}
}