migrations/Version20230116094711.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. final class Version20230116094711 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'table to store connexions log';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql('CREATE SEQUENCE connexion_log_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  15.         $this->addSql('CREATE TABLE connexion_log (id INT NOT NULL, ip VARCHAR(255) DEFAULT NULL, 
  16.         browser VARCHAR(255) DEFAULT NULL, date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, 
  17.         user_id INT NOT NULL, PRIMARY KEY(id))');
  18.     }
  19.     public function down(Schema $schema): void
  20.     {
  21.         $this->addSql('DROP SEQUENCE connexion_log_id_seq CASCADE');
  22.         $this->addSql('DROP TABLE connexion_log');
  23.     }
  24. }