Files
pf2e-builder/migrations/Version20241209201442.php
2024-12-10 00:27:24 +04:00

43 lines
1.9 KiB
PHP

<?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 Version20241209201442 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 item_localization (id SERIAL NOT NULL, item_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, markdown TEXT NOT NULL, url VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_57866286126F525E ON item_localization (item_id)');
$this->addSql('CREATE TABLE tpait (id SERIAL NOT NULL, item_id INT NOT NULL, rarity INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_B0DD552126F525E ON tpait (item_id)');
$this->addSql('ALTER TABLE item_localization ADD CONSTRAINT FK_57866286126F525E FOREIGN KEY (item_id) REFERENCES item (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE tpait ADD CONSTRAINT FK_B0DD552126F525E FOREIGN KEY (item_id) REFERENCES item (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE item ADD type VARCHAR(255) 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 item_localization DROP CONSTRAINT FK_57866286126F525E');
$this->addSql('ALTER TABLE tpait DROP CONSTRAINT FK_B0DD552126F525E');
$this->addSql('DROP TABLE item_localization');
$this->addSql('DROP TABLE tpait');
$this->addSql('ALTER TABLE item DROP type');
}
}