dockerを使ってテーブル構造がドキュメント化できるSchemaSpyを構築する
dockerを使ってテーブル構造がドキュメント化できるSchemaSpyを構築するまでの手順を記述してます。
環境
- OS Rocky Linux release 8.4 (Green Obsidian)
- docker 20.10.7
dockerインストール
SchemaSpy構築
dockerを使用すれば、簡単に「SchemaSpy」を構築することができます。
まずは、「SchemaSpy」で使用する設定ファイル「schemaspy.properties」を作成します。
ここではpostgresに接続するので「schemaspy.t=pgsql」としてます。
schemaspy.t=pgsql
schemaspy.host=xxx.xxx.xxx.xxxx
schemaspy.port=5432
schemaspy.db=sample
schemaspy.u=username
schemaspy.p=password
任意の場所にhtmlを生成するためのディレクトリを作成します。
mkdir html
ディレクトリ構成は以下のようになってます。
dockerを実行して、 「SchemaSpy」 を構築して使用します。
docker run -v "$PWD/html:/output" -v "$PWD/schemaspy.properties:/schemaspy.properties" schemaspy/schemaspy:latest
<出力結果>
Running Main-Class org.springframework.boot.loader.JarLauncher
With drivers:jtds-1.3.1.jar, mariadb-java-client-1.1.10.jar
mysql-connector-java-6.0.6.jar, postgresql-42.1.1.jre7.jar
____ _ ____
/ ___| ___| |__ ___ _ __ ___ __ _/ ___| _ __ _ _
\___ \ / __| '_ \ / _ \ '_ ` _ \ / _` \___ \| '_ \| | | |
___) | (__| | | | __/ | | | | | (_| |___) | |_) | |_| |
|____/ \___|_| |_|\___|_| |_| |_|\__,_|____/| .__/ \__, |
|_| |___/
6.1.0
SchemaSpy generates an HTML representation of a database schema's relationships.
SchemaSpy comes with ABSOLUTELY NO WARRANTY.
SchemaSpy is free software and can be redistributed under the conditions of LGPL version 3 or later.
http://www.gnu.org/licenses/
「html」ディレクトリ内に「html」が生成されます。
あとは、作成した「index.html」をブラウザから確認するとテーブル構成が生成されたことが確認できます。
-
前の記事
python PySimpleGUIでチェックボックスのデフォルトのチェック状態を設定する 2021.10.18
-
次の記事
PostgreSQL where句に配列を使用する 2021.10.18
コメントを書く