<?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 Version20220517130611 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 location (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, code VARCHAR(255) NOT NULL, headquarter VARCHAR(255) NOT NULL, company VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, country_code VARCHAR(2) NOT NULL, city VARCHAR(255) NOT NULL, email VARCHAR(255) DEFAULT NULL, phone_number VARCHAR(255) DEFAULT NULL, gps_latitude DOUBLE PRECISION NOT NULL, gps_longitude DOUBLE PRECISION NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_5E9E89CBB03A8386 (created_by_id), INDEX IDX_5E9E89CB896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE location ADD CONSTRAINT FK_5E9E89CBB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE location ADD CONSTRAINT FK_5E9E89CB896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE job ADD location_id INT DEFAULT NULL, ADD created_by_id INT DEFAULT NULL, ADD updated_by_id INT DEFAULT NULL, ADD enabled TINYINT(1) NOT NULL, DROP location');
$this->addSql('ALTER TABLE job ADD CONSTRAINT FK_FBD8E0F864D218E FOREIGN KEY (location_id) REFERENCES location (id)');
$this->addSql('ALTER TABLE job ADD CONSTRAINT FK_FBD8E0F8B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE job ADD CONSTRAINT FK_FBD8E0F8896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('CREATE INDEX IDX_FBD8E0F864D218E ON job (location_id)');
$this->addSql('CREATE INDEX IDX_FBD8E0F8B03A8386 ON job (created_by_id)');
$this->addSql('CREATE INDEX IDX_FBD8E0F8896DBBDE ON job (updated_by_id)');
$this->addSql('ALTER TABLE job_application ADD job_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE job_application ADD CONSTRAINT FK_C737C688BE04EA9 FOREIGN KEY (job_id) REFERENCES job (id)');
$this->addSql('CREATE INDEX IDX_C737C688BE04EA9 ON job_application (job_id)');
$this->addSql('ALTER TABLE news ADD created_by_id INT DEFAULT NULL, ADD updated_by_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE news ADD CONSTRAINT FK_1DD39950B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE news ADD CONSTRAINT FK_1DD39950896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('CREATE INDEX IDX_1DD39950B03A8386 ON news (created_by_id)');
$this->addSql('CREATE INDEX IDX_1DD39950896DBBDE ON news (updated_by_id)');
$this->addSql('ALTER TABLE user ADD created_by_id INT DEFAULT NULL, ADD updated_by_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('CREATE INDEX IDX_8D93D649B03A8386 ON user (created_by_id)');
$this->addSql('CREATE INDEX IDX_8D93D649896DBBDE ON user (updated_by_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE job DROP FOREIGN KEY FK_FBD8E0F864D218E');
$this->addSql('DROP TABLE location');
$this->addSql('ALTER TABLE job DROP FOREIGN KEY FK_FBD8E0F8B03A8386');
$this->addSql('ALTER TABLE job DROP FOREIGN KEY FK_FBD8E0F8896DBBDE');
$this->addSql('DROP INDEX IDX_FBD8E0F864D218E ON job');
$this->addSql('DROP INDEX IDX_FBD8E0F8B03A8386 ON job');
$this->addSql('DROP INDEX IDX_FBD8E0F8896DBBDE ON job');
$this->addSql('ALTER TABLE job ADD location VARCHAR(255) NOT NULL, DROP location_id, DROP created_by_id, DROP updated_by_id, DROP enabled');
$this->addSql('ALTER TABLE job_application DROP FOREIGN KEY FK_C737C688BE04EA9');
$this->addSql('DROP INDEX IDX_C737C688BE04EA9 ON job_application');
$this->addSql('ALTER TABLE job_application DROP job_id');
$this->addSql('ALTER TABLE news DROP FOREIGN KEY FK_1DD39950B03A8386');
$this->addSql('ALTER TABLE news DROP FOREIGN KEY FK_1DD39950896DBBDE');
$this->addSql('DROP INDEX IDX_1DD39950B03A8386 ON news');
$this->addSql('DROP INDEX IDX_1DD39950896DBBDE ON news');
$this->addSql('ALTER TABLE news DROP created_by_id, DROP updated_by_id');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D649B03A8386');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D649896DBBDE');
$this->addSql('DROP INDEX IDX_8D93D649B03A8386 ON user');
$this->addSql('DROP INDEX IDX_8D93D649896DBBDE ON user');
$this->addSql('ALTER TABLE user DROP created_by_id, DROP updated_by_id');
}
}