<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230106155948 extends AbstractMigration
{
public function getDescription(): string
{
return 'Create logging table';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE SEQUENCE logging_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE logging (id INT NOT NULL, object_id INT NOT NULL,
entity_name VARCHAR(255) DEFAULT NULL, user_id INT NOT NULL, action VARCHAR(255) DEFAULT NULL,
payload_before JSON DEFAULT NULL, payload_after JSON DEFAULT NULL, changeset JSON DEFAULT NULL,
date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
}
public function down(Schema $schema): void
{
$this->addSql('DROP SEQUENCE logging_id_seq CASCADE');
$this->addSql('DROP TABLE logging');
}
}