<?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 Version20220501101149 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 inventory_group (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 inventory_object (id INT AUTO_INCREMENT NOT NULL, target_room_id INT DEFAULT NULL, actual_room_id INT DEFAULT NULL, inventory_number VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, inventory_notice LONGTEXT DEFAULT NULL, date_of_acquisition DATE DEFAULT NULL, acquisition_price_net DOUBLE PRECISION DEFAULT NULL, warranty_until DATE DEFAULT NULL, serial_number VARCHAR(255) DEFAULT NULL, INDEX IDX_A87137479F7FC9F8 (target_room_id), INDEX IDX_A87137471A66B64B (actual_room_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE location (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 manufacturer (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 room (id INT AUTO_INCREMENT NOT NULL, location_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, INDEX IDX_729F519B64D218E (location_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE inventory_object ADD CONSTRAINT FK_A87137479F7FC9F8 FOREIGN KEY (target_room_id) REFERENCES room (id)');
$this->addSql('ALTER TABLE inventory_object ADD CONSTRAINT FK_A87137471A66B64B FOREIGN KEY (actual_room_id) REFERENCES room (id)');
$this->addSql('ALTER TABLE room ADD CONSTRAINT FK_729F519B64D218E FOREIGN KEY (location_id) REFERENCES location (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE room DROP FOREIGN KEY FK_729F519B64D218E');
$this->addSql('ALTER TABLE inventory_object DROP FOREIGN KEY FK_A87137479F7FC9F8');
$this->addSql('ALTER TABLE inventory_object DROP FOREIGN KEY FK_A87137471A66B64B');
$this->addSql('DROP TABLE inventory_group');
$this->addSql('DROP TABLE inventory_object');
$this->addSql('DROP TABLE location');
$this->addSql('DROP TABLE manufacturer');
$this->addSql('DROP TABLE room');
}
}