- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
「データベース構造」の版間の差分
(2.9 に更新(変更点は →変更履歴: を参照)) |
(3.0 に更新、カテゴリ・言語間リンク追加。変更点は →変更履歴: 参照/マルチサイト部分未翻訳) |
||
1行目: | 1行目: | ||
{{Rename|D|2008-11-14}} | {{Rename|D|2008-11-14}} | ||
− | {{ | + | {{NeedTrans|一部}} |
{{募集中||WordPress {{CurrentVersion}} のER図を作成できる人は、|画像}} | {{募集中||WordPress {{CurrentVersion}} のER図を作成できる人は、|画像}} | ||
__TOC__ | __TOC__ | ||
− | 以下は、[[:Category: | + | 以下は、[[:Category:wp3.0|WordPress バージョン '''3.0''']] の標準的なインストールで作成されるデータベース・テーブルの概要と説明です。現在、WordPress バージョン 3.0 が対応しているデータベースは、[[用語集#MySQL|MySQL]] バージョン '''4.1.2 以上'''のみです。 |
− | + | WordPressは内部でデータベースと連動しているため、エンドユーザはその構造を気にかける必要はありません。しかし[[プラグインの作成|プラグインを作成]]していると、WordPressが格納するデータやその関係について知りたいと思うかもしれません。If you have already attempted to use the existing [[:Category:API|WordPress API]] to access the data you need but have determined it's not possible without accessing the database directly, WordPressではこの処理が簡単にできるよう [[関数リファレンス/wpdb Class|wpdb クラス]]を用意しています。 | |
+ | <!-- | ||
+ | Because WordPress interfaces with this database by itself, you as an end user, shouldn't have to worry much about its structure. If you're [[Writing a Plugin]] however, you may be interested in learning how WordPress stores it's data and relationships. If you have already attempted to use the existing [[:Category:API|WordPress API]] to access the data you need but have determined it's not possible without accessing the database directly, WordPress provides the [[Function Reference/wpdb Class|wpdb Class]] to make this task easy. | ||
+ | --> | ||
注: | 注: | ||
12行目: | 15行目: | ||
* [[#旧バージョンのデータベース概要|旧バージョンのデータベース概要]] | * [[#旧バージョンのデータベース概要|旧バージョンのデータベース概要]] | ||
− | == <span id="Database_Diagram"> | + | == データベース関連図 <span id="Database_Diagram"></span> == |
− | 下図は、WordPress | + | 下図は、WordPress データベースの概要および標準インストール時に作成されるテーブル間の関係を視覚的に表したものです。また、[[#Table Overview|テーブル一覧]]以降では、テーブルおよびカラムの詳細を掲載しています。 |
− | [[Image: | + | [[Image:WP3.0-ERD.png|500px|WP3.0 データベース関連図(ER図)]] /[[:en:Image:WP3.0-ERD.png|英語版で画像を見る]] |
標準インストールでテーブル間の整合性は強制されない事に注意してください(例: 投稿とコメント)。もし WordPress データベースを操作するプラグインやその他の拡張機能を作成する場合は、ハウスキーピング処理をコードに含め、孤立したレコードがテーブルに残らないようにしましょう。この一例として、外部キーが削除された場合、一連の SQL コマンドを使って他のテーブルのレコードを削除するといったことが挙げられます。また、このような操作を行う前には、ユーザーにバックアップを取るよう促すことも忘れないでください。 | 標準インストールでテーブル間の整合性は強制されない事に注意してください(例: 投稿とコメント)。もし WordPress データベースを操作するプラグインやその他の拡張機能を作成する場合は、ハウスキーピング処理をコードに含め、孤立したレコードがテーブルに残らないようにしましょう。この一例として、外部キーが削除された場合、一連の SQL コマンドを使って他のテーブルのレコードを削除するといったことが挙げられます。また、このような操作を行う前には、ユーザーにバックアップを取るよう促すことも忘れないでください。 | ||
27行目: | 30行目: | ||
{| table border=1 | {| table border=1 | ||
|- valign="top" | |- valign="top" | ||
− | ! colspan="3" bordercolor="#FFFFFF" | WordPress | + | ! colspan="3" bordercolor="#FFFFFF" | WordPress 3.0 テーブル (11) |
|- valign="top" | |- valign="top" | ||
! テーブル名 !! 説明 !! 関連インタフェース画面 | ! テーブル名 !! 説明 !! 関連インタフェース画面 | ||
35行目: | 38行目: | ||
|- valign="top" | |- valign="top" | ||
! [[#Table:_wp_comments|wp_comments]] | ! [[#Table:_wp_comments|wp_comments]] | ||
− | | WordPress への'''コメント'''・トラックバック・ピンバックデータを格納 || コメントは投稿記事への反応として読者によって作成される。管理者によるコメント管理は [[管理パネル]] > [[管理パネル#Comments|コメント]] > [[Comments Comments SubPanel|コメント | + | | WordPress への'''コメント'''・トラックバック・ピンバックデータを格納 || コメントは投稿記事への反応として読者によって作成される。管理者によるコメント管理は [[管理パネル]] > [[管理パネル#Comments|コメント]] > [[Comments Comments SubPanel|コメント]]にて |
|- valign="top" | |- valign="top" | ||
! [[#Table:_wp_links|wp_links]] | ! [[#Table:_wp_links|wp_links]] | ||
| [[管理パネル#Links|リンク作成]]機能で入力された'''リンク'''情報を格納 || | | [[管理パネル#Links|リンク作成]]機能で入力された'''リンク'''情報を格納 || | ||
* [[管理パネル]] > [[管理パネル#Links|リンク]] > [[Links Add New SubPanel|新規追加]] | * [[管理パネル]] > [[管理パネル#Links|リンク]] > [[Links Add New SubPanel|新規追加]] | ||
− | * [[管理パネル]] > [[管理パネル#Links|リンク]] > [[Links | + | * [[管理パネル]] > [[管理パネル#Links|リンク]] > [[Links Links SubPanel|リンク]] |
|- valign="top" | |- valign="top" | ||
! [[#Table:_wp_options|wp_options]] | ! [[#Table:_wp_options|wp_options]] | ||
52行目: | 55行目: | ||
* [[管理パネル]] > [[管理パネル#Settings|設定]] > [[Settings Privacy SubPanel|プライバシー設定]] | * [[管理パネル]] > [[管理パネル#Settings|設定]] > [[Settings Privacy SubPanel|プライバシー設定]] | ||
* [[管理パネル]] > [[管理パネル#Settings|設定]] > [[Settings Permalinks SubPanel|パーマリンク設定]] | * [[管理パネル]] > [[管理パネル#Settings|設定]] > [[Settings Permalinks SubPanel|パーマリンク設定]] | ||
− | |||
* [[管理パネル]] > [[管理パネル#Appearance|外観]] > [[Appearance Widgets SubPanel|ウィジェット]] | * [[管理パネル]] > [[管理パネル#Appearance|外観]] > [[Appearance Widgets SubPanel|ウィジェット]] | ||
|- valign="top" | |- valign="top" | ||
62行目: | 64行目: | ||
|- valign="top" | |- valign="top" | ||
! [[#Table:_wp_posts|wp_posts]] | ! [[#Table:_wp_posts|wp_posts]] | ||
− | | WordPress データの核である'''投稿記事''' | + | | WordPress データの核である[[用語集#Post|'''投稿記事''']]のほか、[[用語集#Page|'''ページ''']]、ナビゲーションメニューのデータを格納 || |
* [[管理パネル]] > [[管理パネル#Posts|投稿]] > [[Posts Add New SubPanel|新規追加]] | * [[管理パネル]] > [[管理パネル#Posts|投稿]] > [[Posts Add New SubPanel|新規追加]] | ||
− | * [[管理パネル]] > [[管理パネル#Posts|投稿]] > [[Posts | + | * [[管理パネル]] > [[管理パネル#Posts|投稿]] > [[Posts Posts SubPanel|投稿]] |
* [[管理パネル]] > [[管理パネル#Pages|ページ]] > [[Pages Add New SubPanel|新規追加]] | * [[管理パネル]] > [[管理パネル#Pages|ページ]] > [[Pages Add New SubPanel|新規追加]] | ||
− | * [[管理パネル]] > [[管理パネル#Pages|ページ]] > [[Pages | + | * [[管理パネル]] > [[管理パネル#Pages|ページ]] > [[Pages Pages SubPanel|ページ]] |
* [[管理パネル]] > [[管理パネル#Media|メディア]] > [[Media Add New SubPanel|新規追加]] | * [[管理パネル]] > [[管理パネル#Media|メディア]] > [[Media Add New SubPanel|新規追加]] | ||
+ | * [[管理パネル]] > [[管理パネル#Appearance|外観]] > [[Appearance Menus SubPanel|メニュー]] | ||
|- valign="top" | |- valign="top" | ||
! [[#Table:_wp_terms|wp_terms]] | ! [[#Table:_wp_terms|wp_terms]] | ||
| 投稿およびリンクの分類(カテゴリ・タグ)に使われる'''語句'''の基本情報を格納 || rowspan="3" | | | 投稿およびリンクの分類(カテゴリ・タグ)に使われる'''語句'''の基本情報を格納 || rowspan="3" | | ||
− | * [[管理パネル]] > [[管理パネル#Posts|投稿]] > [[Posts Tags SubPanel| | + | * [[管理パネル]] > [[管理パネル#Posts|投稿]] > [[Posts Post Tags SubPanel|投稿タグ]] |
* [[管理パネル]] > [[管理パネル#Posts|投稿]] > [[Posts Categories SubPanel|カテゴリー]] | * [[管理パネル]] > [[管理パネル#Posts|投稿]] > [[Posts Categories SubPanel|カテゴリー]] | ||
* [[管理パネル]] > [[管理パネル#Links|リンク]] > [[Links Link Categories SubPanel|リンクカテゴリー]] | * [[管理パネル]] > [[管理パネル#Links|リンク]] > [[Links Link Categories SubPanel|リンクカテゴリー]] | ||
* [[管理パネル]] > [[管理パネル#Posts|投稿]] > [[Posts Add New SubPanel|新規追加]] | * [[管理パネル]] > [[管理パネル#Posts|投稿]] > [[Posts Add New SubPanel|新規追加]] | ||
− | * [[管理パネル]] > [[管理パネル#Posts|投稿]] > [[Posts | + | * [[管理パネル]] > [[管理パネル#Posts|投稿]] > [[Posts Posts SubPanel|投稿]] |
* [[管理パネル]] > [[管理パネル#Pages|ページ]] > [[Pages Add New SubPanel|新規追加]] | * [[管理パネル]] > [[管理パネル#Pages|ページ]] > [[Pages Add New SubPanel|新規追加]] | ||
− | * [[管理パネル]] > [[管理パネル#Pages|ページ]] > [[Pages | + | * [[管理パネル]] > [[管理パネル#Pages|ページ]] > [[Pages Pages SubPanel|ページ]] |
− | * [[管理パネル]] > [[管理パネル#Links|リンク]] > [[Links | + | * [[管理パネル]] > [[管理パネル#Links|リンク]] > [[Links Links SubPanel|リンク]] |
* [[管理パネル]] > [[管理パネル#Links|リンク]] > [[Links Add New SubPanel|編集]] | * [[管理パネル]] > [[管理パネル#Links|リンク]] > [[Links Add New SubPanel|編集]] | ||
|- valign="top" | |- valign="top" | ||
105行目: | 108行目: | ||
{| table border=1 | {| table border=1 | ||
− | ! フィールド !! | + | ! フィールド !! 種別 !! Null !! キー !! 初期値 !! 備考 !! 説明 |
|- | |- | ||
|meta_id||bigint(20) unsigned|| ||PRI||NULL||auto_increment || コメントメタID(登録順に自動採番) | |meta_id||bigint(20) unsigned|| ||PRI||NULL||auto_increment || コメントメタID(登録順に自動採番) | ||
119行目: | 122行目: | ||
{| table width="60%" border=1 | {| table width="60%" border=1 | ||
− | ! キー名 !! 種別 !! Cardinality !! フィールド | + | ! キー名 !! 種別 !! 一意な値の数<!-- Cardinality --> !! フィールド |
|- | |- | ||
|PRIMARY||PRIMARY||0||meta_ID | |PRIMARY||PRIMARY||0||meta_ID | ||
133行目: | 136行目: | ||
{| table border=1 | {| table border=1 | ||
− | ! フィールド !! | + | ! フィールド !! 種別 !! Null !! キー !! 初期値 !! 備考 !! 説明 |
|- | |- | ||
| comment_ID || bigint(20) unsigned || || PRI || NULL || auto_increment || コメントID(投稿順に自動採番) | | comment_ID || bigint(20) unsigned || || PRI || NULL || auto_increment || コメントID(投稿順に自動採番) | ||
174行目: | 177行目: | ||
====インデックス==== | ====インデックス==== | ||
{| table width="60%" border=1 | {| table width="60%" border=1 | ||
− | ! キー名 !! 種別 !! Cardinality !! フィールド | + | ! キー名 !! 種別 !! 一意な値の数<!-- Cardinality --> !! フィールド |
|- | |- | ||
| PRIMARY || PRIMARY || 1 || comment_ID | | PRIMARY || PRIMARY || 1 || comment_ID | ||
185行目: | 188行目: | ||
|- | |- | ||
| comment_date_gmt || INDEX || None || comment_date_gmt | | comment_date_gmt || INDEX || None || comment_date_gmt | ||
+ | |- | ||
+ | | comment_parent ||INDEX || None || comment_parent | ||
|} | |} | ||
192行目: | 197行目: | ||
{| table border=1 | {| table border=1 | ||
− | ! フィールド !! | + | ! フィールド !! 種別 !! Null !! キー !! 初期値 !! 備考 !! 説明 |
|- | |- | ||
| link_id || bigint(20) unsigned || || PRI || NULL || auto_increment || リンクID(登録順に自動採番) | | link_id || bigint(20) unsigned || || PRI || NULL || auto_increment || リンクID(登録順に自動採番) | ||
225行目: | 230行目: | ||
====インデックス==== | ====インデックス==== | ||
{| table width="60%" border=1 | {| table width="60%" border=1 | ||
− | ! キー名 !! 種別 !! Cardinality !! フィールド | + | ! キー名 !! 種別 !! 一意な値の数<!-- Cardinality --> !! フィールド |
|- | |- | ||
| PRIMARY || PRIMARY || 7 || link_ID | | PRIMARY || PRIMARY || 7 || link_ID | ||
239行目: | 244行目: | ||
{| table border=1 | {| table border=1 | ||
− | ! フィールド !! | + | ! フィールド !! 種別 !! Null !! キー !! 初期値 !! 備考 !! 説明 |
|- | |- | ||
| option_id || bigint(20) unsigned || || PRI Pt1 || NULL || auto_increment || オプションID(登録順に自動採番) | | option_id || bigint(20) unsigned || || PRI Pt1 || NULL || auto_increment || オプションID(登録順に自動採番) | ||
256行目: | 261行目: | ||
====インデックス==== | ====インデックス==== | ||
{| table width="60%" border=1 | {| table width="60%" border=1 | ||
− | ! キー名 !! 種別 !! Cardinality !! フィールド | + | ! キー名 !! 種別 !! 一意な値の数<!-- Cardinality --> !! フィールド |
|- | |- | ||
| PRIMARY || PRIMARY || 184 || option_id<br />blog_id<br />option_name | | PRIMARY || PRIMARY || 184 || option_id<br />blog_id<br />option_name | ||
268行目: | 273行目: | ||
{| table border=1 | {| table border=1 | ||
− | ! フィールド !! | + | ! フィールド !! 種別 !! Null !! キー !! 初期値 !! 備考 !! 説明 |
|- | |- | ||
| meta_id || bigint(20) unsigned || || PRI || NULL || auto_increment || メタID(一意)(登録順に自動採番) | | meta_id || bigint(20) unsigned || || PRI || NULL || auto_increment || メタID(一意)(登録順に自動採番) | ||
281行目: | 286行目: | ||
====インデックス==== | ====インデックス==== | ||
{| table width="60%" border=1 | {| table width="60%" border=1 | ||
− | ! キー名 !! 種別 !! Cardinality !! フィールド | + | ! キー名 !! 種別 !! 一意な値の数<!-- Cardinality --> !! フィールド |
|- | |- | ||
| PRIMARY || PRIMARY || 13 || meta_ID | | PRIMARY || PRIMARY || 13 || meta_ID | ||
295行目: | 300行目: | ||
{| table border=1 | {| table border=1 | ||
− | ! フィールド !! | + | ! フィールド !! 種別 !! Null !! キー !! 初期値 !! 備考 !! 説明 |
|- | |- | ||
|ID || bigint(20) unsigned || || PRI & IND Pt4 || || auto_increment || 投稿ID(保存順に自動採番) | |ID || bigint(20) unsigned || || PRI & IND Pt4 || || auto_increment || 投稿ID(保存順に自動採番) | ||
379行目: | 384行目: | ||
|- | |- | ||
| post_parent || INDEX || None || post_parent | | post_parent || INDEX || None || post_parent | ||
+ | |- | ||
+ | | post_author || INDEX || None || post_author | ||
|} | |} | ||
386行目: | 393行目: | ||
{| table border=1 | {| table border=1 | ||
− | ! フィールド !! | + | ! フィールド !! 種別 !! Null !! キー !! 初期値 !! 備考 !! 説明 |
|- | |- | ||
| term_id || bigint(20) unsigned || || PRI || || auto_increment || term のユニークID | | term_id || bigint(20) unsigned || || PRI || || auto_increment || term のユニークID | ||
399行目: | 406行目: | ||
====インデックス==== | ====インデックス==== | ||
{| table width="60%" border=1 | {| table width="60%" border=1 | ||
− | ! キー名 !! 種別 !! Cardinality !! フィールド | + | ! キー名 !! 種別 !! 一意な値の数<!-- Cardinality --> !! フィールド |
|- | |- | ||
| PRIMARY || PRIMARY || 2 || term_ID | | PRIMARY || PRIMARY || 2 || term_ID | ||
413行目: | 420行目: | ||
{| table border=1 | {| table border=1 | ||
− | ! フィールド !! | + | ! フィールド !! 種別 !! Null !! キー !! 初期値 !! 備考 !! 説明 |
|- | |- | ||
| object_id || bigint(20) unsigned || || PRI Pt1 || 0 || || 記事ID or リンクID | | object_id || bigint(20) unsigned || || PRI Pt1 || 0 || || 記事ID or リンクID | ||
424行目: | 431行目: | ||
====インデックス==== | ====インデックス==== | ||
{| table width="60%" border=1 | {| table width="60%" border=1 | ||
− | ! キー名 !! 種別 !! Cardinality !! フィールド | + | ! キー名 !! 種別 !! 一意な値の数<!-- Cardinality --> !! フィールド |
|- | |- | ||
| PRIMARY || PRIMARY || 8 || object_id<br />term_taxonomy_id | | PRIMARY || PRIMARY || 8 || object_id<br />term_taxonomy_id | ||
436行目: | 443行目: | ||
{| table border=1 | {| table border=1 | ||
− | ! フィールド !! | + | ! フィールド !! 種別 !! Null !! キー !! 初期値 !! 備考 !! 説明 |
|- | |- | ||
| term_taxonomy_id || bigint(20) unsigned || || PRI || || auto_increment || term+taxonomy ペアのユニークID | | term_taxonomy_id || bigint(20) unsigned || || PRI || || auto_increment || term+taxonomy ペアのユニークID | ||
456行目: | 463行目: | ||
====インデックス==== | ====インデックス==== | ||
{| table width="60%" border=1 | {| table width="60%" border=1 | ||
− | ! キー名 !! 種別 !! Cardinality !! フィールド | + | ! キー名 !! 種別 !! 一意な値の数<!-- Cardinality --> !! フィールド |
|- | |- | ||
| PRIMARY || PRIMARY || 2 || term_taxonomy_id | | PRIMARY || PRIMARY || 2 || term_taxonomy_id | ||
470行目: | 477行目: | ||
{| table border=1 | {| table border=1 | ||
− | ! フィールド !! | + | ! フィールド !! 種別 !! Null !! キー !! 初期値 !! 備考 !! 説明 |
|- | |- | ||
| umeta_id || bigint(20) unsigned || || PRI || NULL || auto_increment || ユーザ・メタデータの ID(登録順に自動採番) | | umeta_id || bigint(20) unsigned || || PRI || NULL || auto_increment || ユーザ・メタデータの ID(登録順に自動採番) | ||
483行目: | 490行目: | ||
====インデックス==== | ====インデックス==== | ||
{| table width="60%" border=1 | {| table width="60%" border=1 | ||
− | ! キー名 !! 種別 !! Cardinality !! フィールド | + | ! キー名 !! 種別 !! 一意な値の数<!-- Cardinality --> !! フィールド |
|- | |- | ||
| PRIMARY || PRIMARY || 9 || umeta_id | | PRIMARY || PRIMARY || 9 || umeta_id | ||
497行目: | 504行目: | ||
{| table border=1 | {| table border=1 | ||
− | ! フィールド !! | + | ! フィールド !! 種別 !! Null !! キー !! 初期値 !! 備考 !! 説明 |
|- | |- | ||
| ID || bigint(20) unsigned || || PRI || NULL || auto_increment || ユーザID | | ID || bigint(20) unsigned || || PRI || NULL || auto_increment || ユーザID | ||
524行目: | 531行目: | ||
====インデックス==== | ====インデックス==== | ||
{| table width="60%" border=1 | {| table width="60%" border=1 | ||
− | ! キー名 !! 種別 !! Cardinality !! フィールド | + | ! キー名 !! 種別 !! 一意な値の数<!-- Cardinality --> !! フィールド |
|- | |- | ||
| PRIMARY || PRIMARY || 1 || ID | | PRIMARY || PRIMARY || 1 || ID | ||
533行目: | 540行目: | ||
|} | |} | ||
− | < | + | == マルチサイトテーブル一覧 <span id="Multisite_Table_Overview"></span> == |
− | + | ||
− | </ | + | |
− | * [ | + | This section is the overview of the tables created for use with the Multisite feature of WordPress. These tables are created via the processes under [[Super_Admin_Menu|Administration]] > [[Super_Admin_Menu#Tools|Tools]] > [[Tools Network SubPanel|Network]]. |
+ | |||
+ | These tables are considered the multisite global tables. | ||
+ | |||
+ | This section is the overview of the tables created for use with the [[Glossary#Multisite|Multisite]] feature of WordPress. These tables are created via the processes under [[Super Admin Menu|Administration]] > [[Super Admin Menu#Tools|Tools]] > [[Tools Network SubPanel|Network]]. | ||
+ | |||
+ | These tables are considered the multisite global tables. | ||
+ | |||
+ | {| <!-- width="75%" --> border="1" | ||
+ | |- valign="top" | ||
+ | ! colspan="3" bordercolor="#FFFFFF" | <strong>WordPress 3.0 Multisite Tables</strong> | ||
+ | |- valign="top" | ||
+ | ! width="6%" | '''Table Name''' !! width="35%" | '''Description''' !! '''Relevant Area(s) of WordPress User Interface''' | ||
+ | |- valign="top" | ||
+ | ! [[#Table:_wp_blogs|wp_blogs]] | ||
+ | | Each '''site''' created is stored in the table, <tt>wp_blogs</tt>. || | ||
+ | * [[Super_Admin_Menu|Administration]] > [[Super_Admin_Menu#Tools|Tools]] > [[Tools Network SubPanel|Network]] | ||
+ | * [[Super_Admin_Menu|Administration]] > [[Super_Admin_Menu#Sites|Super Admin]] > [[Super Admin Sites SubPanel|Sites]] | ||
+ | |- valign="top" | ||
+ | ! [[#Table:_wp_blog_versions|wp_blog_versions]] | ||
+ | | The current database version status of each '''site''' is maintained in the <tt>wp_blogs_versions</tt> table and is updated as each site is upgraded. || | ||
+ | * [[Super_Admin_Menu|Administration]] > [[Super_Admin_Menu#Update|Super Admin]] > [[Super Admin Update SubPanel|Update]] | ||
+ | |- valign="top" | ||
+ | ! [[#Table:_wp_registration_log|wp_registration_log]] | ||
+ | | The <tt>wp_registration_log</tt> records the admin user created when each new site is created. || | ||
+ | * [[Super_Admin_Menu|Administration]] > [[Super_Admin_Menu#Sites|Super Admin]] > [[Super Admin Sites SubPanel|Sites]] | ||
+ | |- valign="top" | ||
+ | ! [[#Table:_wp_signups|wp_signups]] | ||
+ | | This table holds the user that have registered for a site via the login registration process. User registration is enable in [[Super_Admin_Menu|Administration]] > [[Super_Admin_Menu#Options|Super Admin]] > [[Super Admin Options SubPanel|Options]]. || | ||
+ | * [[Administration Panels|Administration]] > [[Administration Panels#Settings|Settings]] > [[Settings General SubPanel|General]] | ||
+ | |- valign="top" | ||
+ | ! [[#Table:_wp_site|wp_site]] | ||
+ | | The <tt>wp_site</tt> table contains the main site address. || | ||
+ | * [[Super_Admin_Menu|Administration]] > [[Super_Admin_Menu#Tools|Tools]] > [[Tools Network SubPanel|Network]] | ||
+ | |- valign="top" | ||
+ | ! [[#Table:_wp_sitecategories|wp_sitecategories]] | ||
+ | | If global terms (global_terms_enabled = true) are enabled for a site the <tt>wp_sitecategories</tt> table holds those terms. || | ||
+ | * [[Super_Admin_Menu|Administration]] > [[Super_Admin_Menu#Options|Super Admin]] > [[Super Admin Options SubPanel|Options]] | ||
+ | * [[Administration Panels|Administration]] > [[Administration Panels#Add New Post|Posts]] > [[Posts Add New SubPanel|Add New]] | ||
+ | |- valign="top" | ||
+ | ! [[#Table:_wp_sitemeta|wp_sitemeta]] | ||
+ | | Each '''site''' features information called the '''site data''' and it is stored in <tt>wp_sitemeta</tt>. Various '''option''' information, including the site admin is kept in this table. || | ||
+ | * [[Super_Admin_Menu|Administration]] > [[Super_Admin_Menu#Options|Super Admin]] > [[Super Admin Options SubPanel|Options]] | ||
+ | |- valign="top" | ||
+ | ! [[#Table:_wp_users_2|wp_users]] | ||
+ | | The list of all '''users''' is maintained in table <tt>wp_users</tt>. Multisite add two fields not in [[#Table: wp_users|the stand-alone version]].|| | ||
+ | * [[Administration Panels|Administration]] > [[Administration Panels#Users|Users]] | ||
+ | * [[Super Admin Menu|Administration]] > [[Super Admin Menu#Super Admin|Super Admin]] > [[Super Admin Users SubPanel|Users]] | ||
+ | * [[Super Admin Menu|Administration]] > [[Super Admin Menu#Super Admin|Super Admin]] > [[Super Admin Sites SubPanel|Sites]] - Edit Site | ||
+ | |- valign="top" | ||
+ | ! [[#Table:_wp_usermeta|wp_usermeta]] | ||
+ | | This table is not re-create for multisite, but '''meta data of users''' for each site are stored in <tt>wp_usermeta</tt>. || | ||
+ | * [[Administration Panels|Administration]] > [[Administration Panels#Users|Users]] | ||
+ | * [[Super Admin Menu|Administration]] > [[Super Admin Menu#Super Admin|Super Admin]] > [[Super Admin Users SubPanel|Users]] | ||
+ | * [[Super Admin Menu|Administration]] > [[Super Admin Menu#Super Admin|Super Admin]] > [[Super Admin Sites SubPanel|Sites]] - Edit Site | ||
+ | |- valign="top" | ||
+ | ! [[#Site Specific Tables|Site Specific Tables]] | ||
+ | | The data of the main site are stored in existing unnumbered tables. The data of additional sites are stored in new numbered tables. | ||
+ | || | ||
+ | * [[Super_Admin_Menu|Administration]] > [[Super_Admin_Menu#Sites|Super Admin]] > [[Super Admin Sites SubPanel|Sites]] - Add Site | ||
+ | |}<br /><br /> | ||
+ | |||
+ | == マルチサイトテーブル詳細 <span id="Multisite_Table_Details"></span>== | ||
+ | |||
+ | The following describe the tables and fields created [[Create A Network#Step 4: Installing a Network|during the network installation]]. Note that a global set of tables is created upon creation of the network, and [[#Site Specific Tables|site-specific tables]] are established as each site is created. | ||
+ | |||
+ | ===Table: wp_blogs=== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Field!!Type!!Null!!Key!!Default!!Extra | ||
+ | |- | ||
+ | |blog_id||bigint(20) unsigned|| ||PRI||NULL||auto_increment | ||
+ | |- | ||
+ | |site_id||bigint(20) unsigned|| ||IND||0|| | ||
+ | |- | ||
+ | |domain||varchar(200)||NO|| ||0|| | ||
+ | |- | ||
+ | |path||varchar(100)||NO|| || || | ||
+ | |- | ||
+ | |registered||datetime||NO|| ||0000-00-00 00:00:00|| | ||
+ | |- | ||
+ | |last_updated||datetime||NO|| ||0000-00-00 00:00:00|| | ||
+ | |- | ||
+ | |public||tinyint(2)||NO|| ||0|| | ||
+ | |- | ||
+ | |archived||enum('0','1')||NO|| ||0|| | ||
+ | |- | ||
+ | |mature||tinyint(2)||NO|| ||0|| | ||
+ | |- | ||
+ | |spam||tinyint(2)||NO|| ||0|| | ||
+ | |- | ||
+ | |deleted||tinyint(2)||NO|| ||0|| | ||
+ | |- | ||
+ | |lang_id||int(11)||NO|| ||0|| | ||
+ | |} | ||
+ | |||
+ | ====Indexes==== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Keyname!!Type!!Cardinality!! Field | ||
+ | |- | ||
+ | |PRIMARY||PRIMARY||2||blog_id | ||
+ | |- | ||
+ | |domain||INDEX||none||domain(50),path(5) | ||
+ | |- | ||
+ | |lang_id||INDEX||none||lang_id | ||
+ | |} | ||
+ | |||
+ | ===Table: wp_blog_versions=== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Field!!Type!!Null!!Key!!Default!!Extra | ||
+ | |- | ||
+ | |blog_id||bigint(20) unsigned|| ||PRI||0||FK->wp_blogs.blog_id | ||
+ | |- | ||
+ | |db_version||varchar(20)||NO|| || || | ||
+ | |- | ||
+ | |last_updated||datetime||NO|| ||0000-00-00 00:00:00|| | ||
+ | |} | ||
+ | |||
+ | ====Indexes==== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Keyname!!Type!!Cardinality!! Field | ||
+ | |- | ||
+ | |PRIMARY||PRIMARY||2||blog_id | ||
+ | |- | ||
+ | |db_version||INDEX||none||db_version | ||
+ | |} | ||
+ | |||
+ | ===Table: wp_registration_log=== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Field!!Type!!Null!!Key!!Default!!Extra | ||
+ | |- | ||
+ | |ID||bigint(20) unsigned|| ||PRI||NULL||auto_increment | ||
+ | |- | ||
+ | |email||varchar(255)||NO|| || || | ||
+ | |- | ||
+ | |IP||varchar(30)||NO|| || || | ||
+ | |- | ||
+ | |blog_id||bigint(20) unsigned|| ||PRI||0||FK->wp_blogs.blog_id | ||
+ | |- | ||
+ | |date_registered||datetime||NO|| ||0000-00-00 00:00:00|| | ||
+ | |} | ||
+ | |||
+ | ====Indexes==== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Keyname!!Type!!Cardinality!! Field | ||
+ | |- | ||
+ | |PRIMARY||PRIMARY||1||ID | ||
+ | |- | ||
+ | |IP||INDEX||none||IP | ||
+ | |} | ||
+ | |||
+ | ===Table: wp_signups=== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Field!!Type!!Null!!Key!!Default!!Extra | ||
+ | |- | ||
+ | |domain||varchar(200)||NO|| ||0|| | ||
+ | |- | ||
+ | |path||varchar(100)||NO|| || || | ||
+ | |- | ||
+ | |title||longtext||NO|| || || | ||
+ | |- | ||
+ | |user_login||varchar(60)||NO||IND|| || | ||
+ | |- | ||
+ | |user_email||varchar(100)||NO|| || || | ||
+ | |- | ||
+ | |registered_date||datetime||NO|| ||0000-00-00 00:00:00|| | ||
+ | |- | ||
+ | |activated||datetime||NO|| ||0000-00-00 00:00:00|| | ||
+ | |- | ||
+ | |active||tinyint(1)||NO|| || || | ||
+ | |- | ||
+ | |activation_key||varchar(50)||NO|| || || | ||
+ | |- | ||
+ | |meta||longtext|| || || || | ||
+ | |} | ||
+ | |||
+ | ====Indexes==== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Keyname!!Type!!Cardinality!! Field | ||
+ | |- | ||
+ | |activation_key||INDEX||None||activation_key | ||
+ | |- | ||
+ | |domain||INDEX||None||domain | ||
+ | |} | ||
+ | |||
+ | ===Table: wp_site=== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Field!!Type!!Null!!Key!!Default!!Extra | ||
+ | |- | ||
+ | |id||bigint(20) unsigned|| ||PRI||NULL||auto_increment | ||
+ | |- | ||
+ | |domain||varchar(200)||NO|| ||0|| | ||
+ | |- | ||
+ | |path||varchar(100)||NO|| || || | ||
+ | |} | ||
+ | |||
+ | ====Indexes==== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Keyname!!Type!!Cardinality!! Field | ||
+ | |- | ||
+ | |PRIMARY||PRIMARY||1||id | ||
+ | |- | ||
+ | |domain||INDEX||none||domain,path | ||
+ | |} | ||
+ | |||
+ | ===Table: wp_sitecategories=== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Field!!Type!!Null!!Key!!Default!!Extra | ||
+ | |- | ||
+ | |cat_id||bigint(20) unsigned||NO||PRI||NULL||auto_increment | ||
+ | |- | ||
+ | |cat_name||carchar(55)||NO|| || || | ||
+ | |- | ||
+ | |category_nicename||varchar(200)||NO|| || || | ||
+ | |- | ||
+ | |last_updated||timestamp||NO|| || || | ||
+ | |} | ||
+ | |||
+ | ====Indexes==== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Keyname!!Type!!Cardinality!! Field | ||
+ | |- | ||
+ | |PRIMARY||PRIMARY||9||cat_id | ||
+ | |- | ||
+ | |category_nicename||INDEX||None||category_nicename | ||
+ | |- | ||
+ | |last_updated||INDEX||None||last_updated | ||
+ | |} | ||
+ | |||
+ | ===Table: wp_sitemeta=== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Field!!Type!!Null!!Key!!Default!!Extra | ||
+ | |- | ||
+ | |meta_id||bigint(20) unsigned|| ||PRI||NULL||auto_increment | ||
+ | |- | ||
+ | |site_id||bigint(20) unsigned|| || ||'0'||FK->wp_site.site_id | ||
+ | |- | ||
+ | |meta_key||varchar(255)||Yes||IND||NULL|| | ||
+ | |- | ||
+ | |meta_value||longtext||Yes||IND||NULL|| | ||
+ | |} | ||
+ | |||
+ | ====Indexes==== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Keyname!!Type!!Cardinality!! Field | ||
+ | |- | ||
+ | |PRIMARY||PRIMARY||9||meta_id | ||
+ | |- | ||
+ | |meta_key||INDEX||None||meta_key | ||
+ | |- | ||
+ | |site_id||INDEX||None||site_id | ||
+ | |} | ||
+ | |||
+ | ===Table: wp_users=== | ||
+ | |||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Field!!Type!!Null!!Key!!Default!!Extra | ||
+ | |- | ||
+ | |ID||bigint(20) unsigned|| ||PRI||NULL||auto_increment | ||
+ | |- | ||
+ | |user_login||varchar(60)|| ||IND|| || | ||
+ | |- | ||
+ | |user_pass||varchar(64)|| || || || | ||
+ | |- | ||
+ | |user_nicename||varchar(50)|| ||IND|| || | ||
+ | |- | ||
+ | |user_email||varchar(100)|| || || || | ||
+ | |- | ||
+ | |user_url||varchar(100)|| || || || | ||
+ | |- | ||
+ | |user_registered||datetime|| || ||0000-00-00 00:00:00|| | ||
+ | |- | ||
+ | |user_activation_key||varchar(60)|| || || || | ||
+ | |- | ||
+ | |user_status||int(11)|| || ||0|| | ||
+ | |- | ||
+ | |display_name||varchar(250)|| || || || | ||
+ | |- | ||
+ | |spam||tinyint(2)||NO|| || 0 || | ||
+ | |- | ||
+ | |deleted||tinyint(2)||NO|| || 0 || | ||
+ | |} | ||
+ | |||
+ | ====Indexes==== | ||
+ | {| class="widefat" | ||
+ | |- style="background:#464646; color:#d7d7d7;" | ||
+ | !Keyname!!Type!!Cardinality!! Field | ||
+ | |- | ||
+ | |PRIMARY||PRIMARY||1||ID | ||
+ | |- | ||
+ | |user_login_key||INDEX||None||user_login | ||
+ | |- | ||
+ | |user_nicename||INDEX||None||user_nicename | ||
+ | |} | ||
+ | |||
+ | === 個別サイトテーブル <span id="Site_Specific_Tables"></span>=== | ||
+ | When a new additional site is created, the site-specific tables, similar to [[#Table Overview|the stand-alone tables above]], are created. Each set of tables for a site are created with the site ID ([[#Table: wp_blogs|<code>blog_id</code>]]) as part of the table name. These are the tables that would be created for site ID ''2'' and [[Editing wp-config.php#table_prefix|table_prefix]] ''wp'': | ||
+ | * [[#Table: wp_commentmeta|''wp_2''_commentmeta]] | ||
+ | * [[#Table: wp_comments|''wp_2''_comments]] | ||
+ | * [[#Table: wp_links|''wp_2''_links]] | ||
+ | * [[#Table: wp_options|''wp_2''_options]] | ||
+ | * [[#Table: wp_postmeta|''wp_2''_postmeta]] | ||
+ | * [[#Table: wp_posts|''wp_2''_posts]] | ||
+ | * [[#Table: wp_terms|''wp_2''_terms]] | ||
+ | * [[#Table: wp_term_relationships|''wp_2''_term_relationships]] | ||
+ | * [[#Table: wp_term_taxonomy|''wp_2''_term_taxonomy]] | ||
+ | |||
+ | The data of the main site are stored in unnumbered tables. | ||
+ | |||
+ | == 資料 <span id="Resources"></span>== | ||
+ | |||
+ | * [[WordPress Backups]] - performing backups | ||
+ | * [http://wordpress.org/extend/plugins/tags/backup backup related plugins] - plugins with backup tag | ||
+ | * [http://wordpress.org/extend/plugins/tags/database database related plugins] - plugins with database tag | ||
== 旧バージョンのデータベース概要 == | == 旧バージョンのデータベース概要 == | ||
− | <-- 旧バージョンのページは、今のところ、英語版のように別ページは作成せず wikiの過去版を利用しています。編集する必要があるときは、そのバージョン用にサブページを作成した上で編集してください。 --> | + | <!-- 旧バージョンのページは、今のところ、英語版のように別ページは作成せず wikiの過去版を利用しています。編集する必要があるときは、そのバージョン用にサブページを作成した上で編集してください。 --> |
+ | * [{{fullurl:データベース概要 |oldid=3268}} WordPress '''2.9.x''' データベース概要](2010年2月17日版・編集不可) | ||
* [{{fullurl:データベース概要 |oldid=2771}} WordPress '''2.8.x''' データベース概要](2009年11月7日版・編集不可) | * [{{fullurl:データベース概要 |oldid=2771}} WordPress '''2.8.x''' データベース概要](2009年11月7日版・編集不可) | ||
* [{{fullurl:データベース概要 |oldid=2510}} WordPress '''2.7.x''' データベース概要](2009年5月28日版・編集不可) | * [{{fullurl:データベース概要 |oldid=2510}} WordPress '''2.7.x''' データベース概要](2009年5月28日版・編集不可) | ||
553行目: | 886行目: | ||
== 変更履歴 == | == 変更履歴 == | ||
+ | |||
+ | * [[Version 3.0|3.0]] : | ||
+ | ** [[#Table: wp_comments|comments table]]: <code>comment_parent</code> キーが追加されました。 | ||
+ | ** [[#Table: wp_posts|posts table]]: <code>post_author</code> キーが追加されました。 | ||
+ | ** [[Glossary#Multisite|マルチサイト]]機能を有効にすると、 | ||
+ | *** [[#Multisite Table Overview|マルチサイト関連テーブル]]が追加されます。 | ||
+ | *** [[#Table:_wp_users_2|users テーブル]]に <code>spam</code> フィールドと <code>deleted</code> フィールドが追加されます。 | ||
* [[Version 2.9|2.9]] : | * [[Version 2.9|2.9]] : | ||
** [[#Table: wp_commentmeta|commentmeta テーブル]]: コメントに関するメタデータを格納する新規テーブル | ** [[#Table: wp_commentmeta|commentmeta テーブル]]: コメントに関するメタデータを格納する新規テーブル | ||
− | ** [[#Table: wp_option|options テーブル]]: <code>option_name</code> キーが UNIQUE となりました。 | + | ** [[#Table: wp_option|options テーブル]]: <code>option_name</code> キーが UNIQUE となりました。<!-- Added Index <code>option_name</code> UNIQUE. --> |
+ | <!-- ** [http://schemabank.com/p/5Lj5F updated diagram] --> | ||
* [[Version 2.8|2.8]] : | * [[Version 2.8|2.8]] : | ||
593行目: | 934行目: | ||
** 参考: [[プラグインとテーマの 2.1 への移行#コア WordPress DB の変更点|プラグインとテーマの 2.1 への移行 - コア WordPress DB の変更点]] | ** 参考: [[プラグインとテーマの 2.1 への移行#コア WordPress DB の変更点|プラグインとテーマの 2.1 への移行 - コア WordPress DB の変更点]] | ||
− | {{原文|Database Description| | + | {{原文|Database Description|91195}}<!-- 14:33, 12 July 2010 Bono 版 --> |
{{DEFAULTSORT:てえたへえすかいよう}} | {{DEFAULTSORT:てえたへえすかいよう}} | ||
599行目: | 940行目: | ||
[[Category:上級トピック]] | [[Category:上級トピック]] | ||
[[Category:WordPress の開発]] | [[Category:WordPress の開発]] | ||
+ | [[Category:データベース]]<!-- [[Category:WordPress Database]] --> | ||
+ | [[Category:ネットワーク]] | ||
[[Category:wp2.1]] | [[Category:wp2.1]] | ||
[[Category:wp2.3]] | [[Category:wp2.3]] | ||
606行目: | 949行目: | ||
[[Category:wp2.8]] | [[Category:wp2.8]] | ||
[[Category:wp2.9]] | [[Category:wp2.9]] | ||
+ | [[Category:wp3.0]] | ||
[[en:Database Description]] | [[en:Database Description]] | ||
+ | [[ar:وصف قاعدة البيانات]] | ||
+ | [[zh-hans:数据库描述]] |
2010年9月4日 (土) 05:02時点における版
このページ「データベース構造」は一部未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています。
画像募集中:
WordPress 5.3 のER図を作成できる人は、
ファイルをアップロードするか、提供できることをお知らせください。
目次
- 1 データベース関連図
- 2 テーブル一覧
- 3 テーブル詳細
- 4 マルチサイトテーブル一覧
- 5 マルチサイトテーブル詳細
- 6 資料
- 7 旧バージョンのデータベース概要
- 8 変更履歴
以下は、WordPress バージョン 3.0 の標準的なインストールで作成されるデータベース・テーブルの概要と説明です。現在、WordPress バージョン 3.0 が対応しているデータベースは、MySQL バージョン 4.1.2 以上のみです。
WordPressは内部でデータベースと連動しているため、エンドユーザはその構造を気にかける必要はありません。しかしプラグインを作成していると、WordPressが格納するデータやその関係について知りたいと思うかもしれません。If you have already attempted to use the existing WordPress API to access the data you need but have determined it's not possible without accessing the database directly, WordPressではこの処理が簡単にできるよう wpdb クラスを用意しています。
注:
- テーブル名の接頭辞(
wp_
)は、WordPress インストール時の設定によります。 - プラグインやテーマによって、設定データの追加、既存テーブルへのフィールド追加、新規テーブル作成がされることもあります。
- 旧バージョンのデータベース概要
データベース関連図
下図は、WordPress データベースの概要および標準インストール時に作成されるテーブル間の関係を視覚的に表したものです。また、テーブル一覧以降では、テーブルおよびカラムの詳細を掲載しています。
WP3.0 データベース関連図(ER図) /英語版で画像を見る
標準インストールでテーブル間の整合性は強制されない事に注意してください(例: 投稿とコメント)。もし WordPress データベースを操作するプラグインやその他の拡張機能を作成する場合は、ハウスキーピング処理をコードに含め、孤立したレコードがテーブルに残らないようにしましょう。この一例として、外部キーが削除された場合、一連の SQL コマンドを使って他のテーブルのレコードを削除するといったことが挙げられます。また、このような操作を行う前には、ユーザーにバックアップを取るよう促すことも忘れないでください。
テーブル一覧
WordPress の標準インストールで作成される全テーブルの一覧です。各テーブルが持つ具体的な情報は次節をご覧ください。
WordPress 3.0 テーブル (11) | ||
---|---|---|
テーブル名 | 説明 | 関連インタフェース画面 |
wp_commentmeta | Each comment features information called the meta data and it is stored in the wp_commentmeta. | Typically plugins would be add their own information to this table. |
wp_comments | WordPress へのコメント・トラックバック・ピンバックデータを格納 | コメントは投稿記事への反応として読者によって作成される。管理者によるコメント管理は 管理パネル > コメント > コメントにて |
wp_links | リンク作成機能で入力されたリンク情報を格納 | |
wp_options | 管理 > 設定パネルで設定されたオプション設定情報を格納(オプション設定リファレンス参照)。プラグインの設定情報が格納されることも多い。 | |
wp_postmeta | メタデータという各投稿記事特有の情報を格納。カスタムフィールドとして使用するほか、各投稿に情報や設定を付加するようなプラグインが、その情報を当テーブルに追加することがある。 |
(カスタムフィールド) |
wp_posts | WordPress データの核である投稿記事のほか、ページ、ナビゲーションメニューのデータを格納 | |
wp_terms | 投稿およびリンクの分類(カテゴリ・タグ)に使われる語句の基本情報を格納 | |
wp_term_relationships | オブジェクト(wp_posts テーブルの各投稿記事、wp_links テーブル内の各リンク)と wp_term_taxonomy の(少なくとも 1)カテゴリ・タグとの関連付け情報を格納
| |
wp_term_taxonomy | 投稿およびリンクの分類上の語句(カテゴリ・タグ)データを格納 | |
wp_usermeta | 各ユーザ特有のユーザ・メタデータを格納 | |
wp_users | 登録ユーザ情報を格納 |
テーブル詳細
WordPress の標準インストールで作成される各テーブルの項目一覧です。
テーブル: wp_commentmeta
フィールド | 種別 | Null | キー | 初期値 | 備考 | 説明 |
---|---|---|---|---|---|---|
meta_id | bigint(20) unsigned | PRI | NULL | auto_increment | コメントメタID(登録順に自動採番) | |
comment_id | bigint(20) unsigned | IND | 0 | FK->wp_comments.comment_id | コメントID | |
meta_key | varchar(255) | YES | IND | NULL | ||
meta_value | longtext | YES | NULL |
インデックス
キー名 | 種別 | 一意な値の数 | フィールド |
---|---|---|---|
PRIMARY | PRIMARY | 0 | meta_ID |
comment_id | INDEX | none | comment_id |
meta_key | INDEX | none | meta_key |
テーブル: wp_comments
フィールド | 種別 | Null | キー | 初期値 | 備考 | 説明 |
---|---|---|---|---|---|---|
comment_ID | bigint(20) unsigned | PRI | NULL | auto_increment | コメントID(投稿順に自動採番) | |
comment_post_ID | bigint(20) unsigned | IND | 0 | FK->wp_posts.ID | コメントが属する投稿ID | |
comment_author | tinytext | コメント投稿者 | ||||
comment_author_email | varchar(100) | コメント投稿者の Eメールアドレス | ||||
comment_author_url | varchar(200) | コメント投稿者のウェブサイトURL | ||||
comment_author_IP | varchar(100) | コメント投稿者の IPアドレス | ||||
comment_date | datetime | 0000-00-00 00:00:00 | コメント投稿日時 | |||
comment_date_gmt | datetime | IND & IND Pt2 | 0000-00-00 00:00:00 | コメント投稿日時(GMT) | ||
comment_content | text | コメント内容 | ||||
comment_karma | int(11) | 0 | ||||
comment_approved | varchar(20) | IND & Ind Pt1 | 1 | コメントの承認状態
| ||
comment_agent | varchar(255) | コメント投稿者のユーザエージェント | ||||
comment_type | varchar(20) | コメントの種類
| ||||
comment_parent | bigint(20) unsigned | 0 | FK->wp_comments.ID | |||
user_id | bigint(20) unsigned | 0 | FK->wp_users.ID | コメント投稿者が登録ユーザであるとき、そのユーザID |
インデックス
キー名 | 種別 | 一意な値の数 | フィールド |
---|---|---|---|
PRIMARY | PRIMARY | 1 | comment_ID |
comment_approved | INDEX | None | comment_approved |
comment_post_ID | INDEX | None | comment_post_ID |
comment_approved_date_gmt | INDEX | None | comment_approved comment_date_gmt |
comment_date_gmt | INDEX | None | comment_date_gmt |
comment_parent | INDEX | None | comment_parent |
テーブル: wp_links
フィールド | 種別 | Null | キー | 初期値 | 備考 | 説明 |
---|---|---|---|---|---|---|
link_id | bigint(20) unsigned | PRI | NULL | auto_increment | リンクID(登録順に自動採番) | |
link_url | varchar(255) | リンク URL | ||||
link_name | varchar(255) | リンク名 | ||||
link_image | varchar(255) | リンク画像の URI | ||||
link_target | varchar(25) | リンクターゲット | ||||
link_description | varchar(255) | 説明 | ||||
link_visible | varchar(20) | IND | Y |
| ||
link_owner | bigint(20) unsigned | 1 | ||||
link_rating | int(11) | 0 | 評価 | |||
link_updated | datetime | 0000-00-00 00:00:00 | ||||
link_rel | varchar(255) | |||||
link_notes | mediumtext | メモ | ||||
link_rss | varchar(255) | リンクのフィード URI |
インデックス
キー名 | 種別 | 一意な値の数 | フィールド |
---|---|---|---|
PRIMARY | PRIMARY | 7 | link_ID |
link_category | INDEX | None | link_category |
link_visible | INDEX | None | link_visible |
テーブル: wp_options
フィールド | 種別 | Null | キー | 初期値 | 備考 | 説明 |
---|---|---|---|---|---|---|
option_id | bigint(20) unsigned | PRI Pt1 | NULL | auto_increment | オプションID(登録順に自動採番) | |
blog_id | int(11) | PRI Pt2 | 0 | |||
option_name | varchar(64) | PRI Pt3 & IND | オプション名(オプション設定リファレンス参照) | |||
option_value | longtext | オプション値 | ||||
autoload | varchar(20) | yes |
|
インデックス
キー名 | 種別 | 一意な値の数 | フィールド |
---|---|---|---|
PRIMARY | PRIMARY | 184 | option_id blog_id option_name |
option_name | UNIQUE | 184 | option_name |
テーブル: wp_postmeta
フィールド | 種別 | Null | キー | 初期値 | 備考 | 説明 |
---|---|---|---|---|---|---|
meta_id | bigint(20) unsigned | PRI | NULL | auto_increment | メタID(一意)(登録順に自動採番) | |
post_id | bigint(20) unsigned | IND | 0 | FK->wp_posts.ID | 投稿ID | |
meta_key | varchar(255) | YES | IND | NULL | カスタムフィールドのキー名 | |
meta_value | longtext | YES | NULL | カスタムフィールドの値 |
インデックス
キー名 | 種別 | 一意な値の数 | フィールド |
---|---|---|---|
PRIMARY | PRIMARY | 13 | meta_ID |
post_id | INDEX | 15 | post_id |
meta_key | INDEX | 7 | meta_key |
テーブル: wp_posts
フィールド | 種別 | Null | キー | 初期値 | 備考 | 説明 |
---|---|---|---|---|---|---|
ID | bigint(20) unsigned | PRI & IND Pt4 | auto_increment | 投稿ID(保存順に自動採番) | ||
post_author | bigint(20) unsigned | 0 | FK->wp_users.ID | 投稿者のユーザID | ||
post_date | datetime | IND Pt3 | 0000-00-00 00:00:00 | 投稿日時 | ||
post_date_gmt | datetime | 0000-00-00 00:00:00 | 投稿日時(GMT) | |||
post_content | longtext | 本文 | ||||
post_title | text | タイトル | ||||
post_excerpt | text | 抜粋オプション | ||||
post_status | varchar(20) | IND PT2 | publish | 投稿ステータス
| ||
comment_status | varchar(20) | open | コメントステータス
| |||
ping_status | varchar(20) | open | ピン・ステータス
| |||
post_password | varchar(20) | 閲覧パスワード | ||||
post_name | varchar(200) | IND |
| |||
to_ping | text | |||||
pinged | text | ピン通知済み URL | ||||
post_modified | datetime | 0000-00-00 00:00:00 | 更新日時 | |||
post_modified_gmt | datetime | 0000-00-00 00:00:00 | 更新日時(GMT) | |||
post_content_filtered | text | |||||
post_parent | bigint(20) unsigned | 0 | FK->wp_posts.ID | 親ID
| ||
guid | varchar(255) | |||||
menu_order | int(11) | 0 | ページの表示順 | |||
post_type | varchar(20) | IND Pt1 | post | 投稿種別
| ||
post_mime_type | varchar(100) | 添付ファイルのとき MIMEタイプ(image/png など)
| ||||
comment_count | bigint(20) | 0 | コメント数 |
インデックス
キー名 | 種別 | Cardinality | フィールド |
---|---|---|---|
PRIMARY | PRIMARY | 2 | ID |
post_name | INDEX | None | post_name |
type_status_date | INDEX | None | post_type post_status post_date ID |
post_parent | INDEX | None | post_parent |
post_author | INDEX | None | post_author |
テーブル: wp_terms
フィールド | 種別 | Null | キー | 初期値 | 備考 | 説明 |
---|---|---|---|---|---|---|
term_id | bigint(20) unsigned | PRI | auto_increment | term のユニークID | ||
name | varchar(200) | term 名 | ||||
slug | varchar(200) | UNI | term スラッグ。term 名を URL で扱いやすい形にしたもの | |||
term_group | bigint(10) | 0 | 類義語のグルーピング |
インデックス
キー名 | 種別 | 一意な値の数 | フィールド |
---|---|---|---|
PRIMARY | PRIMARY | 2 | term_ID |
slug | UNIQUE | 2 | slug |
name | Index | none | name |
テーブル: wp_term_relationships
フィールド | 種別 | Null | キー | 初期値 | 備考 | 説明 |
---|---|---|---|---|---|---|
object_id | bigint(20) unsigned | PRI Pt1 | 0 | 記事ID or リンクID | ||
term_taxonomy_id | bigint(20) unsigned | PRI Pt2 & IND | 0 | FK->wp_term_taxonomy.term_taxonomy_id | term_taxonomy テーブルの term_taxonomy_id
| |
term_order | int(11) | 0 |
インデックス
キー名 | 種別 | 一意な値の数 | フィールド |
---|---|---|---|
PRIMARY | PRIMARY | 8 | object_id term_taxonomy_id |
term_taxonomy_id | INDEX | None | term_taxonomy_id |
テーブル: wp_term_taxonomy
フィールド | 種別 | Null | キー | 初期値 | 備考 | 説明 |
---|---|---|---|---|---|---|
term_taxonomy_id | bigint(20) unsigned | PRI | auto_increment | term+taxonomy ペアのユニークID | ||
term_id | bigint(20) unsigned | UNI Pt1 | 0 | FK->wp_terms.term_id | wp_terms テーブルの term_id
| |
taxonomy | varchar(32) | UNI Pt2 | term が属する taxonomy
| |||
description | longtext | term の分類上の説明。「カテゴリ説明」など | ||||
parent | bigint(20) unsigned | 0 | 分類上の term 間の上下関係 | |||
count | bigint(20) | 0 | term+taxonomy ペアに関連付けられたオブジェクト数。taxonomy='category' であればこのカテゴリに属する投稿記事数 |
インデックス
キー名 | 種別 | 一意な値の数 | フィールド |
---|---|---|---|
PRIMARY | PRIMARY | 2 | term_taxonomy_id |
term_id_taxonomy | UNIQUE | 2 | term_id taxonomy |
taxonomy | INDEX | None | taxonomy |
テーブル: wp_usermeta
フィールド | 種別 | Null | キー | 初期値 | 備考 | 説明 |
---|---|---|---|---|---|---|
umeta_id | bigint(20) unsigned | PRI | NULL | auto_increment | ユーザ・メタデータの ID(登録順に自動採番) | |
user_id | bigint(20) unsigned | IND | '0' | FK->wp_users.ID | wp_users テーブルのユーザID | |
meta_key | varchar(255) | YES | IND | NULL | ユーザ・メタデータのキー名(wp_capabilities など)
| |
meta_value | longtext | YES | NULL | 値 |
インデックス
キー名 | 種別 | 一意な値の数 | フィールド |
---|---|---|---|
PRIMARY | PRIMARY | 9 | umeta_id |
user_id | INDEX | None | user_id |
meta_key | INDEX | None | meta_key |
テーブル: wp_users
フィールド | 種別 | Null | キー | 初期値 | 備考 | 説明 |
---|---|---|---|---|---|---|
ID | bigint(20) unsigned | PRI | NULL | auto_increment | ユーザID | |
user_login | varchar(60) | IND | ログイン名 | |||
user_pass | varchar(64) | パスワード(暗号化) | ||||
user_nicename | varchar(50) | IND | ||||
user_email | varchar(100) | Eメールアドレス | ||||
user_url | varchar(100) | webサイト URI | ||||
user_registered | datetime | 0000-00-00 00:00:00 | 登録日時 | |||
user_level | int(2) unsigned | 0 | ||||
user_activation_key | varchar(60) | |||||
user_status | int(11) | 0 | ||||
display_name | varchar(250) | 表示名 |
インデックス
キー名 | 種別 | 一意な値の数 | フィールド |
---|---|---|---|
PRIMARY | PRIMARY | 1 | ID |
user_login_key | INDEX | None | user_login |
user_nicename | INDEX | None | user_nicename |
マルチサイトテーブル一覧
This section is the overview of the tables created for use with the Multisite feature of WordPress. These tables are created via the processes under Administration > Tools > Network.
These tables are considered the multisite global tables.
This section is the overview of the tables created for use with the Multisite feature of WordPress. These tables are created via the processes under Administration > Tools > Network.
These tables are considered the multisite global tables.
WordPress 3.0 Multisite Tables | ||
---|---|---|
Table Name | Description | Relevant Area(s) of WordPress User Interface |
wp_blogs | Each site created is stored in the table, wp_blogs. | |
wp_blog_versions | The current database version status of each site is maintained in the wp_blogs_versions table and is updated as each site is upgraded. | |
wp_registration_log | The wp_registration_log records the admin user created when each new site is created. | |
wp_signups | This table holds the user that have registered for a site via the login registration process. User registration is enable in Administration > Super Admin > Options. | |
wp_site | The wp_site table contains the main site address. | |
wp_sitecategories | If global terms (global_terms_enabled = true) are enabled for a site the wp_sitecategories table holds those terms. | |
wp_sitemeta | Each site features information called the site data and it is stored in wp_sitemeta. Various option information, including the site admin is kept in this table. | |
wp_users | The list of all users is maintained in table wp_users. Multisite add two fields not in the stand-alone version. |
|
wp_usermeta | This table is not re-create for multisite, but meta data of users for each site are stored in wp_usermeta. |
|
Site Specific Tables | The data of the main site are stored in existing unnumbered tables. The data of additional sites are stored in new numbered tables. |
|
マルチサイトテーブル詳細
The following describe the tables and fields created during the network installation. Note that a global set of tables is created upon creation of the network, and site-specific tables are established as each site is created.
Table: wp_blogs
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
blog_id | bigint(20) unsigned | PRI | NULL | auto_increment | |
site_id | bigint(20) unsigned | IND | 0 | ||
domain | varchar(200) | NO | 0 | ||
path | varchar(100) | NO | |||
registered | datetime | NO | 0000-00-00 00:00:00 | ||
last_updated | datetime | NO | 0000-00-00 00:00:00 | ||
public | tinyint(2) | NO | 0 | ||
archived | enum('0','1') | NO | 0 | ||
mature | tinyint(2) | NO | 0 | ||
spam | tinyint(2) | NO | 0 | ||
deleted | tinyint(2) | NO | 0 | ||
lang_id | int(11) | NO | 0 |
Indexes
Keyname | Type | Cardinality | Field |
---|---|---|---|
PRIMARY | PRIMARY | 2 | blog_id |
domain | INDEX | none | domain(50),path(5) |
lang_id | INDEX | none | lang_id |
Table: wp_blog_versions
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
blog_id | bigint(20) unsigned | PRI | 0 | FK->wp_blogs.blog_id | |
db_version | varchar(20) | NO | |||
last_updated | datetime | NO | 0000-00-00 00:00:00 |
Indexes
Keyname | Type | Cardinality | Field |
---|---|---|---|
PRIMARY | PRIMARY | 2 | blog_id |
db_version | INDEX | none | db_version |
Table: wp_registration_log
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
ID | bigint(20) unsigned | PRI | NULL | auto_increment | |
varchar(255) | NO | ||||
IP | varchar(30) | NO | |||
blog_id | bigint(20) unsigned | PRI | 0 | FK->wp_blogs.blog_id | |
date_registered | datetime | NO | 0000-00-00 00:00:00 |
Indexes
Keyname | Type | Cardinality | Field |
---|---|---|---|
PRIMARY | PRIMARY | 1 | ID |
IP | INDEX | none | IP |
Table: wp_signups
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
domain | varchar(200) | NO | 0 | ||
path | varchar(100) | NO | |||
title | longtext | NO | |||
user_login | varchar(60) | NO | IND | ||
user_email | varchar(100) | NO | |||
registered_date | datetime | NO | 0000-00-00 00:00:00 | ||
activated | datetime | NO | 0000-00-00 00:00:00 | ||
active | tinyint(1) | NO | |||
activation_key | varchar(50) | NO | |||
meta | longtext |
Indexes
Keyname | Type | Cardinality | Field |
---|---|---|---|
activation_key | INDEX | None | activation_key |
domain | INDEX | None | domain |
Table: wp_site
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
id | bigint(20) unsigned | PRI | NULL | auto_increment | |
domain | varchar(200) | NO | 0 | ||
path | varchar(100) | NO |
Indexes
Keyname | Type | Cardinality | Field |
---|---|---|---|
PRIMARY | PRIMARY | 1 | id |
domain | INDEX | none | domain,path |
Table: wp_sitecategories
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
cat_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
cat_name | carchar(55) | NO | |||
category_nicename | varchar(200) | NO | |||
last_updated | timestamp | NO |
Indexes
Keyname | Type | Cardinality | Field |
---|---|---|---|
PRIMARY | PRIMARY | 9 | cat_id |
category_nicename | INDEX | None | category_nicename |
last_updated | INDEX | None | last_updated |
Table: wp_sitemeta
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
meta_id | bigint(20) unsigned | PRI | NULL | auto_increment | |
site_id | bigint(20) unsigned | '0' | FK->wp_site.site_id | ||
meta_key | varchar(255) | Yes | IND | NULL | |
meta_value | longtext | Yes | IND | NULL |
Indexes
Keyname | Type | Cardinality | Field |
---|---|---|---|
PRIMARY | PRIMARY | 9 | meta_id |
meta_key | INDEX | None | meta_key |
site_id | INDEX | None | site_id |
Table: wp_users
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
ID | bigint(20) unsigned | PRI | NULL | auto_increment | |
user_login | varchar(60) | IND | |||
user_pass | varchar(64) | ||||
user_nicename | varchar(50) | IND | |||
user_email | varchar(100) | ||||
user_url | varchar(100) | ||||
user_registered | datetime | 0000-00-00 00:00:00 | |||
user_activation_key | varchar(60) | ||||
user_status | int(11) | 0 | |||
display_name | varchar(250) | ||||
spam | tinyint(2) | NO | 0 | ||
deleted | tinyint(2) | NO | 0 |
Indexes
Keyname | Type | Cardinality | Field |
---|---|---|---|
PRIMARY | PRIMARY | 1 | ID |
user_login_key | INDEX | None | user_login |
user_nicename | INDEX | None | user_nicename |
個別サイトテーブル
When a new additional site is created, the site-specific tables, similar to the stand-alone tables above, are created. Each set of tables for a site are created with the site ID (blog_id
) as part of the table name. These are the tables that would be created for site ID 2 and table_prefix wp:
- wp_2_commentmeta
- wp_2_comments
- wp_2_links
- wp_2_options
- wp_2_postmeta
- wp_2_posts
- wp_2_terms
- wp_2_term_relationships
- wp_2_term_taxonomy
The data of the main site are stored in unnumbered tables.
資料
- WordPress Backups - performing backups
- backup related plugins - plugins with backup tag
- database related plugins - plugins with database tag
旧バージョンのデータベース概要
- WordPress 2.9.x データベース概要(2010年2月17日版・編集不可)
- WordPress 2.8.x データベース概要(2009年11月7日版・編集不可)
- WordPress 2.7.x データベース概要(2009年5月28日版・編集不可)
- WordPress 2.5.x データベース概要(2008年11月25日版・編集不可)
- WordPress 2.3.x データベース概要(2008年5月14日版・編集不可)
- 最新データベースとの違い(差分表示)
- WordPress 2.1~2.2.x データベース概要(2007年9月28日版・編集不可)
- 最新データベースとの違い(差分表示)
- 2.3 との違い: 次の 3種類で確認できます。 変更履歴、2.2 最終版の(*)印、差分表示
- WordPress 2.0.x データベース概要(en)
変更履歴
- 3.0 :
- comments table:
comment_parent
キーが追加されました。 - posts table:
post_author
キーが追加されました。 - マルチサイト機能を有効にすると、
- マルチサイト関連テーブルが追加されます。
- users テーブルに
spam
フィールドとdeleted
フィールドが追加されます。
- comments table:
- 2.9 :
- commentmeta テーブル: コメントに関するメタデータを格納する新規テーブル
- options テーブル:
option_name
キーが UNIQUE となりました。
- 2.8 :
- comments テーブル:
comment_post_ID
フィールドがint(11)
からbigint(20) unsigned
へ変更されました。 - links テーブル:
-
link_category
フィールドが削除されました。 -
link_owner
フィールドがint(11)
からbigint(20) unsigned
へ変更されました。
-
- posts テーブル:
-
post_category
フィールドが削除されました。 - 草稿データにも
post_date
を格納するようになりました。
-
- term_taxonomy テーブル: KEY に
taxonomy
が追加されました。 - ほとんどの
bigint(20)
フィールドにunsigned
属性が追加されました。
(commentsテーブル)comment_parent
,user_id
, (linksテーブル)link_id
, (optionsテーブル)option_id
, (metaテーブル)meta_id
,post_id
, (postsテーブル)post_author
,post_parent
, (termsテーブル)term_id
, (term_relationshipsテーブル)object_id
,term_taxonomy_id
, (term_taxonomyテーブル)term_taxonomy_id
,term_id
,parent
, (usermetaテーブル)umeta_id
,user_id
- comments テーブル:
- 2.7 :
- terms テーブルの
name
フィールドがvarchar(55)
→varchar(200)
になりました。 - terms テーブルの KEY に
name
が追加されました。 - posts テーブルの KEY に
post_parent
が追加されました。
- terms テーブルの
- 2.6 : 投稿の改訂履歴データを持つようになりました。
- 2.5 :
- 全ての
enum
タイプのフィールドがvarchar(20)
に変更されました。- comments テーブル:
comment_approved
フィールド - links テーブル:
link_visible
フィールド - options テーブル:
autoload
フィールド - posts テーブル:
post_status
、comment_status
、ping_status
フィールド
- comments テーブル:
- comments テーブルに KEY が追加されました。(
comment_approved_date_gmt
、comment_date_gmt
) - term_relationships テーブルに
term_order
フィールドが追加されました。 - 参考: プラグインとテーマの移行 - 2.3 から 2.5 への移行 - データベースの変更
- 全ての
- 2.3 :
-
categories
、link2cat
、post2cat
テーブル廃止、terms
、term_taxonomy
、term_relationships
テーブル追加。 - options テーブルより 6フィールド削除。(
option_can_override
,option_type
,option_width
,option_height
,option_description
,option_admin_level
) - posts テーブルの
post_status
フィールドに新規ステータス'pending'
を追加。 - 参考: プラグインとテーマの移行 - 2.2 から 2.3 への移行
-
- 2.1 :
-
linkcategories
テーブル廃止。リンクカテゴリデータをcategories
テーブルにマージ、ID付け替え。 - posts テーブルに
post_type
フィールドを追加。記事/ページを判別。2.0.x では、「ページ」=post_status
フィールドが'static'
。 - posts テーブルの
post_status
フィールドに、予約投稿(未来日投稿)を示す'future'
を追加。2.0.x ではNOW()
を使用。 - 参考: プラグインとテーマの 2.1 への移行 - コア WordPress DB の変更点
-