<?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 Version20220623205702 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$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');
$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');
$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');
$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');
$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');
$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');
$this->addSql('ALTER TABLE employee_history ADD CONSTRAINT FK_A7F62644AE80F5DF FOREIGN KEY (department_id) REFERENCES employee_department (id)');
$this->addSql('ALTER TABLE employee_history ADD CONSTRAINT FK_A7F62644DD842E46 FOREIGN KEY (position_id) REFERENCES employee_position (id)');
$this->addSql('ALTER TABLE employee_history ADD CONSTRAINT FK_A7F62644783E3463 FOREIGN KEY (manager_id) REFERENCES employee (id)');
$this->addSql('ALTER TABLE employee_hour_count ADD CONSTRAINT FK_1BD385F81E058452 FOREIGN KEY (history_id) REFERENCES employee_history (id)');
$this->addSql('ALTER TABLE employee_salary_bonus_history ADD CONSTRAINT FK_92E2E8EF1E058452 FOREIGN KEY (history_id) REFERENCES employee_history (id)');
$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');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE employee_history DROP FOREIGN KEY FK_A7F62644AE80F5DF');
$this->addSql('ALTER TABLE employee_hour_count DROP FOREIGN KEY FK_1BD385F81E058452');
$this->addSql('ALTER TABLE employee_salary_bonus_history DROP FOREIGN KEY FK_92E2E8EF1E058452');
$this->addSql('ALTER TABLE employee_history DROP FOREIGN KEY FK_A7F62644DD842E46');
$this->addSql('DROP TABLE employee_department');
$this->addSql('DROP TABLE employee_history');
$this->addSql('DROP TABLE employee_hour_count');
$this->addSql('DROP TABLE employee_payroll');
$this->addSql('DROP TABLE employee_position');
$this->addSql('DROP TABLE employee_salary_bonus_history');
$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');
}
}