aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/DoctrineMigrations/Version20190117131816.php
blob: 6548b9fa3560bfb8954aeb868bc3f2aa5a4317e7 (plain) (blame)
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
32
<?php

namespace Application\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;

/**
 * Add updated_at fields to site_credential table.
 */
final class Version20190117131816 extends WallabagMigration
{
    public function up(Schema $schema): void
    {
        $siteCredentialTable = $schema->getTable($this->getTable('site_credential'));

        $this->skipIf($siteCredentialTable->hasColumn('updated_at'), 'It seems that you already played this migration.');

        $siteCredentialTable->addColumn('updated_at', 'datetime', [
            'notnull' => false,
        ]);
    }

    public function down(Schema $schema): void
    {
        $siteCredentialTable = $schema->getTable($this->getTable('site_credential'));

        $this->skipIf(!$siteCredentialTable->hasColumn('updated_at'), 'It seems that you already played this migration.');

        $siteCredentialTable->dropColumn('updated_at');
    }
}