1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* Advertisement management. An extension for the phpBB Forum Software package. |
5
|
|
|
* |
6
|
|
|
* @copyright (c) 2017 phpBB Limited <https://www.phpbb.com> |
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
8
|
|
|
* |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace phpbb\ads\migrations\v10x; |
12
|
|
|
|
13
|
|
|
class m9_views_clicks extends \phpbb\db\migration\migration |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* {@inheritDoc} |
17
|
|
|
*/ |
18
|
|
|
public function effectively_installed() |
19
|
|
|
{ |
20
|
|
|
return $this->db_tools->sql_column_exists($this->table_prefix . 'ads', 'ad_views'); |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* {@inheritDoc} |
25
|
|
|
*/ |
26
|
|
|
static public function depends_on() |
27
|
|
|
{ |
28
|
|
|
return array( |
29
|
|
|
'\phpbb\ads\migrations\v10x\m1_initial_schema', |
30
|
|
|
'\phpbb\ads\migrations\v10x\m3_template_locations_schema', |
31
|
|
|
'\phpbb\ads\migrations\v10x\m4_indexes', |
32
|
|
|
'\phpbb\ads\migrations\v10x\m5_end_date', |
33
|
|
|
'\phpbb\ads\migrations\v10x\m8_priority', |
34
|
|
|
); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Add the views and clicks to ads table |
39
|
|
|
* |
40
|
|
|
* @return array Array of table schema |
41
|
|
|
* @access public |
42
|
|
|
*/ |
43
|
|
|
public function update_schema() |
44
|
|
|
{ |
45
|
|
|
return array( |
46
|
|
|
'add_columns' => array( |
47
|
|
|
$this->table_prefix . 'ads' => array( |
48
|
|
|
'ad_views' => array('UINT', 0), |
49
|
|
|
'ad_clicks' => array('UINT', 0), |
50
|
|
|
'ad_views_limit' => array('UINT', 0), |
51
|
|
|
'ad_clicks_limit' => array('UINT', 0), |
52
|
|
|
), |
53
|
|
|
), |
54
|
|
|
); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Drop the views and clicks from ads table |
59
|
|
|
* |
60
|
|
|
* @return array Array of table schema |
61
|
|
|
* @access public |
62
|
|
|
*/ |
63
|
|
|
public function revert_schema() |
64
|
|
|
{ |
65
|
|
|
return array( |
66
|
|
|
'drop_columns' => array( |
67
|
|
|
$this->table_prefix . 'ads' => array( |
68
|
|
|
'ad_views', |
69
|
|
|
'ad_clicks', |
70
|
|
|
'ad_views_limit', |
71
|
|
|
'ad_clicks_limit', |
72
|
|
|
), |
73
|
|
|
), |
74
|
|
|
); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|