<?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 Version20220412152606 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 task (id INT AUTO_INCREMENT NOT NULL, motorist_id INT NOT NULL, vehicle_id INT NOT NULL, name VARCHAR(64) NOT NULL, description VARCHAR(255) DEFAULT NULL, date DATE NOT NULL, status VARCHAR(15) NOT NULL, INDEX IDX_527EDB25E38C3B86 (motorist_id), INDEX IDX_527EDB25545317D1 (vehicle_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE task_location (id INT AUTO_INCREMENT NOT NULL, task_id INT NOT NULL, name VARCHAR(128) NOT NULL, latitude DOUBLE PRECISION NOT NULL, longitude DOUBLE PRECISION NOT NULL, INDEX IDX_1E5E63878DB60186 (task_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE task ADD CONSTRAINT FK_527EDB25E38C3B86 FOREIGN KEY (motorist_id) REFERENCES motorist (id)');
$this->addSql('ALTER TABLE task ADD CONSTRAINT FK_527EDB25545317D1 FOREIGN KEY (vehicle_id) REFERENCES vehicle (id)');
$this->addSql('ALTER TABLE task_location ADD CONSTRAINT FK_1E5E63878DB60186 FOREIGN KEY (task_id) REFERENCES task (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE task_location DROP FOREIGN KEY FK_1E5E63878DB60186');
$this->addSql('DROP TABLE task');
$this->addSql('DROP TABLE task_location');
}
}