Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
35 / 35 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| phpbb_dbal_migration_schema | |
100.00% |
35 / 35 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| update_schema | |
100.00% |
25 / 25 |
|
100.00% |
1 / 1 |
1 | |||
| revert_schema | |
100.00% |
10 / 10 |
|
100.00% |
1 / 1 |
1 | |||
| 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 | class phpbb_dbal_migration_schema extends \phpbb\db\migration\migration |
| 15 | { |
| 16 | function update_schema() |
| 17 | { |
| 18 | return array( |
| 19 | 'add_columns' => array( |
| 20 | $this->table_prefix . 'config' => array( |
| 21 | 'test_column1' => array('BOOL', 1), |
| 22 | ), |
| 23 | ), |
| 24 | 'add_tables' => array( |
| 25 | $this->table_prefix . 'foobar' => [ |
| 26 | 'COLUMNS' => [ |
| 27 | 'module_id' => ['UINT:3', NULL, 'auto_increment'], |
| 28 | 'user_id' => ['ULINT', 0], |
| 29 | 'endpoint' => ['VCHAR:220', ''], |
| 30 | 'expiration_time' => ['TIMESTAMP', 0], |
| 31 | 'p256dh' => ['VCHAR:200', ''], |
| 32 | 'auth' => ['VCHAR:100', ''], |
| 33 | ], |
| 34 | 'PRIMARY_KEY' => 'module_id', |
| 35 | 'KEYS' => [ |
| 36 | 'i_simple' => ['INDEX', ['user_id', 'endpoint:191']], |
| 37 | 'i_uniq' => ['UNIQUE', ['expiration_time', 'p256dh(100)']], |
| 38 | 'i_auth' => ['INDEX', 'auth'], |
| 39 | ], |
| 40 | ], |
| 41 | ), |
| 42 | ); |
| 43 | } |
| 44 | |
| 45 | function revert_schema() |
| 46 | { |
| 47 | return array( |
| 48 | 'drop_columns' => array( |
| 49 | $this->table_prefix . 'config' => array( |
| 50 | 'test_column1', |
| 51 | ), |
| 52 | ), |
| 53 | 'drop_tables' => array( |
| 54 | $this->table_prefix . 'foobar', |
| 55 | ), |
| 56 | ); |
| 57 | } |
| 58 | } |