migrations/Version20220623205702.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 Version20220623205702 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 TABLE employee_department (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE employee_history (id INT AUTO_INCREMENT NOT NULL, department_id INT NOT NULL, position_id INT NOT NULL, manager_id INT DEFAULT NULL, start_date DATETIME NOT NULL, end_date DATETIME DEFAULT NULL, reason VARCHAR(255) DEFAULT NULL, salary_type TEXT NOT NULL, price DOUBLE PRECISION NOT NULL, INDEX IDX_A7F62644AE80F5DF (department_id), INDEX IDX_A7F62644DD842E46 (position_id), INDEX IDX_A7F62644783E3463 (manager_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE employee_hour_count (id INT AUTO_INCREMENT NOT NULL, history_id INT NOT NULL, date DATE NOT NULL, total_hours DOUBLE PRECISION NOT NULL, INDEX IDX_1BD385F81E058452 (history_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('CREATE TABLE employee_payroll (id INT AUTO_INCREMENT NOT NULL, payment_type INT NOT NULL, start_date DATETIME NOT NULL, end_date DATETIME NOT NULL, rate DOUBLE PRECISION NOT NULL, total_hours INT NOT NULL, total_amount DOUBLE PRECISION NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('CREATE TABLE employee_position (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  23.         $this->addSql('CREATE TABLE employee_salary_bonus_history (id INT AUTO_INCREMENT NOT NULL, history_id INT DEFAULT NULL, start_date DATETIME NOT NULL, end_date DATETIME NOT NULL, price DOUBLE PRECISION NOT NULL, INDEX IDX_92E2E8EF1E058452 (history_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  24.         $this->addSql('ALTER TABLE employee_history ADD CONSTRAINT FK_A7F62644AE80F5DF FOREIGN KEY (department_id) REFERENCES employee_department (id)');
  25.         $this->addSql('ALTER TABLE employee_history ADD CONSTRAINT FK_A7F62644DD842E46 FOREIGN KEY (position_id) REFERENCES employee_position (id)');
  26.         $this->addSql('ALTER TABLE employee_history ADD CONSTRAINT FK_A7F62644783E3463 FOREIGN KEY (manager_id) REFERENCES employee (id)');
  27.         $this->addSql('ALTER TABLE employee_hour_count ADD CONSTRAINT FK_1BD385F81E058452 FOREIGN KEY (history_id) REFERENCES employee_history (id)');
  28.         $this->addSql('ALTER TABLE employee_salary_bonus_history ADD CONSTRAINT FK_92E2E8EF1E058452 FOREIGN KEY (history_id) REFERENCES employee_history (id)');
  29.         $this->addSql('ALTER TABLE employee ADD date_of_birth DATE DEFAULT NULL, ADD city_of_birth VARCHAR(255) DEFAULT NULL, ADD gender TEXT NOT NULL, ADD number_of_childrens INT DEFAULT NULL, ADD phone_number VARCHAR(255) DEFAULT NULL, ADD cnss VARCHAR(255) DEFAULT NULL, ADD relation_ship_status TEXT NOT NULL');
  30.     }
  31.     public function down(Schema $schema): void
  32.     {
  33.         // this down() migration is auto-generated, please modify it to your needs
  34.         $this->addSql('ALTER TABLE employee_history DROP FOREIGN KEY FK_A7F62644AE80F5DF');
  35.         $this->addSql('ALTER TABLE employee_hour_count DROP FOREIGN KEY FK_1BD385F81E058452');
  36.         $this->addSql('ALTER TABLE employee_salary_bonus_history DROP FOREIGN KEY FK_92E2E8EF1E058452');
  37.         $this->addSql('ALTER TABLE employee_history DROP FOREIGN KEY FK_A7F62644DD842E46');
  38.         $this->addSql('DROP TABLE employee_department');
  39.         $this->addSql('DROP TABLE employee_history');
  40.         $this->addSql('DROP TABLE employee_hour_count');
  41.         $this->addSql('DROP TABLE employee_payroll');
  42.         $this->addSql('DROP TABLE employee_position');
  43.         $this->addSql('DROP TABLE employee_salary_bonus_history');
  44.         $this->addSql('ALTER TABLE employee DROP date_of_birth, DROP city_of_birth, DROP gender, DROP number_of_childrens, DROP phone_number, DROP cnss, DROP relation_ship_status');
  45.     }
  46. }