Skip to content
/ scheman Public

A tool to write schema definition from connected database.

License

Notifications You must be signed in to change notification settings

maru44/scheman

Repository files navigation

scheman

License ActionsCI Go Report Card

Scheman is a tool to visualize tables schema or ERD of connected RDB.

Main purpose of this is accelerating working collaboration between engineers and non-engineers.

You can choose output destination from Notion, File or both of them.

Sample Images

Here is examples for output.

Notion

File

definition

https://github.com/maru44/scheman/blob/master/testdata/postgres/def.csv

ERD

https://github.com/maru44/scheman/blob/master/testdata/postgres/erd.md

Supported Databases

Database Test Confirmed
PostgreSQL 👌
MySQL 👌
MSSQL Server
SQLite3
CockroachDB

Supported Output Destination

Only Notion is supported as output destination now. But I am going to add output destination like spread-sheat.

Output Destination Test Confirmed
Notion 👌
File 👌

How to Use

Install this package and write settings for connection.

installation

go install github.com/maru44/scheman@v1.3.0

example for PostgreSQL - Notion)

go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql@v4.8.6 \
 && scheman psql --services notion --erd-outputs notion \
  --notion-token ${NOTION_TOKEN} --notion-page-id ${PSQL_NOTION_PAGE_ID}

If you want to overwrite your schema-definition tables or ERD, you have to set notion-table-index after this command done. This value is oututted in your command line.

example for MySQL - File with sqlboiler.toml)

go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-mysql@v4.8.6 \
 && scheman mysql -c sqlboiler.toml --def-file def.csv --erd-file erd.md

Generic config options

Name Defaults
config "scheman" if you use sqlboiler, you can use sqlboiler.toml(.yaml) with setting this "sqlboiler.toml(.yaml)"
services [ ] notion
erd-outputs [ ] notion
notion-page-id "" required if output destinations contain "notion"
notion-page-token "" required if output destinations contain "notion"
notion-table-index "" if you want to overwrite definition table, please fill this
def-file "" The file name. required if output destinations if you want to output tables schema to file
erd-file "" The file name. required if output destinations if you want to output ERD to file
disable-views false
attr-ignore [ ]

Database Driver Configuration

Settings for database you want to connect.

Name Required Postgres Default MySQL Default MSSQL Default
schema no "public" none "dbo"
dbname yes none none none
host yes none none none
port no 5432 3306 1433
user yes none none none
pass no none none none
sslmode no "require" "true" "true"
whitelist no [] [] []
blacklist no [] [] []

ref: https://github.com/volatiletech/sqlboiler#database-driver-configuration

thx

https://github.com/volatiletech/sqlboiler

https://github.com/dstotijn/go-notion