2014年7月10日木曜日

drupal 7 field 追加 テーブル名 フィールド名 table field

データベース上の値をクエリを使ってコンテンツに表示しようと思って、データベース上のテーブル名、フィールド名などを確認した。その時のメモ。

admin/config/people/accounts/fields
で、フィールドを追加した後、mysqlなどのデータベースに保存される時に作られるテーブル名など。

テーブル名は「field_data_field_ラベル名」
(ラベル名=フィールド名)

そのテーブルの中のフィールド、「field_ラベル名_*」は、フィールドタイプに何を何を使いたいのか、ウィジェットに何を選択するかによって「*」の所が変わってくる。データを保存するときのデータ型も変わってくる(データ型の違いを忘れると、sqlを実行したときにあっちとこっちの保存形式の違いからエラーが出ることがある。)。

field_ラベル名_tid------Taxonomyなどからセレクトリストを選んだとき、ここにタクソノミーのid。

field_ラベル名_value----Textなどを選んだときは、このfieldに自分の記入したテキストが入る。

その他のフィールドは、
例えば、フィールドentity_typeの値がuserで、フィールドentity_idが1であったときにはユーザーIDが1の人のプロフィールの値ということになる。

Taxonomy関係
テーブル
taxonomy_term_data
フィールド
tid----タームの通し番号
vid---VOCABULARY NAME毎につける番号
name---タームの名前
description---タームのdescription
format------format
weight------weight

テーブル
taxonomy_vocabulary
フィールド
vid
Primary Key: Unique vocabulary ID.
name
Name of the vocabulary.
machine_name
The vocabulary machine name.PC内部名(ボキャブラリー名を日本語で入れなければ大概、nameと同じに登録される)
description
Description of the vocabulary.
hierarchy
The type of hierarchy allowed within the vocabulary. (0 = disabled, 1 = single, 2 = multiple)
module
The module which created the vocabulary.
weight
The weight of this vocabulary in relation to other vocabularies.

テーブル名
taxonomy_term_hierarchy
タームの親と子の関係を表している。
フィールド名
tid
Primary Key: The taxonomy_term_data.tid of the term.
parent
Primary Key: The taxonomy_term_data.tid of the term’s parent. 0 indicates no parent


0 件のコメント:

コメントを投稿