Code Duplication    Length = 65-65 lines in 2 locations

migrations/m180508_092223_create_pages_table.php 1 location

@@ 8-72 (lines=65) @@
5
/**
6
 * Handles the creation of table `pages`.
7
 */
8
class m180508_092223_create_pages_table extends MultilanguageMigration
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function safeUp()
14
    {
15
        $this->createMultiLanguageTable('pages',
16
            [
17
                'title' => $this->string(128)->notNull(),
18
                'description' => $this->text(),
19
                'content' => $this->text(),
20
                'metaKeys' => $this->string(128),
21
                'metaDescription' => $this->string(),
22
            ],
23
            [
24
                'parentId' => $this->integer(),
25
                'active' => $this->tinyInteger()->notNull()->defaultValue(0),
26
                'icon' => $this->string(128),
27
                'alias' => $this->string(128),
28
            ]
29
        );
30
31
        $this->createIndex(
32
            'idx-pages-parentId',
33
            'pages',
34
            'parentId'
35
        );
36
37
        $this->createIndex(
38
            'idx-pages-active',
39
            'pages',
40
            'active'
41
        );
42
43
        $this->createIndex(
44
            'idx-pages-alias',
45
            'pages',
46
            'alias'
47
        );
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function safeDown()
54
    {
55
        $this->dropIndex(
56
            'idx-pages-parentId',
57
            'pages'
58
        );
59
60
        $this->dropIndex(
61
            'idx-pages-active',
62
            'pages'
63
        );
64
65
        $this->dropIndex(
66
            'idx-pages-alias',
67
            'pages'
68
        );
69
70
        $this->dropMultiLanguageTable('pages');
71
    }
72
}
73

migrations/m180522_101830_create_categories_table.php 1 location

@@ 8-72 (lines=65) @@
5
/**
6
 * Handles the creation of table `categories`.
7
 */
8
class m180522_101830_create_categories_table extends MultilanguageMigration
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function safeUp()
14
    {
15
        $this->createMultiLanguageTable('categories',
16
            [
17
                'title' => $this->string(128)->notNull(),
18
                'description' => $this->text(),
19
                'content' => $this->text(),
20
                'metaKeys' => $this->string(128),
21
                'metaDescription' => $this->string(),
22
            ],
23
            [
24
                'parentId' => $this->integer(),
25
                'active' => $this->tinyInteger()->notNull()->defaultValue(0),
26
                'icon' => $this->string(128),
27
                'alias' => $this->string(128),
28
            ]
29
        );
30
31
        $this->createIndex(
32
            'idx-categories-parentId',
33
            'categories',
34
            'parentId'
35
        );
36
37
        $this->createIndex(
38
            'idx-categories-active',
39
            'categories',
40
            'active'
41
        );
42
43
        $this->createIndex(
44
            'idx-categories-alias',
45
            'categories',
46
            'alias'
47
        );
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function safeDown()
54
    {
55
        $this->dropIndex(
56
            'idx-categories-parentId',
57
            'categories'
58
        );
59
60
        $this->dropIndex(
61
            'idx-categories-active',
62
            'categories'
63
        );
64
65
        $this->dropIndex(
66
            'idx-categories-alias',
67
            'categories'
68
        );
69
70
        $this->dropMultiLanguageTable('categories');
71
    }
72
}
73