Completed
Push — master ( 824ab5...b7a7bb )
by Arman
16s queued 13s
created

MigrationTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 27
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 3 1
A up() 0 6 1
1
<?php
2
3
/**
4
 * Quantum PHP Framework
5
 *
6
 * An open source software development framework for PHP
7
 *
8
 * @package Quantum
9
 * @author Arman Ag. <[email protected]>
10
 * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
11
 * @link http://quantum.softberg.org/
12
 * @since 2.7.0
13
 */
14
15
namespace Quantum\Migration;
16
17
use Quantum\Libraries\Database\Schema\Type;
18
use Quantum\Factory\TableFactory;
19
20
/**
21
 * Class MigrationTable
22
 * @package Quantum\Migration
23
 */
24
class MigrationTable extends QtMigration
25
{
26
27
    /**
28
     * Migrations table name
29
     */
30
    const TABLE = 'migrations';
31
32
    /**
33
     * Creates the migrations table
34
     * @param TableFactory|null $tableFactory
35
     */
36
    public function up(?TableFactory $tableFactory)
37
    {
38
        $table = $tableFactory->create(self::TABLE);
0 ignored issues
show
Bug introduced by
The method create() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
        /** @scrutinizer ignore-call */ 
39
        $table = $tableFactory->create(self::TABLE);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
39
        $table->addColumn('id', Type::INT, 11)->autoIncrement();
40
        $table->addColumn('migration', Type::VARCHAR, 255);
41
        $table->addColumn('applied_at', Type::TIMESTAMP)->default('CURRENT_TIMESTAMP', false);
42
    }
43
44
    /**
45
     * Drops the migrations table
46
     * @param TableFactory|null $tableFactory
47
     */
48
    public function down(?TableFactory $tableFactory)
49
    {
50
        $tableFactory->drop(self::TABLE);
51
    }
52
53
}
54