Completed
Push — master ( 47b0f8...cbbce4 )
by Khoa
09:57
created

bbook_schema::get_schema_bbook_chapters()   B

Complexity

Conditions 1
Paths 1

Duplication

Lines 0
Ratio 0 %

Size

Total Lines 25
Code Lines 20

Importance

Changes 4
Bugs 0 Features 0
Metric Value
c 4
b 0
f 0
dl 0
loc 25
rs 8.8571
cc 1
eloc 20
nc 1
nop 0
1
<?php
2
/**
3
* This file is part of the VinaBB.vn package.
4
*
5
* @copyright (c) VinaBB <vinabb.vn>
6
* @license GNU General Public License, version 2 (GPL-2.0)
7
*/
8
9
namespace vinabb\web\migrations\v10x;
10
11
use phpbb\db\migration\migration;
12
13
/**
14
* Database schema for BBook
15
*/
16
class bbook_schema extends migration
17
{
18
	/**
19
	* Update schema
20
	*
21
	* @return array
22
	*/
23
	public function update_schema()
24
	{
25
		return [
26
			'add_tables' => [
27
				$this->table_prefix . 'bbook_books'		=> $this->get_schema_bbook_books(),
28
				$this->table_prefix . 'bbook_chapters'	=> $this->get_schema_bbook_chapters(),
29
				$this->table_prefix . 'bbook_words'		=> $this->get_schema_bbook_words()
30
			]
31
		];
32
	}
33
34
	/**
35
	* Get schema for the table: _bbook_books
36
	*
37
	* @return array
38
	*/
39
	protected function get_schema_bbook_books()
40
	{
41
		return [
42
			'COLUMNS' => [
43
				'book_id'				=> ['UINT', null, 'auto_increment'],
44
				'book_name'				=> ['VCHAR_UNI', '', 'true_sort'],
45
				'book_name_seo'			=> ['VCHAR', ''],
46
				'book_lang'				=> ['VCHAR:30', ''],
47
				'book_img'				=> ['VCHAR', ''],
48
				'book_desc'				=> ['TEXT_UNI', ''],
49
				'book_desc_uid'			=> ['VCHAR:8', ''],
50
				'book_desc_bitfield'	=> ['VCHAR:255', ''],
51
				'book_desc_options'		=> ['UINT:11', 0]
52
			],
53
			'PRIMARY_KEY' => 'book_id'
54
		];
55
	}
56
57
	/**
58
	* Get schema for the table: _bbook_chapters
59
	*
60
	* @return array
61
	*/
62
	protected function get_schema_bbook_chapters()
63
	{
64
		return [
65
			'COLUMNS' => [
66
				'chapter_id'			=> ['UINT', null, 'auto_increment'],
67
				'book_id'				=> ['UINT', 0],
68
				'parent_id'				=> ['UINT', 0],
69
				'left_id'				=> ['UINT', 0],
70
				'right_id'				=> ['UINT', 0],
71
				'chapter_parents'		=> ['MTEXT_UNI', ''],
72
				'chapter_name'			=> ['VCHAR_UNI', ''],
73
				'chapter_name_seo'		=> ['VCHAR', ''],
74
				'chapter_text'			=> ['TEXT_UNI', ''],
75
				'chapter_text_uid'		=> ['VCHAR:8', ''],
76
				'chapter_text_bitfield'	=> ['VCHAR:255', ''],
77
				'chapter_text_options'	=> ['UINT:11', 0],
78
				'chapter_views'			=> ['ULINT', 0],
79
				'chapter_time'			=> ['TIMESTAMP', 0]
80
			],
81
			'PRIMARY_KEY' => 'chapter_id',
82
			'KEYS' => [
83
				'b_id'	=> ['INDEX', 'book_id']
84
			]
85
		];
86
	}
87
88
	/**
89
	* Get schema for the table: _bbook_words
90
	*
91
	* @return array
92
	*/
93
	protected function get_schema_bbook_words()
94
	{
95
		return [
96
			'COLUMNS' => [
97
				'word_id'				=> ['UINT', null, 'auto_increment'],
98
				'word'					=> ['VCHAR_UNI', '', 'true_sort'],
99
				'word_lang'				=> ['VCHAR:30', ''],
100
				'word_desc'				=> ['TEXT_UNI', ''],
101
				'word_desc_uid'			=> ['VCHAR:8', ''],
102
				'word_desc_bitfield'	=> ['VCHAR:255', ''],
103
				'word_desc_options'		=> ['UINT:11', 0],
104
				'word_url'				=> ['VCHAR', '']
105
			],
106
			'PRIMARY_KEY' => 'word_id'
107
		];
108
	}
109
}
110