forked from gbishop/TarHeelReaderTheme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CreateCollectionsDB.php
38 lines (32 loc) · 975 Bytes
/
CreateCollectionsDB.php
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
<?php
/* Build the Collections DB */
require_once('../../../../wp-load.php');
function BCBuild($create) {
global $wpdb;
$wpdb->show_errors();
$table_name = $wpdb->prefix . 'book_collections';
if($create) {
$sql = "DROP TABLE IF EXISTS $table_name";
echo "$sql\n";
$r = $wpdb->query($sql);
echo 'result = ' . $r . "\n";
$sql = "CREATE TABLE {$table_name} (
ID bigint NOT NULL AUTO_INCREMENT,
title text NOT NULL,
slug varchar(200) NOT NULL,
description text NOT NULL,
owner bigint,
language char(3) NOT NULL,
booklist text NOT NULL,
PRIMARY KEY (ID),
FULLTEXT KEY title (title),
FULLTEXT KEY description (description),
UNIQUE (slug)
) ENGINE=MyISAM DEFAULT CHARSET=utf8";
echo "$sql\n";
$r = $wpdb->query($sql);
echo 'result = ' . $r . "\n";
}
}
BCBuild(0);
?>