Application の構造変更提案 (1.4-stable)

1 view
Skip to first unread message

Kawahara, Shogo

unread,
May 26, 2011, 12:48:25 PM5/26/11
to op-opensoci...@googlegroups.com
次回安定版対応必須項目である、
Application の構造変更についての修正案の提案です。

Issue:
http://redmine.openpne.jp/issues/2107

変える理由として

・現状のモデルは Application に紐づく情報を拡張しにくい。
→ カスタマイズや将来対応で不利。

・カラム大杉
 → なんという多さ。しかも、 I18n ビヘイビア利用でよりカオスに。

すっきり拡張性のあるモデルにしたいです。

現状 (実際には以下で 2つのテーブルが作られます。)

Application:
actAs:
opActivityCascadingBehavior:
I18n:
fields: [title, title_url, description, directory_title,
screenshot, thumbnail, author, author_aboutme, author_affiliation,
author_email, author_photo, author_link, author_quote, settings,
views, version]
length: 5
actAs:
Timestampable:
columns:
member_id: { type: integer(4), notnull: false }
url: { type: string(128), notnull: true }
height: { type: integer, notnull: false }
scrolling: { type: boolean, notnull: true, default: false }
singleton: { type: boolean, notnull: true, default: true }
is_active: { type: boolean, notnull: true, default: true }
is_pc: { type: boolean, notnull: true, default: true }
is_mobile: { type: boolean, notnull: true, default: false }
links: { type: array }
consumer_key: { type: string(16), default: "", notnull: true }
consumer_secret: { type: string(32), default: "", notnull: true }
title: { type: string(128) }
title_url: { type: string(128) }
description: { type: string }
directory_title : { type: string(128) }
screenshot: { type: string(128) }
thumbnail : { type: string(128) }
author: { type: string(128) }
author_aboutme: { type: string }
author_affiliation : { type: string(128) }
author_email: { type: string(128) }
author_photo: { type: string(128) }
author_link: { type: string(128) }
author_quote: { type: string }
settings: { type: array }
views: { type: array }
relations:
AdditionalMember: { foreignAlias: AddedApplications, onDelete:
"SET NULL", class: Member, local: member_id, foreign: id }
Members: { foreignAlias: Applications, class: Member, refClass:
MemberApplication }

で、これを新しく以下のように変えたいです。

Application:
actAs:
opActivityCascadingBehavior:
Timestampable:
columns:
member_id: { type: integer(4), notnull: false }
url: { type: string(128), notnull: true }
is_active: { type: boolean, notnull: true, default: true }
is_pc: { type: boolean, notnull: true, default: true }
is_mobile: { type: boolean, notnull: true, default: false }
relations:
AdditionalMember: { foreignAlias: AddedApplications, onDelete:
"SET NULL", class: Member, local: member_id, foreign: id }
Members: { foreignAlias: Applications, class: Member, refClass:
MemberApplication }

ApplicationAttribute
columns:
application_id: { type: integer, notnull: true }
name: { type: string(255), notnull: true }
lang: { type: string(5) , notnull: true }
hash: { type: string(32), notnull: true }
value: { type: string }
relatinoship:
Application: { onDelete: CASCADE, foreignAlias: MemberApplication }

// 名前はこれで行くかまだ決定ではないです。

属性情報取得は今まで通りできるようにします。

問題点や改善点がありましたら指摘してください。

--
----------------------------------------------------------
Shogo Kawahara <kawa...@bucyou.net>
川原 翔吾

Kimura Youichi

unread,
Jun 10, 2011, 7:21:46 AM6/10/11
to op-opensoci...@googlegroups.com
木村です。

一ヶ所だけ疑問のある箇所があるのですが、ApplicationAttribute.hash は何の
用途に使用するカラムなのでしょうか?

// プラグインに限った話ではないですが、key-value風のテーブルが多い
OpenPNEはもはや“リレーショナル”データベースの概念に適合していないような
気がしています

--
Kimura Youichi <kim.u...@bucyou.net>
http://upsilo.net/~upsilon/

Shogo Kawahara

unread,
Jun 19, 2011, 2:52:19 AM6/19/11
to opOpenSocialPlugin Developers
川原です。

それぞれのカラムについてコメントをつけておくべきでしたね。
ApplicationAttribute.hash は、インデックス用に存在します。
nameとlang を結合して md5 ハッシュをとります。
(ここで、 hash をインデックス指定していないのは誤りです。
hash は UNIQUE インデックスです。)
> Kimura Youichi <kim.upsi...@bucyou.net>
> http://upsilo.net/~upsilon/

Kimura Youichi

unread,
Jun 21, 2011, 4:25:17 AM6/21/11
to op-opensoci...@googlegroups.com
木村です。

ApplicationAttribute.hash カラムの用途について、理解しました。ありがとう
ございます。
僕は今のところ他に疑問点はなく、スキーマ変更について特に異議はありません。

--
Kimura Youichi <kim.u...@bucyou.net>
http://upsilo.net/~upsilon/

Reply all
Reply to author
Forward
0 new messages