migrations/Version20260609120000.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 Version20260609120000 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Add sessions table for the DB-backed PdoSessionHandler (shared sessions across Fargate tasks).';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         // Symfony PdoSessionHandler default schema (MySQL). utf8mb4_bin so session ids are matched
  15.         // byte-exactly; BLOB for binary-serialised session payloads.
  16.         $this->addSql('CREATE TABLE sessions (
  17.             sess_id VARBINARY(128) NOT NULL PRIMARY KEY,
  18.             sess_data BLOB NOT NULL,
  19.             sess_lifetime INT UNSIGNED NOT NULL,
  20.             sess_time INT UNSIGNED NOT NULL,
  21.             INDEX sessions_sess_lifetime_idx (sess_lifetime)
  22.         ) COLLATE utf8mb4_bin, ENGINE = InnoDB');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         $this->addSql('DROP TABLE sessions');
  27.     }
  28. }