<?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 Version20220830054606 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 expense_purpose (id INT AUTO_INCREMENT NOT NULL, expense_type_id INT NOT NULL, name VARCHAR(255) NOT NULL, INDEX IDX_D59CF8D1A857C7A9 (expense_type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE expense_type (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 leave_application (id INT AUTO_INCREMENT NOT NULL, leavename_id INT NOT NULL, emp_id INT NOT NULL, from_days DATE NOT NULL, to_days DATE NOT NULL, reasons VARCHAR(500) NOT NULL, address VARCHAR(400) DEFAULT NULL, contact_no VARCHAR(50) DEFAULT NULL, special_remarks VARCHAR(500) DEFAULT NULL, status INT NOT NULL, type INT DEFAULT NULL, entryby INT DEFAULT NULL, entrydate DATETIME DEFAULT NULL, editby INT DEFAULT NULL, editdate DATETIME DEFAULT NULL, fh_approval INT DEFAULT NULL, fh_approval_by INT DEFAULT NULL, fh_approval_date DATETIME DEFAULT NULL, dh_approval INT DEFAULT NULL, dh_approval_by INT DEFAULT NULL, dh_approval_date DATETIME DEFAULT NULL, INDEX IDX_178D3896BEE2E5FA (leavename_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE leavename (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, days INT DEFAULT NULL, remarks VARCHAR(255) DEFAULT NULL, status INT DEFAULT NULL, type INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE tour_claim (id INT AUTO_INCREMENT NOT NULL, tour_request_id INT NOT NULL, submition_date DATE NOT NULL, starting_date DATETIME DEFAULT NULL, ending_date DATETIME DEFAULT NULL, tour_details VARCHAR(2000) NOT NULL, INDEX IDX_9C26CE0FA4A2AE3A (tour_request_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE tour_claim_details (id INT AUTO_INCREMENT NOT NULL, tour_claim_id INT NOT NULL, category VARCHAR(255) NOT NULL, from_place VARCHAR(255) NOT NULL, starting_date DATETIME DEFAULT NULL, to_place VARCHAR(255) DEFAULT NULL, ending_date DATETIME DEFAULT NULL, travel_mode VARCHAR(255) DEFAULT NULL, amount_currency VARCHAR(255) NOT NULL, amount DOUBLE PRECISION DEFAULT NULL, remarks VARCHAR(555) DEFAULT NULL, INDEX IDX_866F30B7EA69FDAC (tour_claim_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE tour_request (id INT AUTO_INCREMENT NOT NULL, expense_type_id INT NOT NULL, expense_purpose_id INT NOT NULL, user_id INT NOT NULL, submition_date DATE NOT NULL, tour_scope VARCHAR(50) NOT NULL, place_visit VARCHAR(255) NOT NULL, expect_visit VARCHAR(555) NOT NULL, starting_date DATETIME DEFAULT NULL, ending_date DATETIME DEFAULT NULL, contact_phone VARCHAR(55) NOT NULL, contact_address VARCHAR(855) NOT NULL, transportation_mode VARCHAR(85) NOT NULL, tour_purpose VARCHAR(2000) NOT NULL, official_duties VARCHAR(2000) DEFAULT NULL, advance_currency VARCHAR(85) DEFAULT NULL, advance_amount DOUBLE PRECISION DEFAULT NULL, fh_approval INT DEFAULT NULL, fh_approval_by INT DEFAULT NULL, fh_approval_date DATETIME DEFAULT NULL, dh_approval INT DEFAULT NULL, dh_approval_by INT DEFAULT NULL, dh_approval_date DATETIME DEFAULT NULL, INDEX IDX_7B7D0A1EA857C7A9 (expense_type_id), INDEX IDX_7B7D0A1ECFD62E38 (expense_purpose_id), INDEX IDX_7B7D0A1EA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, full_name VARCHAR(255) NOT NULL, office_phone VARCHAR(50) DEFAULT NULL, office_email VARCHAR(60) DEFAULT NULL, functional_head INT DEFAULT NULL, department_head INT DEFAULT NULL, status INT DEFAULT NULL, remarks VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_8D93D649F85E0677 (username), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('ALTER TABLE expense_purpose ADD CONSTRAINT FK_D59CF8D1A857C7A9 FOREIGN KEY (expense_type_id) REFERENCES expense_type (id)');
        $this->addSql('ALTER TABLE leave_application ADD CONSTRAINT FK_178D3896BEE2E5FA FOREIGN KEY (leavename_id) REFERENCES leavename (id)');
        $this->addSql('ALTER TABLE tour_claim ADD CONSTRAINT FK_9C26CE0FA4A2AE3A FOREIGN KEY (tour_request_id) REFERENCES tour_request (id)');
        $this->addSql('ALTER TABLE tour_claim_details ADD CONSTRAINT FK_866F30B7EA69FDAC FOREIGN KEY (tour_claim_id) REFERENCES tour_claim (id)');
        $this->addSql('ALTER TABLE tour_request ADD CONSTRAINT FK_7B7D0A1EA857C7A9 FOREIGN KEY (expense_type_id) REFERENCES expense_type (id)');
        $this->addSql('ALTER TABLE tour_request ADD CONSTRAINT FK_7B7D0A1ECFD62E38 FOREIGN KEY (expense_purpose_id) REFERENCES expense_purpose (id)');
        $this->addSql('ALTER TABLE tour_request ADD CONSTRAINT FK_7B7D0A1EA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
    }

    public function down(Schema $schema) : void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE tour_request DROP FOREIGN KEY FK_7B7D0A1ECFD62E38');
        $this->addSql('ALTER TABLE expense_purpose DROP FOREIGN KEY FK_D59CF8D1A857C7A9');
        $this->addSql('ALTER TABLE tour_request DROP FOREIGN KEY FK_7B7D0A1EA857C7A9');
        $this->addSql('ALTER TABLE leave_application DROP FOREIGN KEY FK_178D3896BEE2E5FA');
        $this->addSql('ALTER TABLE tour_claim_details DROP FOREIGN KEY FK_866F30B7EA69FDAC');
        $this->addSql('ALTER TABLE tour_claim DROP FOREIGN KEY FK_9C26CE0FA4A2AE3A');
        $this->addSql('ALTER TABLE tour_request DROP FOREIGN KEY FK_7B7D0A1EA76ED395');
        $this->addSql('DROP TABLE expense_purpose');
        $this->addSql('DROP TABLE expense_type');
        $this->addSql('DROP TABLE leave_application');
        $this->addSql('DROP TABLE leavename');
        $this->addSql('DROP TABLE tour_claim');
        $this->addSql('DROP TABLE tour_claim_details');
        $this->addSql('DROP TABLE tour_request');
        $this->addSql('DROP TABLE user');
    }
}
