LoginSignup
0
0

PgAdmin4を使用してPostgreSQLのER図を作成する

Last updated at Posted at 2023-11-05

GUIのあるOSでDBを構築できれば、PgAdmin4を使用して簡単にER図を作成できます。


まずは、サンプルデータベースを構築します。

  • データベース作成
psql -U postgres -p 5432 -d postgres -c "CREATE DATABASE dvdrental TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'C' LC_CTYPE = 'C';"
pg_restore -U postgres -d dvdrental ./dvdrental.tar
pg_restore -U postgres -d dvdrental ./dvdrental.tar
パスワード:
  • PgAdmin4を起動します

  • PgAdmin4でリストアしたデータベースを選択し、「ERD For Database」を実行します
    1

  • グリッドに沿って、ER図が生成されます。レイアウトや色等は調整可能です。

  • 左上の絵のアイコンから画像ファイルとしてエクスポート可能です。
    2

  • 画像のエクスポート結果です。レイアウトは未調整なので見づらいかもしれません。
    Untitled

以上

0
0
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
0
0