Repository navigation
Expand file tree
/
Copy pathwp-sqlite-schema.php
More file actions
177 lines (175 loc) · 8.11 KB
/
Copy pathwp-sqlite-schema.php
File metadata and controls
177 lines (175 loc) · 8.11 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?php
/**
* WordPress schema for unit tests for the SQLite database integration project.
*
* This is hardcoded to SQLite DDL.
*/
global $blog_tables;
$blog_tables = "
CREATE TABLE IF NOT EXISTS \"wp_users\"(
\"ID\" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
\"user_login\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"user_pass\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"user_nicename\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"user_email\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"user_url\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"user_registered\" text NOT NULL DEFAULT '0000-00-00 00:00:00' COLLATE NOCASE,
\"user_activation_key\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"user_status\" integer NOT NULL DEFAULT '0',
\"display_name\" text NOT NULL DEFAULT '' COLLATE NOCASE
);
CREATE TABLE IF NOT EXISTS \"wp_usermeta\"(
\"umeta_id\" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
\"user_id\" integer NOT NULL DEFAULT '0',
\"meta_key\" text DEFAULT NULL COLLATE NOCASE,
\"meta_value\" text COLLATE NOCASE
);
CREATE TABLE IF NOT EXISTS \"wp_termmeta\"(
\"meta_id\" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
\"term_id\" integer NOT NULL DEFAULT '0',
\"meta_key\" text DEFAULT NULL COLLATE NOCASE,
\"meta_value\" text COLLATE NOCASE
);
CREATE TABLE IF NOT EXISTS \"wp_terms\"(
\"term_id\" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
\"name\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"slug\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"term_group\" integer NOT NULL DEFAULT 0
);
CREATE TABLE IF NOT EXISTS \"wp_term_taxonomy\"(
\"term_taxonomy_id\" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
\"term_id\" integer NOT NULL DEFAULT 0,
\"taxonomy\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"description\" text NOT NULL COLLATE NOCASE,
\"parent\" integer NOT NULL DEFAULT 0,
\"count\" integer NOT NULL DEFAULT 0
);
CREATE TABLE IF NOT EXISTS \"wp_term_relationships\"(
\"object_id\" integer NOT NULL DEFAULT 0,
\"term_taxonomy_id\" integer NOT NULL DEFAULT 0,
\"term_order\" integer NOT NULL DEFAULT 0,
PRIMARY KEY(\"object_id\", \"term_taxonomy_id\")
);
CREATE TABLE IF NOT EXISTS \"wp_commentmeta\"(
\"meta_id\" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
\"comment_id\" integer NOT NULL DEFAULT '0',
\"meta_key\" text DEFAULT NULL COLLATE NOCASE,
\"meta_value\" text COLLATE NOCASE
);
CREATE TABLE IF NOT EXISTS \"wp_comments\"(
\"comment_ID\" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
\"comment_post_ID\" integer NOT NULL DEFAULT '0',
\"comment_author\" text NOT NULL COLLATE NOCASE,
\"comment_author_email\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"comment_author_url\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"comment_author_IP\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"comment_date\" text NOT NULL DEFAULT '0000-00-00 00:00:00' COLLATE NOCASE,
\"comment_date_gmt\" text NOT NULL DEFAULT '0000-00-00 00:00:00' COLLATE NOCASE,
\"comment_content\" text NOT NULL COLLATE NOCASE,
\"comment_karma\" integer NOT NULL DEFAULT '0',
\"comment_approved\" text NOT NULL DEFAULT '1' COLLATE NOCASE,
\"comment_agent\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"comment_type\" text NOT NULL DEFAULT 'comment' COLLATE NOCASE,
\"comment_parent\" integer NOT NULL DEFAULT '0',
\"user_id\" integer NOT NULL DEFAULT '0'
);
CREATE TABLE IF NOT EXISTS \"wp_links\"(
\"link_id\" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
\"link_url\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"link_name\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"link_image\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"link_target\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"link_description\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"link_visible\" text NOT NULL DEFAULT 'Y' COLLATE NOCASE,
\"link_owner\" integer NOT NULL DEFAULT '1',
\"link_rating\" integer NOT NULL DEFAULT '0',
\"link_updated\" text NOT NULL DEFAULT '0000-00-00 00:00:00' COLLATE NOCASE,
\"link_rel\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"link_notes\" text NOT NULL COLLATE NOCASE,
\"link_rss\" text NOT NULL DEFAULT '' COLLATE NOCASE
);
CREATE TABLE IF NOT EXISTS \"wp_options\"(
\"option_id\" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
\"option_name\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"option_value\" text NOT NULL COLLATE NOCASE,
\"autoload\" text NOT NULL DEFAULT 'yes' COLLATE NOCASE
);
CREATE TABLE IF NOT EXISTS \"wp_postmeta\"(
\"meta_id\" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
\"post_id\" integer NOT NULL DEFAULT '0',
\"meta_key\" text DEFAULT NULL COLLATE NOCASE,
\"meta_value\" text COLLATE NOCASE
);
CREATE TABLE IF NOT EXISTS \"wp_posts\"(
\"ID\" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
\"post_author\" integer NOT NULL DEFAULT '0',
\"post_date\" text NOT NULL DEFAULT '0000-00-00 00:00:00' COLLATE NOCASE,
\"post_date_gmt\" text NOT NULL DEFAULT '0000-00-00 00:00:00' COLLATE NOCASE,
\"post_content\" text NOT NULL COLLATE NOCASE,
\"post_title\" text NOT NULL COLLATE NOCASE,
\"post_excerpt\" text NOT NULL COLLATE NOCASE,
\"post_status\" text NOT NULL DEFAULT 'publish' COLLATE NOCASE,
\"comment_status\" text NOT NULL DEFAULT 'open' COLLATE NOCASE,
\"ping_status\" text NOT NULL DEFAULT 'open' COLLATE NOCASE,
\"post_password\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"post_name\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"to_ping\" text NOT NULL COLLATE NOCASE,
\"pinged\" text NOT NULL COLLATE NOCASE,
\"post_modified\" text NOT NULL DEFAULT '0000-00-00 00:00:00' COLLATE NOCASE,
\"post_modified_gmt\" text NOT NULL DEFAULT '0000-00-00 00:00:00' COLLATE NOCASE,
\"post_content_filtered\" text NOT NULL COLLATE NOCASE,
\"post_parent\" integer NOT NULL DEFAULT '0',
\"guid\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"menu_order\" integer NOT NULL DEFAULT '0',
\"post_type\" text NOT NULL DEFAULT 'post' COLLATE NOCASE,
\"post_mime_type\" text NOT NULL DEFAULT '' COLLATE NOCASE,
\"comment_count\" integer NOT NULL DEFAULT '0'
);
CREATE INDEX \"wp_users__user_login_key\" ON \"wp_users\"(\"user_login\");
CREATE INDEX \"wp_users__user_nicename\" ON \"wp_users\"(\"user_nicename\");
CREATE INDEX \"wp_users__user_email\" ON \"wp_users\"(\"user_email\");
CREATE INDEX \"wp_usermeta__user_id\" ON \"wp_usermeta\"(\"user_id\");
CREATE INDEX \"wp_usermeta__meta_key\" ON \"wp_usermeta\"(\"meta_key\");
CREATE INDEX \"wp_termmeta__term_id\" ON \"wp_termmeta\"(\"term_id\");
CREATE INDEX \"wp_termmeta__meta_key\" ON \"wp_termmeta\"(\"meta_key\");
CREATE INDEX \"wp_terms__slug\" ON \"wp_terms\"(\"slug\");
CREATE INDEX \"wp_terms__name\" ON \"wp_terms\"(\"name\");
CREATE UNIQUE INDEX \"wp_term_taxonomy__term_id_taxonomy\" ON \"wp_term_taxonomy\"(
\"term_id\",
\"taxonomy\"
);
CREATE INDEX \"wp_term_taxonomy__taxonomy\" ON \"wp_term_taxonomy\"(\"taxonomy\");
CREATE INDEX \"wp_term_relationships__term_taxonomy_id\" ON \"wp_term_relationships\"(
\"term_taxonomy_id\"
);
CREATE INDEX \"wp_commentmeta__comment_id\" ON \"wp_commentmeta\"(\"comment_id\");
CREATE INDEX \"wp_commentmeta__meta_key\" ON \"wp_commentmeta\"(\"meta_key\");
CREATE INDEX \"wp_comments__comment_post_ID\" ON \"wp_comments\"(
\"comment_post_ID\"
);
CREATE INDEX \"wp_comments__comment_approved_date_gmt\" ON \"wp_comments\"(
\"comment_approved\",
\"comment_date_gmt\"
);
CREATE INDEX \"wp_comments__comment_date_gmt\" ON \"wp_comments\"(
\"comment_date_gmt\"
);
CREATE INDEX \"wp_comments__comment_parent\" ON \"wp_comments\"(\"comment_parent\");
CREATE INDEX \"wp_comments__comment_author_email\" ON \"wp_comments\"(
\"comment_author_email\"
);
CREATE INDEX \"wp_links__link_visible\" ON \"wp_links\"(\"link_visible\");
CREATE UNIQUE INDEX \"wp_options__option_name\" ON \"wp_options\"(\"option_name\");
CREATE INDEX \"wp_options__autoload\" ON \"wp_options\"(\"autoload\");
CREATE INDEX \"wp_postmeta__post_id\" ON \"wp_postmeta\"(\"post_id\");
CREATE INDEX \"wp_postmeta__meta_key\" ON \"wp_postmeta\"(\"meta_key\");
CREATE INDEX \"wp_posts__post_name\" ON \"wp_posts\"(\"post_name\");
CREATE INDEX \"wp_posts__type_status_date\" ON \"wp_posts\"(
\"post_type\",
\"post_status\",
\"post_date\",
\"ID\"
);
CREATE INDEX \"wp_posts__post_parent\" ON \"wp_posts\"(\"post_parent\");
CREATE INDEX \"wp_posts__post_author\" ON \"wp_posts\"(\"post_author\");
";