LSBC/migrations/Version20230508171219.php

37 lines
1.1 KiB
PHP
Raw Normal View History

2023-05-11 17:03:52 +02:00
<?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 Version20230508171219 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('ALTER TABLE podcast ADD slug VARCHAR(255)');
$this->addSql('UPDATE podcast SET slug = LOWER(CAST(id AS VARCHAR))');
$this->addSql('ALTER TABLE podcast ALTER COLUMN slug SET NOT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_D7E805BD989D9B62 ON podcast (slug)');
}
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('DROP INDEX UNIQ_D7E805BD989D9B62');
$this->addSql('ALTER TABLE podcast DROP slug');
}
}