initial_schema   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 35
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A update_schema() 0 23 1
A revert_schema() 0 8 1
1
<?php
2
/**
3
 *
4
 * 2FA extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2015 Paul Sohier
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace paul999\tfa\migrations;
12
13
class initial_schema extends \phpbb\db\migration\migration
14
{
15
	public function update_schema()
16
	{
17
		return array(
18
			'add_tables'	=> array(
19
				$this->table_prefix . 'tfa_registration'	=> array(
20
					'COLUMNS'	=> array(
21
						'registration_id'		=> array('UINT', null, 'auto_increment'),
22
						'user_id'				=> array('UINT', 0),
23
						'key_handle'			=> array('VCHAR:255', ''),
24
						'public_key'			=> array('VCHAR:255', ''),
25
						'certificate'			=> array('TEXT', ''),
26
						'counter'				=> array('UINT', 0),
27
						'last_used'				=> array('TIMESTAMP', 0),
28
						'registered'			=> array('TIMESTAMP', 0),
29
					),
30
					'PRIMARY_KEY'	=> 'registration_id',
31
					'KEYS'			=> array(
32
						'user_id'		=> array('INDEX', array('user_id')),
33
					),
34
				),
35
			),
36
		);
37
	}
38
39
	public function revert_schema()
40
	{
41
		return array(
42
			'drop_tables'	=> array(
43
				$this->table_prefix . 'tfa_registration',
44
			),
45
		);
46
	}
47
}
48