migrations/Version20220501101149.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20220501101149 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $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');
  20.         $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');
  21.         $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');
  22.         $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');
  23.         $this->addSql('ALTER TABLE inventory_object ADD CONSTRAINT FK_A87137479F7FC9F8 FOREIGN KEY (target_room_id) REFERENCES room (id)');
  24.         $this->addSql('ALTER TABLE inventory_object ADD CONSTRAINT FK_A87137471A66B64B FOREIGN KEY (actual_room_id) REFERENCES room (id)');
  25.         $this->addSql('ALTER TABLE room ADD CONSTRAINT FK_729F519B64D218E FOREIGN KEY (location_id) REFERENCES location (id)');
  26.     }
  27.     public function down(Schema $schema): void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->addSql('ALTER TABLE room DROP FOREIGN KEY FK_729F519B64D218E');
  31.         $this->addSql('ALTER TABLE inventory_object DROP FOREIGN KEY FK_A87137479F7FC9F8');
  32.         $this->addSql('ALTER TABLE inventory_object DROP FOREIGN KEY FK_A87137471A66B64B');
  33.         $this->addSql('DROP TABLE inventory_group');
  34.         $this->addSql('DROP TABLE inventory_object');
  35.         $this->addSql('DROP TABLE location');
  36.         $this->addSql('DROP TABLE manufacturer');
  37.         $this->addSql('DROP TABLE room');
  38.     }
  39. }