Replace isScanned with state (valid/invalid/expired) and firstScannedAt on BilletOrder

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-21 14:15:32 +01:00
parent 2b48d2081f
commit 2efb5f176a
4 changed files with 75 additions and 21 deletions

View File

@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260321200000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Replace isScanned with state and firstScannedAt on billet_order';
}
public function up(Schema $schema): void
{
$this->addSql("ALTER TABLE billet_order ADD COLUMN IF NOT EXISTS state VARCHAR(20) DEFAULT 'valid' NOT NULL");
$this->addSql('ALTER TABLE billet_order ADD COLUMN IF NOT EXISTS first_scanned_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
$this->addSql('ALTER TABLE billet_order DROP COLUMN IF EXISTS is_scanned');
$this->addSql('ALTER TABLE billet_order DROP COLUMN IF EXISTS scanned_at');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE billet_order ADD COLUMN IF NOT EXISTS is_scanned BOOLEAN DEFAULT false NOT NULL');
$this->addSql('ALTER TABLE billet_order ADD COLUMN IF NOT EXISTS scanned_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
$this->addSql('ALTER TABLE billet_order DROP COLUMN IF EXISTS state');
$this->addSql('ALTER TABLE billet_order DROP COLUMN IF EXISTS first_scanned_at');
}
}