initial_otp_schema   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A update_schema() 0 20 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_otp_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_otp_reg'	=> array(
20
					'COLUMNS'	=> array(
21
						'registration_id'		=> array('UINT', null, 'auto_increment'),
22
						'user_id'				=> array('UINT', 0),
23
						'secret'				=> array('VCHAR:255', ''),
24
						'last_used'				=> array('TIMESTAMP', 0),
25
						'registered'			=> array('TIMESTAMP', 0),
26
					),
27
					'PRIMARY_KEY'	=> 'registration_id',
28
					'KEYS'			=> array(
29
						'user_id'		=> array('INDEX', array('user_id')),
30
					),
31
				),
32
			),
33
		);
34
	}
35
36
	public function revert_schema()
37
	{
38
		return array(
39
			'drop_tables'	=> array(
40
				$this->table_prefix . 'tfa_otp_reg',
41
			),
42
		);
43
	}
44
}
45