Completed
Push — master ( 3a4f08...4054c1 )
by Paul
02:27
created

initial_back_schema::update_schema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
rs 9.3142
cc 1
eloc 14
nc 1
nop 0
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_back_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_back_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
						'valid'					=> array('BOOL', 0),
27
					),
28
					'PRIMARY_KEY'	=> 'registration_id',
29
					'KEYS'			=> array(
30
						'user_id'		=> array('INDEX', array('user_id')),
31
					),
32
				),
33
			),
34
		);
35
	}
36
37
	public function revert_schema()
38
	{
39
		return array(
40
			'drop_tables'	=> array(
41
				$this->table_prefix . 'tfa_back_reg',
42
			),
43
		);
44
	}
45
}
46