ユーザーによって書かれたたくさんのpostを持つblogを考えます.
---
title: a Blog that was written by a User, and has many Posts
---
erDiagram
USER ||--o| BLOG: owner
BLOG ||--o{ POST : contains
CREATE TABLE users
(
id bigserial primary key ,
name text
);
CREATE TABLE blog
(
id bigserial primary key ,
blog_name text,
owner bigint NOT NULL,
FOREIGN KEY (owner) REFERENCES users(id)
);
CREATE TABLE post
(
id bigserial primary key ,
subject text,
content text,
blog_id bigint NOT NULL,
FOREIGN KEY (blog_id) REFERENCES blog(id)
);- 1 - 1 (1 - 0..1) の関係を表す場合に, 参照するModule(
Blog)にLink(Select)フィールドを配置し,参照先のModule(User)を設定します. - Link はモーダルから1レコードを選択します.(複数のフィールドを表示して,選択する場合に使用します.)
- SelectはSelectBoxから1レコード選択します.(名前等,1つのフィールドで選択する場合に使用します.)
画面では参照先のModuleを一覧から選択できるようになります.



