migrations/Version20221028093743.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20221028093743 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('ALTER TABLE abstract_collaborator ADD last_connection TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
  19.         $this->addSql('ALTER TABLE property ALTER created_at SET DEFAULT NULL');
  20.         $this->addSql('ALTER TABLE property ALTER updated_at SET DEFAULT NULL');
  21.         // this up() migration is auto-generated, please modify it to your needs
  22.         $this->addSql('CREATE SEQUENCE cgu_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  23.         $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))');
  24.         $this->addSql('CREATE UNIQUE INDEX UNIQ_BF03D4B830098C8C ON cgu (collaborator_id)');
  25.         $this->addSql('ALTER TABLE cgu ADD CONSTRAINT FK_BF03D4B830098C8C FOREIGN KEY (collaborator_id) REFERENCES abstract_collaborator (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  26.         // this up() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('ALTER TABLE cgu DROP refused_at');
  28.     }
  29.     public function down(Schema $schema): void
  30.     {
  31.         // this down() migration is auto-generated, please modify it to your needs
  32.         $this->addSql('CREATE SCHEMA public');
  33.         $this->addSql('ALTER TABLE abstract_collaborator DROP last_connection');
  34.         $this->addSql('ALTER TABLE property ALTER created_at DROP NOT NULL');
  35.         $this->addSql('ALTER TABLE property ALTER updated_at DROP NOT NULL');
  36.         // this down() migration is auto-generated, please modify it to your needs
  37.         $this->addSql('CREATE SCHEMA public');
  38.         $this->addSql('DROP SEQUENCE cgu_id_seq CASCADE');
  39.         $this->addSql('DROP TABLE cgu');
  40.         // this down() migration is auto-generated, please modify it to your needs
  41.         $this->addSql('CREATE SCHEMA public');
  42.         $this->addSql('ALTER TABLE cgu ADD refused_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
  43.     }
  44. }