Completed
Push — master ( 8475b9...c814f9 )
by Pierre
02:26
created

SampleData   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 39
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B up() 0 30 1
A down() 0 5 1
1
<?php
2
3
use Phinx\Migration\AbstractMigration;
4
5
class SampleData extends AbstractMigration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
6
{
7
    public function up()
8
    {
9
        $cards = [
10
            ['name' => 'First Card']
11
        ];
12
13
        $tasks = [
14
            [
15
                'name' => 'add a new card',
16
                'isDone' => false,
17
                'priority' => 900,
18
                'cardId' => 1,
19
            ],
20
            [
21
                'name' => 'add some tasks to the new card',
22
                'isDone' => false,
23
                'priority' => 500,
24
                'cardId' => 1,
25
            ],
26
            [
27
                'name' => 'comple all tasks of the new card',
28
                'isDone' => false,
29
                'priority' => 100,
30
                'cardId' => 1,
31
            ]
32
        ];
33
34
        $this->table('cards')->insert($cards)->save();
35
        $this->table('tasks')->insert($tasks)->save();
36
    }
37
38
    public function down()
39
    {
40
        $this->execute('DELETE FROM tasks');
41
        $this->execute('DELETE FROM cards');
42
    }
43
}
44