Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 69 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
notifications_schema_fix | |
0.00% |
0 / 69 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
depends_on | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
update_schema | |
0.00% |
0 / 36 |
|
0.00% |
0 / 1 |
2 | |||
revert_schema | |
0.00% |
0 / 32 |
|
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 | |
14 | namespace phpbb\db\migration\data\v310; |
15 | |
16 | class notifications_schema_fix extends \phpbb\db\migration\migration |
17 | { |
18 | public static function depends_on() |
19 | { |
20 | return array('\phpbb\db\migration\data\v310\notifications'); |
21 | } |
22 | |
23 | public function update_schema() |
24 | { |
25 | return array( |
26 | 'drop_tables' => array( |
27 | $this->table_prefix . 'notification_types', |
28 | $this->table_prefix . 'notifications', |
29 | ), |
30 | 'add_tables' => array( |
31 | $this->table_prefix . 'notification_types' => array( |
32 | 'COLUMNS' => array( |
33 | 'notification_type_id' => array('USINT', null, 'auto_increment'), |
34 | 'notification_type_name' => array('VCHAR:255', ''), |
35 | 'notification_type_enabled' => array('BOOL', 1), |
36 | ), |
37 | 'PRIMARY_KEY' => array('notification_type_id'), |
38 | 'KEYS' => array( |
39 | 'type' => array('UNIQUE', array('notification_type_name')), |
40 | ), |
41 | ), |
42 | $this->table_prefix . 'notifications' => array( |
43 | 'COLUMNS' => array( |
44 | 'notification_id' => array('UINT:10', null, 'auto_increment'), |
45 | 'notification_type_id' => array('USINT', 0), |
46 | 'item_id' => array('UINT', 0), |
47 | 'item_parent_id' => array('UINT', 0), |
48 | 'user_id' => array('UINT', 0), |
49 | 'notification_read' => array('BOOL', 0), |
50 | 'notification_time' => array('TIMESTAMP', 1), |
51 | 'notification_data' => array('TEXT_UNI', ''), |
52 | ), |
53 | 'PRIMARY_KEY' => 'notification_id', |
54 | 'KEYS' => array( |
55 | 'item_ident' => array('INDEX', array('notification_type_id', 'item_id')), |
56 | 'user' => array('INDEX', array('user_id', 'notification_read')), |
57 | ), |
58 | ), |
59 | ), |
60 | ); |
61 | } |
62 | |
63 | public function revert_schema() |
64 | { |
65 | return array( |
66 | 'drop_tables' => array( |
67 | $this->table_prefix . 'notification_types', |
68 | $this->table_prefix . 'notifications', |
69 | ), |
70 | 'add_tables' => array( |
71 | $this->table_prefix . 'notification_types' => array( |
72 | 'COLUMNS' => array( |
73 | 'notification_type' => array('VCHAR:255', ''), |
74 | 'notification_type_enabled' => array('BOOL', 1), |
75 | ), |
76 | 'PRIMARY_KEY' => array('notification_type', 'notification_type_enabled'), |
77 | ), |
78 | $this->table_prefix . 'notifications' => array( |
79 | 'COLUMNS' => array( |
80 | 'notification_id' => array('UINT', null, 'auto_increment'), |
81 | 'item_type' => array('VCHAR:255', ''), |
82 | 'item_id' => array('UINT', 0), |
83 | 'item_parent_id' => array('UINT', 0), |
84 | 'user_id' => array('UINT', 0), |
85 | 'notification_read' => array('BOOL', 0), |
86 | 'notification_time' => array('TIMESTAMP', 1), |
87 | 'notification_data' => array('TEXT_UNI', ''), |
88 | ), |
89 | 'PRIMARY_KEY' => 'notification_id', |
90 | 'KEYS' => array( |
91 | 'item_ident' => array('INDEX', array('item_type', 'item_id')), |
92 | 'user' => array('INDEX', array('user_id', 'notification_read')), |
93 | ), |
94 | ), |
95 | ), |
96 | ); |
97 | } |
98 | } |