<?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 Version20221028093743 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 abstract_collaborator ADD last_connection TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
$this->addSql('ALTER TABLE property ALTER created_at SET DEFAULT NULL');
$this->addSql('ALTER TABLE property ALTER updated_at SET DEFAULT NULL');
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SEQUENCE cgu_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE cgu (id INT NOT NULL, collaborator_id INT NOT NULL, ip_address VARCHAR(100) NOT NULL, browser VARCHAR(100) DEFAULT NULL, is_accepted BOOLEAN NOT NULL, accepted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, refused_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_BF03D4B830098C8C ON cgu (collaborator_id)');
$this->addSql('ALTER TABLE cgu ADD CONSTRAINT FK_BF03D4B830098C8C FOREIGN KEY (collaborator_id) REFERENCES abstract_collaborator (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE cgu DROP refused_at');
}
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 abstract_collaborator DROP last_connection');
$this->addSql('ALTER TABLE property ALTER created_at DROP NOT NULL');
$this->addSql('ALTER TABLE property ALTER updated_at DROP NOT NULL');
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE cgu_id_seq CASCADE');
$this->addSql('DROP TABLE cgu');
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE cgu ADD refused_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
}
}