Version20150806184533::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * This program is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU General Public License
12
 * as published by the Free Software Foundation; either version 2
13
 * of the License, or (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23
 */
24
25
namespace DoctrineMigrations;
26
27
use Doctrine\DBAL\Migrations\AbstractMigration;
28
use Doctrine\DBAL\Schema\Schema;
29
30
/**
31
 * Auto-generated Migration: Please modify to your needs!
32
 */
33
class Version20150806184533 extends AbstractMigration
34
{
35
    /**
36
     * @param Schema $schema
37
     */
38
    public function up(Schema $schema)
39
    {
40
41
        // this up() migration is auto-generated, please modify it to your needs
42
        $t = $schema->getTable('dtb_product_class');
43
        $c = $t->getColumn('stock_unlimited');
44
45
        if($c->getType()->getName() != 'smallint'){
0 ignored issues
show
Coding Style introduced by
Expected 1 space after IF keyword; 0 found
Loading history...
46
            $this->addSql('ALTER TABLE dtb_product_class ADD stock_unlimited_tmp int ;');
47
            $this->addSql('UPDATE dtb_product_class SET stock_unlimited_tmp = 1 where stock_unlimited =  true ');
48
            $this->addSql('UPDATE dtb_product_class SET stock_unlimited_tmp = 0 where stock_unlimited <> true ');
49
            $t->dropColumn('stock_unlimited');
50
        } 
0 ignored issues
show
introduced by
Please trim any trailing whitespace
Loading history...
51
    }
52
53
    /**
54
     * @param Schema $schema
55
     */
56
    public function down(Schema $schema)
57
    {
58
        // this down() migration is auto-generated, please modify it to your needs
59
    }
60
}
61