· 8 years ago · May 20, 2018, 08:38 AM
1<?
2
3$bloggyid = id for the blog got from wp_blogs
4
5$create_wp_tables_sqlcomment = "CREATE TABLE IF NOT EXISTS `wp_".$bloggyid."_comments` (
6 `comment_ID` bigint(20) unsigned NOT NULL auto_increment,
7 `comment_post_ID` int(11) NOT NULL default '0',
8 `comment_author` tinytext NOT NULL,
9 `comment_author_email` varchar(100) NOT NULL default '',
10 `comment_author_url` varchar(200) NOT NULL default '',
11 `comment_author_IP` varchar(100) NOT NULL default '',
12 `comment_date` datetime NOT NULL default '0000-00-00 00:00:00',
13 `comment_date_gmt` datetime NOT NULL default '0000-00-00 00:00:00',
14 `comment_content` text NOT NULL,
15 `comment_karma` int(11) NOT NULL default '0',
16 `comment_approved` varchar(20) NOT NULL default '1',
17 `comment_agent` varchar(255) NOT NULL default '',
18 `comment_type` varchar(20) NOT NULL default '',
19 `comment_parent` bigint(20) NOT NULL default '0',
20 `user_id` bigint(20) NOT NULL default '0',
21 PRIMARY KEY (`comment_ID`),
22 KEY `comment_approved` (`comment_approved`),
23 KEY `comment_post_ID` (`comment_post_ID`),
24 KEY `comment_approved_date_gmt` (`comment_approved`,`comment_date_gmt`),
25 KEY `comment_date_gmt` (`comment_date_gmt`)
26) ENGINE=MyISAM DEFAULT CHARSET=utf8 ";
27
28$restult = mysql_query($create_wp_tables_sqlcomment);
29
30$create_wp_tables_sqllinks = "CREATE TABLE IF NOT EXISTS `wp_".$bloggyid."_links` (
31 `link_id` bigint(20) NOT NULL auto_increment,
32 `link_url` varchar(255) NOT NULL default '',
33 `link_name` varchar(255) NOT NULL default '',
34 `link_image` varchar(255) NOT NULL default '',
35 `link_target` varchar(25) NOT NULL default '',
36 `link_category` bigint(20) NOT NULL default '0',
37 `link_description` varchar(255) NOT NULL default '',
38 `link_visible` varchar(20) NOT NULL default 'Y',
39 `link_owner` int(11) NOT NULL default '1',
40 `link_rating` int(11) NOT NULL default '0',
41 `link_updated` datetime NOT NULL default '0000-00-00 00:00:00',
42 `link_rel` varchar(255) NOT NULL default '',
43 `link_notes` mediumtext NOT NULL,
44 `link_rss` varchar(255) NOT NULL default '',
45 PRIMARY KEY (`link_id`),
46 KEY `link_category` (`link_category`),
47 KEY `link_visible` (`link_visible`)
48) ENGINE=MyISAM DEFAULT CHARSET=utf8 ";
49
50$restult = mysql_query($create_wp_tables_sqllinks);
51
52$create_wp_tables_sqloptions = "CREATE TABLE IF NOT EXISTS `wp_".$bloggyid."_options` (
53 `option_id` bigint(20) NOT NULL auto_increment,
54 `blog_id` int(11) NOT NULL default '0',
55 `option_name` varchar(64) NOT NULL default '',
56 `option_value` longtext NOT NULL,
57 `autoload` varchar(20) NOT NULL default 'yes',
58 PRIMARY KEY (`option_id`,`blog_id`,`option_name`),
59 KEY `option_name` (`option_name`)
60) ENGINE=MyISAM DEFAULT CHARSET=utf8 ";
61
62$restult = mysql_query($create_wp_tables_sqloptions);
63
64$create_wp_tables_sqlpostmeta ="CREATE TABLE IF NOT EXISTS `wp_".$bloggyid."_postmeta` (
65 `meta_id` bigint(20) NOT NULL auto_increment,
66 `post_id` bigint(20) NOT NULL default '0',
67 `meta_key` varchar(255) default NULL,
68 `meta_value` longtext,
69 PRIMARY KEY (`meta_id`),
70 KEY `post_id` (`post_id`),
71 KEY `meta_key` (`meta_key`)
72) ENGINE=MyISAM DEFAULT CHARSET=utf8 ";
73
74$restult = mysql_query($create_wp_tables_sqlpostmeta);
75
76$create_wp_tables_sqlposts ="CREATE TABLE IF NOT EXISTS `wp_".$bloggyid."_posts` (
77 `ID` bigint(20) unsigned NOT NULL auto_increment,
78 `post_author` bigint(20) NOT NULL default '0',
79 `post_date` datetime NOT NULL default '0000-00-00 00:00:00',
80 `post_date_gmt` datetime NOT NULL default '0000-00-00 00:00:00',
81 `post_content` longtext NOT NULL,
82 `post_title` text NOT NULL,
83 `post_category` int(4) NOT NULL default '0',
84 `post_excerpt` text NOT NULL,
85 `post_status` varchar(20) NOT NULL default 'publish',
86 `comment_status` varchar(20) NOT NULL default 'open',
87 `ping_status` varchar(20) NOT NULL default 'open',
88 `post_password` varchar(20) NOT NULL default '',
89 `post_name` varchar(200) NOT NULL default '',
90 `to_ping` text NOT NULL,
91 `pinged` text NOT NULL,
92 `post_modified` datetime NOT NULL default '0000-00-00 00:00:00',
93 `post_modified_gmt` datetime NOT NULL default '0000-00-00 00:00:00',
94 `post_content_filtered` text NOT NULL,
95 `post_parent` bigint(20) NOT NULL default '0',
96 `guid` varchar(255) NOT NULL default '',
97 `menu_order` int(11) NOT NULL default '0',
98 `post_type` varchar(20) NOT NULL default 'post',
99 `post_mime_type` varchar(100) NOT NULL default '',
100 `comment_count` bigint(20) NOT NULL default '0',
101 PRIMARY KEY (`ID`),
102 KEY `post_name` (`post_name`),
103 KEY `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`)
104) ENGINE=MyISAM DEFAULT CHARSET=utf8 " ;
105
106$restult = mysql_query($create_wp_tables_sqlposts);
107
108$create_wp_tables_sqlterms ="CREATE TABLE IF NOT EXISTS `wp_".$bloggyid."_terms` (
109 `term_id` bigint(20) NOT NULL auto_increment,
110 `name` varchar(55) NOT NULL default '',
111 `slug` varchar(200) NOT NULL default '',
112 `term_group` bigint(10) NOT NULL default '0',
113 PRIMARY KEY (`term_id`),
114 UNIQUE KEY `slug` (`slug`)
115) ENGINE=MyISAM DEFAULT CHARSET=utf8 ";
116
117$restult = mysql_query($create_wp_tables_sqlterms);
118
119$create_wp_tables_sqltermrelationship = "CREATE TABLE IF NOT EXISTS `wp_".$bloggyid."_term_relationships` (
120 `object_id` bigint(20) NOT NULL default '0',
121 `term_taxonomy_id` bigint(20) NOT NULL default '0',
122 `term_order` int(11) NOT NULL default '0',
123 PRIMARY KEY (`object_id`,`term_taxonomy_id`),
124 KEY `term_taxonomy_id` (`term_taxonomy_id`)
125) ENGINE=MyISAM DEFAULT CHARSET=utf8 ";
126
127$restult = mysql_query($create_wp_tables_sqltermrelationship);
128
129
130$create_wp_tables_sqltermstaxonomy ="CREATE TABLE IF NOT EXISTS `wp_".$bloggyid."_term_taxonomy` (
131 `term_taxonomy_id` bigint(20) NOT NULL auto_increment,
132 `term_id` bigint(20) NOT NULL default '0',
133 `taxonomy` varchar(32) NOT NULL default '',
134 `description` longtext NOT NULL,
135 `parent` bigint(20) NOT NULL default '0',
136 `count` bigint(20) NOT NULL default '0',
137 PRIMARY KEY (`term_taxonomy_id`),
138 UNIQUE KEY `term_id_taxonomy` (`term_id`,`taxonomy`)
139) ENGINE=MyISAM DEFAULT CHARSET=utf8 ";
140
141$restult = mysql_query($create_wp_tables_sqltermstaxonomy);
142
143?>