neofapometer/migrations/Version20251028060845.php

31 lines
984 B
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20251028060845 extends AbstractMigration
{
public function getDescription(): string
{
return 'Create minimal Entry Entity';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE entry (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER NOT NULL, date_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
, created_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
, updated_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
, CONSTRAINT FK_2B219D70A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_2B219D70A76ED395 ON entry (user_id)');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE entry');
}
}