collection-crud/src/Migrations/Version20240327190849.php

75 lines
7.0 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 Version20240327190849 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.expansion_slot (id SERIAL NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_892885ED5E237E06 ON collection.expansion_slot (name)');
$this->addSql('CREATE TABLE collection.previously_owned_cpu (id SERIAL NOT NULL, brand_id INT NOT NULL, architecture VARCHAR(255) NOT NULL, product_line VARCHAR(255) NOT NULL, model VARCHAR(255) NOT NULL, part_number VARCHAR(255) NOT NULL, lot_number VARCHAR(255) DEFAULT NULL, micro_architecture VARCHAR(255) DEFAULT NULL, codename VARCHAR(255) DEFAULT NULL, base_speed INT NOT NULL, boost_speed INT DEFAULT NULL, cores INT NOT NULL, threads INT NOT NULL, igp VARCHAR(255) DEFAULT NULL, voltage DOUBLE PRECISION DEFAULT NULL, tdp INT DEFAULT NULL, process_node INT DEFAULT NULL, l1_data_count INT DEFAULT NULL, l1_data_size INT DEFAULT NULL, l1_data_way INT DEFAULT NULL, l1_code_count INT DEFAULT NULL, l1_code_size INT DEFAULT NULL, l1_code_way INT DEFAULT NULL, l1_unified_count INT DEFAULT NULL, l1_unified_size INT DEFAULT NULL, l1_unified_way INT DEFAULT NULL, l2_count INT NOT NULL, l2_size INT DEFAULT NULL, l2_way INT DEFAULT NULL, l3_count INT NOT NULL, l3_size INT DEFAULT NULL, l3_way INT DEFAULT NULL, count INT NOT NULL, usable BOOLEAN NOT NULL, received BOOLEAN NOT NULL, link VARCHAR(255) NOT NULL, notes TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_5C01C1D844F5D008 ON collection.previously_owned_cpu (brand_id)');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.lot_number IS \'The CPU lot number, such as s-spec for Intel CPUs\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.base_speed IS \'The stock speed of the cpu in MHz\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.boost_speed IS \'The max boost speed of the cpu in MHz, if applicable\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.igp IS \'The name of the integrated graphics processor\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l1_data_count IS \'The number of L1 data caches on the package, usually the same as the number of cores\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l1_data_size IS \'The size of each Level 1 data cache in KB\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l1_code_count IS \'The number of L1 instruction caches on the package, usually the same as the number of cores\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l1_code_size IS \'The size of each Level 1 instruction cache in KB\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l1_unified_count IS \'The number of L1 caches on the package, usually the same as the number of cores\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l1_unified_size IS \'The size of each Level 1 unified cache in KB\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l2_count IS \'The number of L2 caches on the package, usually the same as the number of cores\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l2_size IS \'The size of each Level 2 cache in KB\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l3_count IS \'The number of L3 caches on the package\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l3_size IS \'The size of each Level 3 cache in KB\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.usable IS \'Whether the chip is working, and can be used with other hardware I have\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.received IS \'Whether I have the chip in my possession (instead of in shipping)\'');
$this->addSql('CREATE TABLE collection.previously_owned_cpu_socket_link (cpu_id INT NOT NULL, socket_id INT NOT NULL, PRIMARY KEY(cpu_id, socket_id))');
$this->addSql('CREATE INDEX IDX_3FDC320D3917014 ON collection.previously_owned_cpu_socket_link (cpu_id)');
$this->addSql('CREATE INDEX IDX_3FDC320DD20E239C ON collection.previously_owned_cpu_socket_link (socket_id)');
$this->addSql('ALTER TABLE collection.previously_owned_cpu ADD CONSTRAINT FK_5C01C1D844F5D008 FOREIGN KEY (brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.previously_owned_cpu_socket_link ADD CONSTRAINT FK_3FDC320D3917014 FOREIGN KEY (cpu_id) REFERENCES collection.previously_owned_cpu (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.previously_owned_cpu_socket_link ADD CONSTRAINT FK_3FDC320DD20E239C FOREIGN KEY (socket_id) REFERENCES collection.socket (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.motherboard ADD revision VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE collection.motherboard ADD ram_slot_count INT NOT NULL');
$this->addSql('ALTER TABLE collection.motherboard ADD max_ram VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE collection.motherboard ADD max_ram_speed VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE collection.motherboard ADD count INT DEFAULT 1 NOT NULL');
$this->addSql('ALTER TABLE collection.motherboard ADD acquired BOOLEAN DEFAULT true NOT NULL');
}
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_cpu DROP CONSTRAINT FK_5C01C1D844F5D008');
$this->addSql('ALTER TABLE collection.previously_owned_cpu_socket_link DROP CONSTRAINT FK_3FDC320D3917014');
$this->addSql('ALTER TABLE collection.previously_owned_cpu_socket_link DROP CONSTRAINT FK_3FDC320DD20E239C');
$this->addSql('DROP TABLE collection.expansion_slot');
$this->addSql('DROP TABLE collection.previously_owned_cpu');
$this->addSql('DROP TABLE collection.previously_owned_cpu_socket_link');
$this->addSql('ALTER TABLE collection.motherboard DROP revision');
$this->addSql('ALTER TABLE collection.motherboard DROP ram_slot_count');
$this->addSql('ALTER TABLE collection.motherboard DROP max_ram');
$this->addSql('ALTER TABLE collection.motherboard DROP max_ram_speed');
$this->addSql('ALTER TABLE collection.motherboard DROP count');
$this->addSql('ALTER TABLE collection.motherboard DROP acquired');
}
}