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

閲覧: 6 回
最初の未読メッセージにスキップ

Kawahara, Shogo

未読、
2011/05/26 12:48:252011/05/26
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

未読、
2011/06/10 7:21:462011/06/10
To: op-opensoci...@googlegroups.com
木村です。

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

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

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

Shogo Kawahara

未読、
2011/06/19 2:52:192011/06/19
To: opOpenSocialPlugin Developers
川原です。

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

Kimura Youichi

未読、
2011/06/21 4:25:172011/06/21
To: op-opensoci...@googlegroups.com
木村です。

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

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

全員に返信
投稿者に返信
転送
新着メール 0 件