39 lines
1.2 KiB
PHP
39 lines
1.2 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 Version20241210103436 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 source_id_seq CASCADE');
|
|
$this->addSql('ALTER TABLE source ALTER id TYPE VARCHAR(255)');
|
|
$this->addSql('ALTER TABLE source 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 source_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
|
$this->addSql('ALTER TABLE source ALTER id TYPE INT');
|
|
$this->addSql('CREATE SEQUENCE source_id_seq');
|
|
$this->addSql('SELECT setval(\'source_id_seq\', (SELECT MAX(id) FROM source))');
|
|
$this->addSql('ALTER TABLE source ALTER id SET DEFAULT nextval(\'source_id_seq\')');
|
|
}
|
|
}
|