39 lines
1.6 KiB
PHP
39 lines
1.6 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 Version20260122092618 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 devis_options (id SERIAL NOT NULL, devis_id INT DEFAULT NULL, option_id INT DEFAULT NULL, price_ht DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))');
|
||
|
|
$this->addSql('CREATE INDEX IDX_42DB61DB41DEFADA ON devis_options (devis_id)');
|
||
|
|
$this->addSql('CREATE INDEX IDX_42DB61DBA7C41D6F ON devis_options (option_id)');
|
||
|
|
$this->addSql('ALTER TABLE devis_options ADD CONSTRAINT FK_42DB61DB41DEFADA FOREIGN KEY (devis_id) REFERENCES devis (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||
|
|
$this->addSql('ALTER TABLE devis_options ADD CONSTRAINT FK_42DB61DBA7C41D6F FOREIGN KEY (option_id) REFERENCES options (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||
|
|
}
|
||
|
|
|
||
|
|
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 devis_options DROP CONSTRAINT FK_42DB61DB41DEFADA');
|
||
|
|
$this->addSql('ALTER TABLE devis_options DROP CONSTRAINT FK_42DB61DBA7C41D6F');
|
||
|
|
$this->addSql('DROP TABLE devis_options');
|
||
|
|
}
|
||
|
|
}
|