Passed
Push — 1.4.0 ( 3f30c0...20310e )
by Sylver
02:46
created

v110_schema::update_schema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 15
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 20
rs 9.7666
1
<?php
2
/**
3
*
4
* @package		Breizh Smilies Categories Extension
5
* @copyright	(c) 2020 Sylver35  https://breizhcode.com
6
* @license		http://opensource.org/licenses/gpl-license.php GNU Public License
7
*
8
*/
9
10
namespace sylver35\smiliescat\migrations;
11
12
use phpbb\db\migration\migration;
13
14
class v110_schema extends migration
15
{
16
	public function effectively_installed()
17
	{
18
		return $this->db_tools->sql_column_exists($this->table_prefix . 'smilies', 'category') && $this->db_tools->sql_table_exists($this->table_prefix . 'smilies_category');
19
	}
20
21
	static public function depends_on()
22
	{
23
		return ['\phpbb\db\migration\data\v32x\v328'];
24
	}
25
26
	public function update_schema()
27
	{
28
		return [
29
			'add_tables' => [
30
				$this->table_prefix . 'smilies_category' => [
31
					'COLUMNS'		=> [
32
						'cat_lang_id'		=> ['UINT', null, 'auto_increment'],
33
						'cat_id'			=> ['UINT', 0],
34
						'cat_order'			=> ['UINT', 0],
35
						'cat_lang'			=> ['VCHAR:30', ''],
36
						'cat_name'			=> ['VCHAR:50', ''],
37
						'cat_title'			=> ['VCHAR:50', ''],
38
						'cat_nb'			=> ['UINT', 0],
39
					],
40
					'PRIMARY_KEY'	=> ['cat_lang_id'],
41
				],
42
			],
43
			'add_columns' => [
44
				$this->table_prefix . 'smilies' => [
45
					'category'	=> ['UINT', 0],
46
				],
47
			],
48
		];
49
	}
50
51
	public function revert_schema()
52
	{
53
		return [
54
			'drop_tables' => [
55
				$this->table_prefix . 'smilies_category',
56
			],
57
			'drop_columns' => [
58
				$this->table_prefix . 'smilies' => [
59
					'category',
60
				],
61
			],
62
		];
63
	}
64
}
65