38 lines
1.5 KiB
PHP
38 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 Version20260404193605 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 website_configuration (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, type VARCHAR(25) NOT NULL, value TEXT NOT NULL, website_id INT NOT NULL, PRIMARY KEY (id))');
|
||
|
|
$this->addSql('CREATE INDEX IDX_8BC287E818F45C82 ON website_configuration (website_id)');
|
||
|
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_8BC287E818F45C828CDE5729 ON website_configuration (website_id, type)');
|
||
|
|
$this->addSql('ALTER TABLE website_configuration ADD CONSTRAINT FK_8BC287E818F45C82 FOREIGN KEY (website_id) REFERENCES website (id) ON DELETE CASCADE NOT DEFERRABLE');
|
||
|
|
$this->addSql('ALTER TABLE website ADD revendeur_code VARCHAR(10) DEFAULT NULL');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function down(Schema $schema): void
|
||
|
|
{
|
||
|
|
// this down() migration is auto-generated, please modify it to your needs
|
||
|
|
$this->addSql('ALTER TABLE website_configuration DROP CONSTRAINT FK_8BC287E818F45C82');
|
||
|
|
$this->addSql('DROP TABLE website_configuration');
|
||
|
|
$this->addSql('ALTER TABLE website DROP revendeur_code');
|
||
|
|
}
|
||
|
|
}
|