Completed
Push — staging ( ea50c8...34bcbe )
by Woeler
71:27 queued 58:41
created

Version20190715065013::preUp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 6
rs 10
c 1
b 0
f 0
1
<?php
2
3
/*
4
 * @package     Mautic
5
 * @copyright   2019 Mautic Contributors. All rights reserved.
6
 * @author      Mautic
7
 * @link        http://mautic.org
8
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
9
 */
10
11
namespace Mautic\Migrations;
12
13
use Doctrine\DBAL\Migrations\SkipMigrationException;
14
use Doctrine\DBAL\Schema\Schema;
15
use Mautic\CoreBundle\Doctrine\AbstractMauticMigration;
16
17
/**
18
 * Auto-generated Migration: Please modify to your needs!
19
 */
20
class Version20190715065013 extends AbstractMauticMigration
21
{
22
    /**
23
     * @param Schema $schema
24
     *
25
     * @throws SkipMigrationException
26
     * @throws \Doctrine\DBAL\Schema\SchemaException
27
     */
28
    public function preUp(Schema $schema)
29
    {
30
        $table = $schema->getTable($this->prefix.'forms');
31
32
        if ($table->hasColumn('form_attr')) {
33
            throw new SkipMigrationException('Schema includes this migration');
34
        }
35
    }
36
37
    /**
38
     * @param Schema $schema
39
     */
40
    public function up(Schema $schema)
41
    {
42
        $this->addSql('ALTER TABLE '.$this->prefix.'forms ADD form_attr VARCHAR(255) DEFAULT NULL');
43
    }
44
}
45