40 lines
1.6 KiB
PHP
40 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 Version20260121141506 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 contrats_payments (id SERIAL NOT NULL, contrat_id INT DEFAULT NULL, type VARCHAR(255) NOT NULL, payment_id VARCHAR(255) NOT NULL, state VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||
|
|
$this->addSql('CREATE INDEX IDX_95744AFC1823061F ON contrats_payments (contrat_id)');
|
||
|
|
$this->addSql('ALTER TABLE contrats_payments ADD CONSTRAINT FK_95744AFC1823061F FOREIGN KEY (contrat_id) REFERENCES contrats (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||
|
|
$this->addSql('ALTER TABLE contrats ADD is_signed BOOLEAN NOT NULL');
|
||
|
|
$this->addSql('ALTER TABLE contrats ADD sign_id VARCHAR(255) DEFAULT NULL');
|
||
|
|
}
|
||
|
|
|
||
|
|
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 contrats_payments DROP CONSTRAINT FK_95744AFC1823061F');
|
||
|
|
$this->addSql('DROP TABLE contrats_payments');
|
||
|
|
$this->addSql('ALTER TABLE contrats DROP is_signed');
|
||
|
|
$this->addSql('ALTER TABLE contrats DROP sign_id');
|
||
|
|
}
|
||
|
|
}
|