summaryrefslogtreecommitdiff
path: root/admin/schema_inc.php
blob: b61ffc1536bba5d905b12ef342249c3dbfcf4ebc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
$tables = array(
	'boards_post' => "
		comment_id I4 PRIMARY,
		approved I1 NOTNULL DEFAULT(0),
		warned I1 NOTNULL DEFAULT(0),
		warned_message X
	",
	'boards_topic' => "
		parent_id I4 PRIMARY,
		locked I1 NOTNULL DEFAULT(0),
		moved I4 NOTNULL DEFAULT(0),
		sticky I1 NOTNULL DEFAULT(0)
	",
	'boards' => "
		board_id I4 PRIMARY,
		content_id I4 NOTNULL
		CONSTRAINT ', CONSTRAINT `bitboards_content_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content` (`content_id`)'
	",
	'boards_map' => "
		board_content_id I4 NOTNULL,
		topic_content_id I4 PRIMARY
		CONSTRAINT ', CONSTRAINT `bitboards_topics_boards_ref` FOREIGN KEY (`board_content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content` (`content_id`)
					, CONSTRAINT `bitboards_topics_related_ref` FOREIGN KEY (`topic_content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content` (`content_id`)'
	",
	'boards_tracking' => "
		user_id I4 NOTNULL,
		topic_id C(10),
		track_date I4 NOTNULL DEFAULT(0),
		notify I1 NOTNULL DEFAULT(0),
		notify_date I4 NOTNULL DEFAULT(0)
	"
);

global $gBitInstaller;

foreach( array_keys( $tables ) AS $tableName ) {
	$gBitInstaller->registerSchemaTable( BITBOARDS_PKG_NAME, $tableName, $tables[$tableName] );
}

$gBitInstaller->registerPackageInfo( BITBOARDS_PKG_NAME, array(
	'description' => "Highly integrated message boards package.",
	'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>',
) );

// ### Indexes
$indices = array(
	'boards_id_idx' => array('table' => 'boards', 'cols' => 'board_id', 'opts' => NULL ),
);
$gBitInstaller->registerSchemaIndexes( BITBOARDS_PKG_NAME, $indices );

// ### Sequences
$sequences = array (
	'boards_board_id_seq' => array( 'start' => 1 ),
	'bitboards_id_seq' => array( 'start' => 1 ),
	'bitboards_topic_id_seq' => array( 'start' => 1 ),
);
$gBitInstaller->registerSchemaSequences( BITBOARDS_PKG_NAME, $sequences );

// ### Default UserPermissions
$gBitInstaller->registerUserPermissions( BITBOARDS_PKG_NAME, array(
	array( 'p_bitboards_admin', 'Can admin message boards', 'admin', BITBOARDS_PKG_NAME ),
	array( 'p_bitboards_create', 'Can create a message board', 'admin', BITBOARDS_PKG_NAME ),
	array( 'p_bitboards_edit', 'Can edit any message board', 'admin', BITBOARDS_PKG_NAME ),
	array( 'p_bitboards_read', 'Can read message boards', 'basic',  BITBOARDS_PKG_NAME ),
	array( 'p_bitboards_remove', 'Can delete message boards', 'admin',  BITBOARDS_PKG_NAME ),
) );

// ### Default Preferences
$gBitInstaller->registerPreferences( BITBOARDS_PKG_NAME, array(
	array( BITBOARDS_PKG_NAME, 'bitboards_thread_track', 'y' ),
) );
?>