LoginSignup
28
34

More than 3 years have passed since last update.

Visual Studio CodeでER図作成

Last updated at Posted at 2018-10-05

準備

Visual Studio Code

これはもちろん必須。

Graphviz

http://www.graphviz.org/
こちらからダウンロード。UML描画のために必要らしい。

PlantUML

拡張機能「PlantUML」をインストールする。

ER図の作成の仕方

拡張子「.puml」でファイルを作成して、中身を記述する。

sample
@startuml erdiagram
entity "app" {
    + app_id [PK]
    ==
    app_cd
    app_type
}

entity "app_detail" {
    + app_detail_id [PK]
    ==
    # app_id [FK(app.app_id)]
    app_cnt
}

app --o{ app_detail
@enduml

エンティティ

entity "entityA" {
    + id [PK]
    ==
    # element_id [FK(element,element_id)]
    valid_flg
    create_date
}

リレーション

  • 1:1
entityA ||--|| entityB
  • 1:0orN
entityC --o{ entityD
  • 1:0or1
entityC --o| entityD
  • 1:1orN
entityC --|{ entityD
  • N:N
entityC }--{ entityD

ラベルをつける

entity "entity_name"<ラベル> {

プレビュー

「Alt + D」でプレビュー表示できる。

出力

「Ctrl + Shift + P」で、「PlantUML:カーソル位置のダイアグラムをエクスポート」を選択。
形式を選択してエクスポートする。

リンク

28
34
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
34