m7_drop_old_tables   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 4
eloc 36
c 4
b 0
f 0
dl 0
loc 63
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A revert_schema() 0 36 1
A effectively_installed() 0 3 1
A update_schema() 0 8 1
A depends_on() 0 5 1
1
<?php
2
/**
3
 *
4
 * Ideas extension for 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
 */
10
11
namespace phpbb\ideas\migrations;
12
13
class m7_drop_old_tables extends \phpbb\db\migration\migration
14
{
15
	public function effectively_installed()
16
	{
17
		return !$this->db_tools->sql_table_exists($this->table_prefix . 'ideas_statuses');
18
	}
19
20
	public static function depends_on()
21
	{
22
		return array(
23
			'\phpbb\ideas\migrations\m1_initial_schema',
24
			'\phpbb\ideas\migrations\m6_migrate_old_tables',
25
		);
26
	}
27
28
	public function update_schema()
29
	{
30
		return array(
31
			'drop_tables'	=> array(
32
				$this->table_prefix . 'ideas_statuses',
33
				$this->table_prefix . 'ideas_tickets',
34
				$this->table_prefix . 'ideas_rfcs',
35
				$this->table_prefix . 'ideas_duplicates',
36
			),
37
		);
38
	}
39
40
	public function revert_schema()
41
	{
42
		return array(
43
			'add_tables'	=> array(
44
				$this->table_prefix . 'ideas_statuses' => array(
45
					'COLUMNS'	=> array(
46
						'status_id'			=> array('UINT', 0),
47
						'status_name'		=> array('VCHAR', ''),
48
					),
49
					'PRIMARY_KEY'			=> 'status_id',
50
				),
51
				$this->table_prefix . 'ideas_tickets' => array(
52
					'COLUMNS'	=> array(
53
						'idea_id'			=> array('UINT', 0),
54
						'ticket_id'			=> array('UINT', 0),
55
					),
56
					'KEYS'					=> array(
57
						'ticket_key' 		=> array('INDEX', array('idea_id', 'ticket_id')),
58
					),
59
				),
60
				$this->table_prefix . 'ideas_rfcs' => array(
61
					'COLUMNS'	=> array(
62
						'idea_id'			=> array('UINT', 0),
63
						'rfc_link'			=> array('VCHAR', ''),
64
					),
65
					'KEYS'					=> array(
66
						'rfc_key'			=> array('INDEX', array('idea_id', 'rfc_link')),
67
					),
68
				),
69
				$this->table_prefix . 'ideas_duplicates' => array(
70
					'COLUMNS'	=> array(
71
						'idea_id'			=> array('UINT', 0),
72
						'duplicate_id'		=> array('UINT', 0),
73
					),
74
					'KEYS'					=> array(
75
						'dupe_key'			=> array('INDEX', array('idea_id', 'duplicate_id')),
76
					),
77
				),
78
			),
79
		);
80
	}
81
}
82