collection-crud/src/Migrations/Version20240320173628.php

51 lines
4.3 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240320173628 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 collection.previously_owned_gpu (id SERIAL NOT NULL, gpu_brand_id INT NOT NULL, gpu_core_id INT DEFAULT NULL, board_brand_id INT DEFAULT NULL, reference_model_name VARCHAR(255) NOT NULL, alternate_model_name VARCHAR(255) DEFAULT NULL, card_key VARCHAR(255) DEFAULT \'PCIe x16\' NOT NULL, bus_interface VARCHAR(255) DEFAULT NULL, slot_span INT DEFAULT 1 NOT NULL, molex_power INT DEFAULT 0 NOT NULL, pcie_6_pin INT DEFAULT 0 NOT NULL, pcie_8_pin INT DEFAULT 0 NOT NULL, tdp INT DEFAULT NULL, base_clock INT DEFAULT NULL, boost_clock INT DEFAULT NULL, memory_clock INT DEFAULT NULL, memory_size INT DEFAULT NULL, memory_bus INT DEFAULT NULL, memory_type VARCHAR(255) DEFAULT NULL, shading_units INT DEFAULT NULL, tmus INT DEFAULT NULL, rops INT DEFAULT NULL, compute_units INT DEFAULT NULL, l1_cache VARCHAR(255) DEFAULT NULL, l2_cache VARCHAR(255) DEFAULT NULL, direct_x_support VARCHAR(255) DEFAULT NULL, opengl_support VARCHAR(255) DEFAULT NULL, opencl_support VARCHAR(255) DEFAULT NULL, vulkan_support VARCHAR(255) DEFAULT NULL, shader_model VARCHAR(255) DEFAULT NULL, link VARCHAR(255) DEFAULT NULL, count INT DEFAULT 1 NOT NULL, acquired BOOLEAN DEFAULT true NOT NULL, notes TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_5B0869044561DE01 ON collection.previously_owned_gpu (gpu_brand_id)');
$this->addSql('CREATE INDEX IDX_5B08690487059374 ON collection.previously_owned_gpu (gpu_core_id)');
$this->addSql('CREATE INDEX IDX_5B086904D402D3B1 ON collection.previously_owned_gpu (board_brand_id)');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_gpu.card_key IS \'The shape of the card connector\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_gpu.bus_interface IS \'The type of electrical bus this card uses\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_gpu.slot_span IS \'How many expansion slots the card occupies\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_gpu.tdp IS \'Thermal Design Power (in Watts)\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_gpu.base_clock IS \'Base speed of the gpu core, in MHz\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_gpu.boost_clock IS \'GPU core boost clock, in MHz\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_gpu.memory_clock IS \'Clock speed of the VRAM, in MHz\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_gpu.memory_size IS \'VRAM size, in MiB\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_gpu.memory_bus IS \'The width of the memory bus in bits\'');
$this->addSql('ALTER TABLE collection.previously_owned_gpu ADD CONSTRAINT FK_5B0869044561DE01 FOREIGN KEY (gpu_brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.previously_owned_gpu ADD CONSTRAINT FK_5B08690487059374 FOREIGN KEY (gpu_core_id) REFERENCES collection.gpu_core (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.previously_owned_gpu ADD CONSTRAINT FK_5B086904D402D3B1 FOREIGN KEY (board_brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE collection.previously_owned_gpu DROP CONSTRAINT FK_5B0869044561DE01');
$this->addSql('ALTER TABLE collection.previously_owned_gpu DROP CONSTRAINT FK_5B08690487059374');
$this->addSql('ALTER TABLE collection.previously_owned_gpu DROP CONSTRAINT FK_5B086904D402D3B1');
$this->addSql('DROP TABLE collection.previously_owned_gpu');
}
}