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

SampleData::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
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