Jacek Kowalski
4 hours ago 6b9278a5d57091fce636dbb640b380cfb990db6c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
 
declare(strict_types=1);
 
namespace DoctrineMigrations;
 
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
 
final class Version20261113120000 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Add the date a book was last seen during an inventory';
    }
 
    public function up(Schema $schema): void
    {
        foreach (['book', 'ousted_book'] as $table) {
            $schema->getTable($table)->addColumn('last_seen', Types::DATETIME_IMMUTABLE, ['notnull' => false]);
        }
    }
 
    public function down(Schema $schema): void
    {
        foreach (['book', 'ousted_book'] as $table) {
            $schema->getTable($table)->dropColumn('last_seen');
        }
    }
}