43 lines
1.5 KiB
PHP
43 lines
1.5 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 Version20241210083555 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('DROP SEQUENCE tpait_id_seq CASCADE');
|
|
$this->addSql('ALTER TABLE item ADD aonprd_id VARCHAR(255) NOT NULL');
|
|
$this->addSql('ALTER TABLE item_localization ADD locale VARCHAR(10) NOT NULL');
|
|
$this->addSql('ALTER TABLE tpait ALTER id TYPE VARCHAR(255)');
|
|
$this->addSql('ALTER TABLE tpait ALTER id DROP DEFAULT');
|
|
}
|
|
|
|
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('CREATE SEQUENCE tpait_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
|
$this->addSql('ALTER TABLE item_localization DROP locale');
|
|
$this->addSql('ALTER TABLE item DROP aonprd_id');
|
|
$this->addSql('ALTER TABLE tpait ALTER id TYPE INT');
|
|
$this->addSql('CREATE SEQUENCE tpait_id_seq');
|
|
$this->addSql('SELECT setval(\'tpait_id_seq\', (SELECT MAX(id) FROM tpait))');
|
|
$this->addSql('ALTER TABLE tpait ALTER id SET DEFAULT nextval(\'tpait_id_seq\')');
|
|
}
|
|
}
|