m200909_030624_create_recurrence_table   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 16
c 1
b 0
f 1
dl 0
loc 31
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 18 1
A safeDown() 0 3 1
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Handles the creation of table `{{%recurrence}}`.
7
 */
8
class m200909_030624_create_recurrence_table extends Migration
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function safeUp()
14
    {
15
        $this->createTable('{{%recurrence}}', [
16
            'id' => $this->primaryKey(),
17
            'user_id' => $this->integer()->notNull(),
18
            'name' => $this->string()->notNull(),
19
            'frequency' => $this->tinyInteger()->notNull(),
20
            'interval' => $this->tinyInteger()->defaultValue(1),
21
            'schedule' => $this->string(),
22
            'transaction_id' => $this->integer()->notNull(),
23
            'started_at' => $this->timestamp()->defaultValue(null),
24
            'execution_date' => $this->timestamp()->defaultValue(null),
25
            'status' => $this->tinyInteger()->defaultValue(1),
26
            'created_at' => $this->timestamp()->defaultValue(null),
27
            'updated_at' => $this->timestamp()->defaultValue(null),
28
        ]);
29
30
        $this->createIndex('record_user_id_transaction_id', '{{%recurrence}}', ['user_id', 'transaction_id']);
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function safeDown()
37
    {
38
        $this->dropTable('{{%recurrence}}');
39
    }
40
}
41