migrations/Version20230106155948.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 Version20230106155948 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Create logging table';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql('CREATE SEQUENCE logging_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  15.         $this->addSql('CREATE TABLE logging (id INT NOT NULL, object_id INT NOT NULL, 
  16.                     entity_name VARCHAR(255) DEFAULT NULL, user_id INT NOT NULL, action VARCHAR(255) DEFAULT NULL, 
  17.                     payload_before JSON DEFAULT NULL, payload_after JSON DEFAULT NULL, changeset JSON DEFAULT NULL, 
  18.                     date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
  19.     }
  20.     public function down(Schema $schema): void
  21.     {
  22.         $this->addSql('DROP SEQUENCE logging_id_seq CASCADE');
  23.         $this->addSql('DROP TABLE logging');
  24.     }
  25. }