Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 45
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
softdelete_p2
0.00% covered (danger)
0.00%
0 / 45
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 / 4
0.00% covered (danger)
0.00%
0 / 1
2
 update_schema
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
2
 revert_schema
0.00% covered (danger)
0.00%
0 / 26
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 softdelete_p2 extends \phpbb\db\migration\migration
17{
18    public function effectively_installed()
19    {
20        return !$this->db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_approved');
21    }
22
23    public static function depends_on()
24    {
25        return array(
26            '\phpbb\db\migration\data\v310\dev',
27            '\phpbb\db\migration\data\v310\softdelete_p1',
28        );
29    }
30
31    public function update_schema()
32    {
33        return array(
34            'drop_columns'        => array(
35                $this->table_prefix . 'forums'            => array('forum_posts', 'forum_topics', 'forum_topics_real'),
36                $this->table_prefix . 'posts'            => array('post_approved'),
37                $this->table_prefix . 'topics'            => array('topic_approved', 'topic_replies', 'topic_replies_real'),
38            ),
39            'drop_keys'        => array(
40                $this->table_prefix . 'posts'            => array('post_approved'),
41                $this->table_prefix . 'topics'            => array(
42                    'forum_appr_last',
43                    'topic_approved',
44                ),
45            ),
46        );
47    }
48
49    public function revert_schema()
50    {
51        return array(
52            'add_columns'        => array(
53                $this->table_prefix . 'forums'            => array(
54                    'forum_posts'            => array('UINT', 0),
55                    'forum_topics'            => array('UINT', 0),
56                    'forum_topics_real'        => array('UINT', 0),
57                ),
58                $this->table_prefix . 'posts'            => array(
59                    'post_approved'            => array('BOOL', 1),
60                ),
61                $this->table_prefix . 'topics'        => array(
62                    'topic_approved'            => array('BOOL', 1),
63                    'topic_replies'                => array('UINT', 0),
64                    'topic_replies_real'        => array('UINT', 0),
65                ),
66            ),
67            'add_index'        => array(
68                $this->table_prefix . 'posts'            => array(
69                    'post_approved'        => array('post_approved'),
70                ),
71                $this->table_prefix . 'topics'        => array(
72                    'forum_appr_last'    => array('forum_id', 'topic_approved', 'topic_last_post_id'),
73                    'topic_approved'    => array('topic_approved'),
74                ),
75            ),
76        );
77    }
78}