Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 114
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
style_update_p2
0.00% covered (danger)
0.00%
0 / 114
0.00% covered (danger)
0.00%
0 / 4
20
0.00% covered (danger)
0.00%
0 / 1
 effectively_installed
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 depends_on
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 update_schema
0.00% covered (danger)
0.00%
0 / 23
0.00% covered (danger)
0.00%
0 / 1
2
 revert_schema
0.00% covered (danger)
0.00%
0 / 89
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14namespace phpbb\db\migration\data\v310;
15
16class style_update_p2 extends \phpbb\db\migration\migration
17{
18    public function effectively_installed()
19    {
20        return !$this->db_tools->sql_table_exists($this->table_prefix . 'styles_imageset');
21    }
22
23    public static function depends_on()
24    {
25        return array('\phpbb\db\migration\data\v310\style_update_p1');
26    }
27
28    public function update_schema()
29    {
30        return array(
31            'drop_keys'    => array(
32                $this->table_prefix . 'styles'        => array(
33                    'imageset_id',
34                    'template_id',
35                    'theme_id',
36                ),
37            ),
38
39            'drop_columns'    => array(
40                $this->table_prefix . 'styles'        => array(
41                    'imageset_id',
42                    'template_id',
43                    'theme_id',
44                ),
45            ),
46
47            'drop_tables'    => array(
48                $this->table_prefix . 'styles_imageset',
49                $this->table_prefix . 'styles_imageset_data',
50                $this->table_prefix . 'styles_template',
51                $this->table_prefix . 'styles_template_data',
52                $this->table_prefix . 'styles_theme',
53            ),
54        );
55    }
56
57    public function revert_schema()
58    {
59        return array(
60            'add_columns'    => array(
61                $this->table_prefix . 'styles'        => array(
62                    'imageset_id'    => array('UINT', 0),
63                    'template_id'    => array('UINT', 0),
64                    'theme_id'        => array('UINT', 0),
65                ),
66            ),
67
68            'add_index'        => array(
69                $this->table_prefix . 'styles'            => array(
70                    'imageset_id'        => array('imageset_id'),
71                    'template_id'        => array('template_id'),
72                    'theme_id'            => array('theme_id'),
73                ),
74            ),
75
76            'add_tables'    => array(
77                $this->table_prefix . 'styles_imageset'        => array(
78                    'COLUMNS'        => array(
79                        'imageset_id'                => array('UINT', null, 'auto_increment'),
80                        'imageset_name'                => array('VCHAR_UNI:255', ''),
81                        'imageset_copyright'        => array('VCHAR_UNI', ''),
82                        'imageset_path'                => array('VCHAR:100', ''),
83                    ),
84                    'PRIMARY_KEY'        => 'imageset_id',
85                    'KEYS'                => array(
86                        'imgset_nm'            => array('UNIQUE', 'imageset_name'),
87                    ),
88                ),
89                $this->table_prefix . 'styles_imageset_data'    => array(
90                    'COLUMNS'        => array(
91                        'image_id'                => array('UINT', null, 'auto_increment'),
92                        'image_name'            => array('VCHAR:200', ''),
93                        'image_filename'        => array('VCHAR:200', ''),
94                        'image_lang'            => array('VCHAR:30', ''),
95                        'image_height'            => array('USINT', 0),
96                        'image_width'            => array('USINT', 0),
97                        'imageset_id'            => array('UINT', 0),
98                    ),
99                    'PRIMARY_KEY'        => 'image_id',
100                    'KEYS'                => array(
101                        'i_d'            => array('INDEX', 'imageset_id'),
102                    ),
103                ),
104                $this->table_prefix . 'styles_template'        => array(
105                    'COLUMNS'        => array(
106                        'template_id'            => array('UINT', null, 'auto_increment'),
107                        'template_name'            => array('VCHAR_UNI:255', ''),
108                        'template_copyright'    => array('VCHAR_UNI', ''),
109                        'template_path'            => array('VCHAR:100', ''),
110                        'bbcode_bitfield'        => array('VCHAR:255', 'kNg='),
111                        'template_storedb'        => array('BOOL', 0),
112                        'template_inherits_id'        => array('UINT:4', 0),
113                        'template_inherit_path'        => array('VCHAR', ''),
114                    ),
115                    'PRIMARY_KEY'    => 'template_id',
116                    'KEYS'            => array(
117                        'tmplte_nm'                => array('UNIQUE', 'template_name'),
118                    ),
119                ),
120                $this->table_prefix . 'styles_template_data'    => array(
121                    'COLUMNS'        => array(
122                        'template_id'            => array('UINT', 0),
123                        'template_filename'        => array('VCHAR:100', ''),
124                        'template_included'        => array('TEXT', ''),
125                        'template_mtime'        => array('TIMESTAMP', 0),
126                        'template_data'            => array('MTEXT_UNI', ''),
127                    ),
128                    'KEYS'            => array(
129                        'tid'                    => array('INDEX', 'template_id'),
130                        'tfn'                    => array('INDEX', 'template_filename'),
131                    ),
132                ),
133                $this->table_prefix . 'styles_theme'            => array(
134                    'COLUMNS'        => array(
135                        'theme_id'                => array('UINT', null, 'auto_increment'),
136                        'theme_name'            => array('VCHAR_UNI:255', ''),
137                        'theme_copyright'        => array('VCHAR_UNI', ''),
138                        'theme_path'            => array('VCHAR:100', ''),
139                        'theme_storedb'            => array('BOOL', 0),
140                        'theme_mtime'            => array('TIMESTAMP', 0),
141                        'theme_data'            => array('MTEXT_UNI', ''),
142                    ),
143                    'PRIMARY_KEY'    => 'theme_id',
144                    'KEYS'            => array(
145                        'theme_name'        => array('UNIQUE', 'theme_name'),
146                    ),
147                ),
148            ),
149        );
150    }
151}