Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
81.48% |
44 / 54 |
|
50.00% |
2 / 4 |
CRAP | |
0.00% |
0 / 1 |
| qa_captcha | |
81.48% |
44 / 54 |
|
50.00% |
2 / 4 |
6.23 | |
0.00% |
0 / 1 |
| effectively_installed | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
12 | |||
| depends_on | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| update_schema | |
100.00% |
41 / 41 |
|
100.00% |
1 / 1 |
1 | |||
| revert_schema | |
0.00% |
0 / 7 |
|
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\v400; |
| 15 | |
| 16 | use phpbb\db\migration\migration; |
| 17 | |
| 18 | class qa_captcha extends migration |
| 19 | { |
| 20 | public function effectively_installed(): bool |
| 21 | { |
| 22 | return $this->db_tools->sql_table_exists($this->tables['captcha_qa_questions']) |
| 23 | && $this->db_tools->sql_table_exists($this->tables['captcha_qa_answers']) |
| 24 | && $this->db_tools->sql_table_exists($this->tables['captcha_qa_confirm']); |
| 25 | } |
| 26 | |
| 27 | public static function depends_on(): array |
| 28 | { |
| 29 | return [ |
| 30 | '\phpbb\db\migration\data\v400\dev', |
| 31 | ]; |
| 32 | } |
| 33 | |
| 34 | public function update_schema(): array |
| 35 | { |
| 36 | return [ |
| 37 | 'add_tables' => [ |
| 38 | $this->tables['captcha_qa_questions'] => [ |
| 39 | 'COLUMNS' => [ |
| 40 | 'question_id' => ['UINT', null, 'auto_increment'], |
| 41 | 'strict' => ['BOOL', 0], |
| 42 | 'lang_id' => ['UINT', 0], |
| 43 | 'lang_iso' => ['VCHAR:30', ''], |
| 44 | 'question_text' => ['TEXT_UNI', ''], |
| 45 | ], |
| 46 | 'PRIMARY_KEY' => 'question_id', |
| 47 | 'KEYS' => [ |
| 48 | 'lang' => ['INDEX', 'lang_iso'], |
| 49 | ], |
| 50 | ], |
| 51 | $this->tables['captcha_qa_answers'] => [ |
| 52 | 'COLUMNS' => [ |
| 53 | 'question_id' => ['UINT', 0], |
| 54 | 'answer_text' => ['STEXT_UNI', ''], |
| 55 | ], |
| 56 | 'KEYS' => [ |
| 57 | 'qid' => ['INDEX', 'question_id'], |
| 58 | ], |
| 59 | ], |
| 60 | $this->tables['captcha_qa_confirm'] => [ |
| 61 | 'COLUMNS' => [ |
| 62 | 'session_id' => ['CHAR:32', ''], |
| 63 | 'confirm_id' => ['CHAR:32', ''], |
| 64 | 'lang_iso' => ['VCHAR:30', ''], |
| 65 | 'question_id' => ['UINT', 0], |
| 66 | 'attempts' => ['UINT', 0], |
| 67 | 'confirm_type' => ['USINT', 0], |
| 68 | ], |
| 69 | 'KEYS' => [ |
| 70 | 'session_id' => ['INDEX', 'session_id'], |
| 71 | 'lookup' => ['INDEX', ['confirm_id', 'session_id', 'lang_iso']], |
| 72 | ], |
| 73 | 'PRIMARY_KEY' => 'confirm_id', |
| 74 | ], |
| 75 | ], |
| 76 | ]; |
| 77 | } |
| 78 | |
| 79 | public function revert_schema(): array |
| 80 | { |
| 81 | return [ |
| 82 | 'drop_tables' => [ |
| 83 | $this->tables['captcha_qa_questions'], |
| 84 | $this->tables['captcha_qa_answers'], |
| 85 | $this->tables['captcha_qa_confirm'] |
| 86 | ], |
| 87 | ]; |
| 88 | } |
| 89 | } |