diff --git a/Makefile b/Makefile index c3ab108b6..22b8cb226 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,7 @@ doc: build doc_sqlite ./tbls doc my://root:mypass@localhost:33306/testdb -c testdata/test_tbls.yml -t svg -f sample/svg ./tbls doc my://root:mypass@localhost:33306/testdb -c testdata/exclude_test_tbls.yml -f sample/exclude ./tbls doc my://root:mypass@localhost:33306/testdb -c testdata/dict_test_tbls.yml -f sample/dict + ./tbls doc my://root:mypass@localhost:33306/testdb -c testdata/font_test_tbls.yml -f sample/font doc_sqlite: ./tbls doc sq://$(PWD)/testdata/testdb.sqlite3 -c testdata/test_tbls.yml -f sample/sqlite @@ -61,6 +62,7 @@ testdoc: testdoc_sqlite ./tbls diff my://root:mypass@localhost:33306/testdb -c testdata/test_tbls.yml -t svg sample/svg ./tbls diff my://root:mypass@localhost:33306/testdb -c testdata/exclude_test_tbls.yml sample/exclude ./tbls diff my://root:mypass@localhost:33306/testdb -c testdata/dict_test_tbls.yml sample/dict + ./tbls diff my://root:mypass@localhost:33306/testdb -c testdata/font_test_tbls.yml sample/font testdoc_sqlite: ./tbls diff sq://$(PWD)/testdata/testdb.sqlite3 -c testdata/test_tbls.yml sample/sqlite diff --git a/README.md b/README.md index fed5de5b0..dd1ca3763 100644 --- a/README.md +++ b/README.md @@ -522,7 +522,7 @@ er: # Skip generation of ER diagram # Default is false skip: false - # ER diagram format + # ER diagram image format # Default is `png` format: svg # Add table/column comment to ER diagram @@ -531,6 +531,9 @@ er: # Distance between tables that display relations in the ER # Default is 1 distance: 2 + # ER diagram font (font name, font file, font path or keyword) + # Default is "" ( system default ) + font: M+ ``` ### Lint diff --git a/config/config.go b/config/config.go index 033d11959..fad0d3a9a 100644 --- a/config/config.go +++ b/config/config.go @@ -66,6 +66,7 @@ type ER struct { Format string `yaml:"format,omitempty"` Comment bool `yaml:"comment,omitempty"` Distance *int `yaml:"distance,omitempty"` + Font string `yaml:"font,omitempty"` } // AdditionalRelation is the struct for table relation from yaml @@ -186,7 +187,7 @@ func (c *Config) Load(configPath string, options ...Option) error { // LoadOptions load options func (c *Config) LoadOption(options ...Option) error { - for _, option := range options { + for _, option := range options { if err := option(c); err != nil { return err } diff --git a/go.mod b/go.mod index 910ebe440..13ae44bdd 100644 --- a/go.mod +++ b/go.mod @@ -4,14 +4,16 @@ require ( cloud.google.com/go/bigquery v1.6.0 cloud.google.com/go/spanner v1.5.1 github.com/aws/aws-sdk-go v1.30.9 + github.com/beta/freetype v0.0.1 github.com/denisenkom/go-mssqldb v0.0.0-20200206145737-bbfc9a55622e github.com/fatih/color v1.9.0 // indirect github.com/go-sql-driver/mysql v1.5.0 github.com/gobuffalo/packr/v2 v2.8.0 github.com/gocarina/gocsv v0.0.0-20200330101823-46266ca37bd3 - github.com/goccy/go-graphviz v0.0.5 + github.com/goccy/go-graphviz v0.0.6 github.com/goccy/go-yaml v1.4.3 github.com/google/go-cmp v0.4.0 + github.com/k1LoW/ffff v0.1.1 github.com/karrick/godirwalk v1.15.6 // indirect github.com/labstack/gommon v0.3.0 github.com/lib/pq v1.3.0 @@ -26,6 +28,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/xo/dburl v0.0.0-20200124232849-e9ec94f52bc3 golang.org/x/crypto v0.0.0-20200414173820-0848c9571904 // indirect + golang.org/x/image v0.0.0-20200618115811-c13761719519 golang.org/x/tools v0.0.0-20200417140056-c07e33ef3290 // indirect google.golang.org/api v0.21.0 google.golang.org/genproto v0.0.0-20200417142217-fb6d0575620b // indirect diff --git a/go.sum b/go.sum index 2bcaebff7..87b8836bf 100644 --- a/go.sum +++ b/go.sum @@ -19,18 +19,15 @@ cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUM cloud.google.com/go/bigquery v1.6.0 h1:ajp/DjpiCHO71SyIhwb83YsUGAyWuzVvMko+9xCsJLw= cloud.google.com/go/bigquery v1.6.0/go.mod h1:hyFDG0qSGdHNz8Q6nDN8rYIkld0q/+5uBZaelxiDLfE= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0 h1:/May9ojXjRkPBNVrq+oWLqmWCkr4OU5uRY29bu0mRyQ= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1 h1:ukjixP1wl0LpnZ6LWtZJ0mX5tBmjp1f8Sqer8Z2OMUU= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= cloud.google.com/go/spanner v1.5.1 h1:dWyj10TLlaxH2No6+tXsSCaq9oWgrRbXy1N3x/bhMGU= cloud.google.com/go/spanner v1.5.1/go.mod h1:e1+8M6PF3ntV9Xr57X2Gf+UhylXXYF6gI4WRZ1kfu2A= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0 h1:UDpwYIwla4jHGzZJaEJYx1tOejbgSoNqsAfHAUYe2r8= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= contrib.go.opencensus.io/exporter/ocagent v0.5.0/go.mod h1:ImxhfLRpxoYiSq891pBrLVhN+qmP8BTVvdH2YLs7Gl0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -38,7 +35,6 @@ git.apache.org/thrift.git v0.13.0/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqbl github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= github.com/Azure/azure-storage-blob-go v0.8.0/go.mod h1:lPI3aLPpuLTeUwh1sViKXFxwl2B6teiRqI0deQUvsw0= github.com/Azure/go-autorest v11.7.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= @@ -62,6 +58,8 @@ github.com/bcicen/jstream v0.0.0-20190220045926-16c1f8af81c2/go.mod h1:RDu/qcrnp github.com/beevik/ntp v0.2.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NRpg= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beta/freetype v0.0.1 h1:/t8b5+N9FlAMOF0d1aZPa83oufB2dU/YDqA0cq/QwyU= +github.com/beta/freetype v0.0.1/go.mod h1:IwMJ63oxprtqBiFXQiJTMyGLdsap+CKsO8ZzQut194I= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -85,11 +83,9 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/corona10/goimagehash v1.0.2 h1:pUfB0LnsJASMPGEZLj7tGY251vF+qLGqOgEP4rUs6kA= github.com/corona10/goimagehash v1.0.2/go.mod h1:/l9umBhvcHQXVtQO1V6Gp1yD20STawkhRnnX0D1bvVI= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.0.0-20200206145737-bbfc9a55622e h1:LzwWXEScfcTu7vUZNlDDWDARoSGEtvlDKK2BYHowNeE= github.com/denisenkom/go-mssqldb v0.0.0-20200206145737-bbfc9a55622e/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= @@ -128,9 +124,7 @@ github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= @@ -145,8 +139,8 @@ github.com/gobuffalo/packr/v2 v2.8.0 h1:IULGd15bQL59ijXLxEvA5wlMxsmx/ZkQv9T282zN github.com/gobuffalo/packr/v2 v2.8.0/go.mod h1:PDk2k3vGevNE3SwVyVRgQCCXETC9SaONCNSXT1Q8M1g= github.com/gocarina/gocsv v0.0.0-20200330101823-46266ca37bd3 h1:B7k6N+JlLM/u1xrIkpifUfE7GRJsZIYHoHbiAa5cSP4= github.com/gocarina/gocsv v0.0.0-20200330101823-46266ca37bd3/go.mod h1:5YoVOkjYAQumqlV356Hj3xeYh4BdZuLE0/nRkf2NKkI= -github.com/goccy/go-graphviz v0.0.5 h1:qcjgvNiYbLyfLAq9LvyYBJ7sNMbQh9w4FoAzBDrYhYw= -github.com/goccy/go-graphviz v0.0.5/go.mod h1:wXVsXxmyMQU6TN3zGRttjNn3h+iCAS7xQFC6TlNvLhk= +github.com/goccy/go-graphviz v0.0.6 h1:sCT69fmH2KKsObVfsozYyKXxrqmIfo3SyHZs72xkgxs= +github.com/goccy/go-graphviz v0.0.6/go.mod h1:wXVsXxmyMQU6TN3zGRttjNn3h+iCAS7xQFC6TlNvLhk= github.com/goccy/go-yaml v1.4.3 h1:+1jK1ost1TBEfWjciIMU8rciBq0poxurgS7XvLgQInM= github.com/goccy/go-yaml v1.4.3/go.mod h1:PsEEJ29nIFZL07P/c8dv4P6rQkVFFXafQee85U+ERHA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -190,7 +184,6 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -243,7 +236,6 @@ github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKe github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf/go.mod h1:hyb9oH7vZsitZCiBt0ZvifOrB+qc8PS5IiilCIb87rg= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -253,10 +245,13 @@ github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeY github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/k1LoW/ffff v0.1.1 h1:jbCgLs/U8wPufWzZvh52hj2O0hNrdQmoLgfr35B5+EM= +github.com/k1LoW/ffff v0.1.1/go.mod h1:XuWQte6DCVCGKkvfeOFHTihuYWusf7dU+kp9jot7FlM= +github.com/k1LoW/fontdir v0.1.0 h1:c5JD8M7qOpFpQ5RF8tey7L+sC8IgsXAx3/MeOFzQA10= +github.com/k1LoW/fontdir v0.1.0/go.mod h1:9Zbr3T3BXZ5ypr1BM/JwzZN4bqBvl1+JnSTTg1c+zHg= github.com/karrick/godirwalk v1.15.3/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= github.com/karrick/godirwalk v1.15.6 h1:Yf2mmR8TJy+8Fa0SuQVto5SYap6IF7lNVX4Jdl8G1qA= github.com/karrick/godirwalk v1.15.6/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= @@ -271,18 +266,14 @@ github.com/klauspost/pgzip v1.2.1/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQ github.com/klauspost/readahead v1.3.1/go.mod h1:AH9juHzNH7xqdqFHrMRSHeH2Ps+vFf+kblDqzPFiLJg= github.com/klauspost/reedsolomon v1.9.3/go.mod h1:CwCi+NUr9pqSVktrkN+Ondf06rkhYZ/pcNv7fu+8Un4= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kurin/blazer v0.5.4-0.20200327014341-8f90a40f8af7/go.mod h1:4FCXMUWo9DllR2Do4TtBd377ezyAJ51vB5uTBjt0pGU= github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= @@ -362,7 +353,6 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nats-io/stan.go v0.4.5/go.mod h1:Ji7mK6gRZJSH1nc3ZJH6vi7zn/QnZhpR9Arm4iuzsUQ= github.com/ncw/directio v1.0.5/go.mod h1:rX/pKEYkOXBGOggmcyJeJGloCkleSvphPx2eV3t6ROk= -github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5 h1:BvoENQQU+fZ9uukda/RzCAL/191HHwJA5b13R6diVlY= github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/nsqio/go-nsq v1.0.7/go.mod h1:XP5zaUs3pqf+Q71EqUJs3HYfBIqfK6G83WQMdNN+Ito= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= @@ -403,12 +393,13 @@ github.com/rcrowley/go-metrics v0.0.0-20190704165056-9c2d0518ed81/go.mod h1:bCqn github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.5.2 h1:qLvObTrvO/XRCqmkKxUlOBc48bI3efyDuAZe25QiF0w= github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= +github.com/sahilm/fuzzy v0.1.0 h1:FzWGaw2Opqyu+794ZQ9SYifWv2EIXpwP4q8dY1kDAwI= +github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/secure-io/sio-go v0.3.0/go.mod h1:D3KmXgKETffyYxBdFRN+Hpd2WzhzqS0EQwT3XWsAcBU= github.com/shirou/gopsutil v2.20.3-0.20200314133625-53cec6b37e6a+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= @@ -439,7 +430,6 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/tidwall/gjson v1.3.5/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= @@ -501,9 +491,12 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190507092727-e4e5bf290fec/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20200119044424-58c23975cae1 h1:5h3ngYt7+vXCDZCup/HkCQgW5XwmSvR/nA2JmJ0RErg= golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200618115811-c13761719519 h1:1e2ufUJNM3lCHEY5jIgac/7UTjd6cgJNdatjPdFWf34= +golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -513,7 +506,6 @@ golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= @@ -521,7 +513,6 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -560,7 +551,6 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a h1:WXEvlFVvvGxCJLG6REjsT03iWnKLEWinaScsxF2Vm2o= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -649,7 +639,6 @@ golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjs golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200409170454-77362c5149f0/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200416214402-fc959738d646/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200417140056-c07e33ef3290 h1:NXNmtp0ToD36cui5IqWy95LC4Y6vT/4y3RnPxlQPinU= golang.org/x/tools v0.0.0-20200417140056-c07e33ef3290/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -674,7 +663,6 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -728,13 +716,10 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v9 v9.30.0 h1:Wk0Z37oBmKj9/n+tPyBHZmeL19LaCoK3Qq48VwYENss= gopkg.in/go-playground/validator.v9 v9.30.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.48.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -752,16 +737,13 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2 h1:XZx7nhd5GMaZpmDaEHFVafUZC7ya0fuo7cSJ3UCKYmM= gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/output/gviz/gviz.go b/output/gviz/gviz.go index 4c8d82b41..d6dfa286a 100644 --- a/output/gviz/gviz.go +++ b/output/gviz/gviz.go @@ -3,12 +3,21 @@ package gviz import ( "bytes" "io" + "io/ioutil" + "os" + "path/filepath" + "strings" + "github.com/beta/freetype/truetype" "github.com/goccy/go-graphviz" + "github.com/k1LoW/ffff" "github.com/k1LoW/tbls/config" "github.com/k1LoW/tbls/output/dot" "github.com/k1LoW/tbls/schema" "github.com/pkg/errors" + "golang.org/x/image/font" + "golang.org/x/image/font/opentype" + "golang.org/x/image/font/sfnt" ) // Gviz struct @@ -47,6 +56,13 @@ func (g *Gviz) OutputTable(wr io.Writer, t *schema.Table) error { func (g *Gviz) render(wr io.Writer, b []byte) (e error) { gviz := graphviz.New() + if g.config.ER.Font != "" { + faceFunc, err := getFaceFunc(g.config.ER.Font) + if err != nil { + return errors.WithStack(err) + } + gviz.SetFontFace(faceFunc) + } graph, err := graphviz.ParseBytes(b) if err != nil { return errors.WithStack(err) @@ -64,3 +80,60 @@ func (g *Gviz) render(wr io.Writer, b []byte) (e error) { } return nil } + +// getFaceFunc +func getFaceFunc(keyword string) (func(size float64) (font.Face, error), error) { + var ( + faceFunc func(size float64) (font.Face, error) + path string + ) + + fi, err := os.Stat(keyword) + if err == nil && !fi.IsDir() { + path = keyword + } else { + path, err = ffff.FuzzyFindPath(keyword) + if err != nil { + return faceFunc, errors.WithStack(err) + } + } + + fb, err := ioutil.ReadFile(filepath.Clean(path)) + if err != nil { + return faceFunc, errors.WithStack(err) + } + + if strings.HasSuffix(path, ".otf") { + // OpenType + ft, err := sfnt.Parse(fb) + if err != nil { + return faceFunc, errors.WithStack(err) + } + faceFunc = func(size float64) (font.Face, error) { + opt := &opentype.FaceOptions{ + Size: size, + DPI: 0, + Hinting: 0, + } + return opentype.NewFace(ft, opt) + } + } else { + // TrueType + ft, err := truetype.Parse(fb) + if err != nil { + return faceFunc, errors.WithStack(err) + } + faceFunc = func(size float64) (font.Face, error) { + opt := &truetype.Options{ + Size: size, + DPI: 0, + Hinting: 0, + GlyphCacheEntries: 0, + SubPixelsX: 0, + SubPixelsY: 0, + } + return truetype.NewFace(ft, opt), nil + } + } + return faceFunc, nil +} diff --git a/sample/adjust/administrator.blogs.png b/sample/adjust/administrator.blogs.png index 4f11cc3a8..bd4eaaed8 100644 Binary files a/sample/adjust/administrator.blogs.png and b/sample/adjust/administrator.blogs.png differ diff --git a/sample/adjust/backup.blog_options.png b/sample/adjust/backup.blog_options.png index 04a4babed..63989710e 100644 Binary files a/sample/adjust/backup.blog_options.png and b/sample/adjust/backup.blog_options.png differ diff --git a/sample/adjust/backup.blogs.png b/sample/adjust/backup.blogs.png index ff1156f00..e63886b1f 100644 Binary files a/sample/adjust/backup.blogs.png and b/sample/adjust/backup.blogs.png differ diff --git a/sample/adjust/public.CamelizeTable.png b/sample/adjust/public.CamelizeTable.png index c6f464746..7d2fc5bf1 100644 Binary files a/sample/adjust/public.CamelizeTable.png and b/sample/adjust/public.CamelizeTable.png differ diff --git a/sample/adjust/public.comment_stars.png b/sample/adjust/public.comment_stars.png index 1b8e5df63..d41a785ea 100644 Binary files a/sample/adjust/public.comment_stars.png and b/sample/adjust/public.comment_stars.png differ diff --git a/sample/adjust/public.comments.png b/sample/adjust/public.comments.png index a0e214067..1acc5b12d 100644 Binary files a/sample/adjust/public.comments.png and b/sample/adjust/public.comments.png differ diff --git a/sample/adjust/public.hyphen-table.png b/sample/adjust/public.hyphen-table.png index e92838923..2c391a84a 100644 Binary files a/sample/adjust/public.hyphen-table.png and b/sample/adjust/public.hyphen-table.png differ diff --git a/sample/adjust/public.logs.png b/sample/adjust/public.logs.png index 548f680d7..adb0781d1 100644 Binary files a/sample/adjust/public.logs.png and b/sample/adjust/public.logs.png differ diff --git a/sample/adjust/public.post_comment_stars.png b/sample/adjust/public.post_comment_stars.png index f0a6d1ca5..2af7d5caf 100644 Binary files a/sample/adjust/public.post_comment_stars.png and b/sample/adjust/public.post_comment_stars.png differ diff --git a/sample/adjust/public.post_comments.png b/sample/adjust/public.post_comments.png index 145af7e61..8df150cab 100644 Binary files a/sample/adjust/public.post_comments.png and b/sample/adjust/public.post_comments.png differ diff --git a/sample/adjust/public.posts.png b/sample/adjust/public.posts.png index 193fe1aa5..e34c3e948 100644 Binary files a/sample/adjust/public.posts.png and b/sample/adjust/public.posts.png differ diff --git a/sample/adjust/public.user_options.png b/sample/adjust/public.user_options.png index 8fa8d30b9..0ccfe6c4b 100644 Binary files a/sample/adjust/public.user_options.png and b/sample/adjust/public.user_options.png differ diff --git a/sample/adjust/public.users.png b/sample/adjust/public.users.png index f5f581636..0d5ba1276 100644 Binary files a/sample/adjust/public.users.png and b/sample/adjust/public.users.png differ diff --git a/sample/adjust/schema.png b/sample/adjust/schema.png index 35b5251a3..4894c27f5 100644 Binary files a/sample/adjust/schema.png and b/sample/adjust/schema.png differ diff --git a/sample/adjust/time.bar.png b/sample/adjust/time.bar.png index d34108b55..0de8e7d02 100644 Binary files a/sample/adjust/time.bar.png and b/sample/adjust/time.bar.png differ diff --git a/sample/adjust/time.hyphenated-table.png b/sample/adjust/time.hyphenated-table.png index 888af27b4..cd972759f 100644 Binary files a/sample/adjust/time.hyphenated-table.png and b/sample/adjust/time.hyphenated-table.png differ diff --git a/sample/adjust/time.referencing.png b/sample/adjust/time.referencing.png index df3414cda..cb6eea1f9 100644 Binary files a/sample/adjust/time.referencing.png and b/sample/adjust/time.referencing.png differ diff --git a/sample/dict/CamelizeTable.png b/sample/dict/CamelizeTable.png index 56e42d519..d5e5a719e 100644 Binary files a/sample/dict/CamelizeTable.png and b/sample/dict/CamelizeTable.png differ diff --git a/sample/dict/comment_stars.png b/sample/dict/comment_stars.png index 3b9fe9840..6dc56b8cb 100644 Binary files a/sample/dict/comment_stars.png and b/sample/dict/comment_stars.png differ diff --git a/sample/dict/comments.png b/sample/dict/comments.png index b68c588b0..82da2bd3c 100644 Binary files a/sample/dict/comments.png and b/sample/dict/comments.png differ diff --git a/sample/dict/hyphen-table.png b/sample/dict/hyphen-table.png index 0b62e87b3..397a76d93 100644 Binary files a/sample/dict/hyphen-table.png and b/sample/dict/hyphen-table.png differ diff --git a/sample/dict/logs.png b/sample/dict/logs.png index 09ca6aaac..14deb7c28 100644 Binary files a/sample/dict/logs.png and b/sample/dict/logs.png differ diff --git a/sample/dict/post_comments.png b/sample/dict/post_comments.png index f2210e9bf..7072f6ad7 100644 Binary files a/sample/dict/post_comments.png and b/sample/dict/post_comments.png differ diff --git a/sample/dict/posts.png b/sample/dict/posts.png index 46a4a7e22..7ae8273be 100644 Binary files a/sample/dict/posts.png and b/sample/dict/posts.png differ diff --git a/sample/dict/schema.png b/sample/dict/schema.png index 1be8b9feb..fce2a8067 100644 Binary files a/sample/dict/schema.png and b/sample/dict/schema.png differ diff --git a/sample/dict/user_options.png b/sample/dict/user_options.png index 644d90b65..80557e0af 100644 Binary files a/sample/dict/user_options.png and b/sample/dict/user_options.png differ diff --git a/sample/dict/users.png b/sample/dict/users.png index 585e70f0b..322632cdc 100644 Binary files a/sample/dict/users.png and b/sample/dict/users.png differ diff --git a/sample/dynamodb/Forum.png b/sample/dynamodb/Forum.png index 9d2817488..a93303b2e 100644 Binary files a/sample/dynamodb/Forum.png and b/sample/dynamodb/Forum.png differ diff --git a/sample/dynamodb/ProductCatalog.png b/sample/dynamodb/ProductCatalog.png index 41fdf9d5e..83b1242c1 100644 Binary files a/sample/dynamodb/ProductCatalog.png and b/sample/dynamodb/ProductCatalog.png differ diff --git a/sample/dynamodb/Reply.png b/sample/dynamodb/Reply.png index 24bf0e5a7..6224f9c98 100644 Binary files a/sample/dynamodb/Reply.png and b/sample/dynamodb/Reply.png differ diff --git a/sample/dynamodb/Thread.png b/sample/dynamodb/Thread.png index f5522ae7f..2b4f1e7af 100644 Binary files a/sample/dynamodb/Thread.png and b/sample/dynamodb/Thread.png differ diff --git a/sample/dynamodb/schema.png b/sample/dynamodb/schema.png index 771ac9aa3..e0b7dfc77 100644 Binary files a/sample/dynamodb/schema.png and b/sample/dynamodb/schema.png differ diff --git a/sample/exclude/comment_stars.png b/sample/exclude/comment_stars.png index 3b9fe9840..6dc56b8cb 100644 Binary files a/sample/exclude/comment_stars.png and b/sample/exclude/comment_stars.png differ diff --git a/sample/exclude/comments.png b/sample/exclude/comments.png index b68c588b0..82da2bd3c 100644 Binary files a/sample/exclude/comments.png and b/sample/exclude/comments.png differ diff --git a/sample/exclude/hyphen-table.png b/sample/exclude/hyphen-table.png index 0b62e87b3..397a76d93 100644 Binary files a/sample/exclude/hyphen-table.png and b/sample/exclude/hyphen-table.png differ diff --git a/sample/exclude/post_comments.png b/sample/exclude/post_comments.png index f2210e9bf..7072f6ad7 100644 Binary files a/sample/exclude/post_comments.png and b/sample/exclude/post_comments.png differ diff --git a/sample/exclude/posts.png b/sample/exclude/posts.png index 46a4a7e22..7ae8273be 100644 Binary files a/sample/exclude/posts.png and b/sample/exclude/posts.png differ diff --git a/sample/exclude/schema.png b/sample/exclude/schema.png index d709b2b90..d79a44210 100644 Binary files a/sample/exclude/schema.png and b/sample/exclude/schema.png differ diff --git a/sample/exclude/user_options.png b/sample/exclude/user_options.png index 644d90b65..80557e0af 100644 Binary files a/sample/exclude/user_options.png and b/sample/exclude/user_options.png differ diff --git a/sample/exclude/users.png b/sample/exclude/users.png index 585e70f0b..322632cdc 100644 Binary files a/sample/exclude/users.png and b/sample/exclude/users.png differ diff --git a/sample/font/CamelizeTable.md b/sample/font/CamelizeTable.md new file mode 100644 index 000000000..556e01178 --- /dev/null +++ b/sample/font/CamelizeTable.md @@ -0,0 +1,43 @@ +# CamelizeTable + +## Description + +
+Table Definition + +```sql +CREATE TABLE `CamelizeTable` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `created` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | bigint(20) | | false | | | | +| created | datetime | | false | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| PRIMARY | PRIMARY KEY (id) USING BTREE | + +## Relations + +![er](CamelizeTable.png) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/font/CamelizeTable.png b/sample/font/CamelizeTable.png new file mode 100644 index 000000000..1f53e1a3b Binary files /dev/null and b/sample/font/CamelizeTable.png differ diff --git a/sample/font/README.md b/sample/font/README.md new file mode 100644 index 000000000..f16629927 --- /dev/null +++ b/sample/font/README.md @@ -0,0 +1,27 @@ +# testdb + +## Labels + +`サンプル` `tbls` + +## Tables + +| Name | Columns | Comment | Type | +| ---- | ------- | ------- | ---- | +| [CamelizeTable](CamelizeTable.md) | 2 | | BASE TABLE | +| [comment_stars](comment_stars.md) | 6 | | BASE TABLE | +| [comments](comments.md) | 6 | Comments
Multi-line
table
comment | BASE TABLE | +| [hyphen-table](hyphen-table.md) | 3 | | BASE TABLE | +| [logs](logs.md) | 7 | Auditログ | BASE TABLE | +| [post_comments](post_comments.md) | 7 | post and comments View table | VIEW | +| [posts](posts.md) | 7 | エントリ | BASE TABLE | +| [user_options](user_options.md) | 4 | User options table | BASE TABLE | +| [users](users.md) | 6 | Users table | BASE TABLE | + +## Relations + +![er](schema.png) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/font/comment_stars.md b/sample/font/comment_stars.md new file mode 100644 index 000000000..cdcb6e032 --- /dev/null +++ b/sample/font/comment_stars.md @@ -0,0 +1,62 @@ +# comment_stars + +## Description + +
+Table Definition + +```sql +CREATE TABLE `comment_stars` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `comment_post_id` bigint(20) NOT NULL, + `comment_user_id` int(11) NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`,`comment_post_id`,`comment_user_id`), + KEY `comment_stars_user_id_post_id_fk` (`comment_post_id`,`comment_user_id`), + KEY `comment_stars_user_id_fk` (`comment_user_id`), + CONSTRAINT `comment_stars_user_id_fk` FOREIGN KEY (`comment_user_id`) REFERENCES `users` (`id`), + CONSTRAINT `comment_stars_user_id_post_id_fk` FOREIGN KEY (`comment_post_id`, `comment_user_id`) REFERENCES `comments` (`post_id`, `user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | bigint(20) | | false | | | | +| user_id | int(11) | | false | | | | +| comment_post_id | bigint(20) | | false | | [comments](comments.md) | | +| comment_user_id | int(11) | | false | | [users](users.md) [comments](comments.md) | | +| created | timestamp | CURRENT_TIMESTAMP | false | | | | +| updated | timestamp | 0000-00-00 00:00:00 | false | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| comment_stars_user_id_fk | FOREIGN KEY | FOREIGN KEY (comment_user_id) REFERENCES users (id) | +| comment_stars_user_id_post_id_fk | FOREIGN KEY | FOREIGN KEY (comment_post_id, comment_user_id) REFERENCES comments (post_id, user_id) | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | +| user_id | UNIQUE | UNIQUE KEY user_id (user_id, comment_post_id, comment_user_id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| comment_stars_user_id_fk | KEY comment_stars_user_id_fk (comment_user_id) USING BTREE | +| comment_stars_user_id_post_id_fk | KEY comment_stars_user_id_post_id_fk (comment_post_id, comment_user_id) USING BTREE | +| PRIMARY | PRIMARY KEY (id) USING BTREE | +| user_id | UNIQUE KEY user_id (user_id, comment_post_id, comment_user_id) USING BTREE | + +## Relations + +![er](comment_stars.png) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/font/comment_stars.png b/sample/font/comment_stars.png new file mode 100644 index 000000000..1ab46b362 Binary files /dev/null and b/sample/font/comment_stars.png differ diff --git a/sample/font/comments.md b/sample/font/comments.md new file mode 100644 index 000000000..139546666 --- /dev/null +++ b/sample/font/comments.md @@ -0,0 +1,67 @@ +# comments + +## Description + +Comments +Multi-line +table +comment + +
+Table Definition + +```sql +CREATE TABLE `comments` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `post_id` bigint(20) NOT NULL, + `user_id` int(11) NOT NULL, + `comment` text NOT NULL COMMENT 'Comment\nMulti-line\r\ncolumn\rcomment', + `created` datetime NOT NULL, + `updated` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `post_id` (`post_id`,`user_id`), + KEY `comments_user_id_fk` (`user_id`), + KEY `comments_post_id_user_id_idx` (`post_id`,`user_id`) USING HASH, + CONSTRAINT `comments_post_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`), + CONSTRAINT `comments_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Comments\nMulti-line\r\ntable\rcomment' +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | bigint(20) | | false | | | | +| post_id | bigint(20) | | false | [comment_stars](comment_stars.md) | [posts](posts.md) | | +| user_id | int(11) | | false | [comment_stars](comment_stars.md) | [users](users.md) | | +| comment | text | | false | | | Comment
Multi-line
column
comment | +| created | datetime | | false | | | | +| updated | datetime | | true | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| comments_post_id_fk | FOREIGN KEY | FOREIGN KEY (post_id) REFERENCES posts (id) | +| comments_user_id_fk | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users (id) | +| post_id | UNIQUE | UNIQUE KEY post_id (post_id, user_id) | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| comments_post_id_user_id_idx | KEY comments_post_id_user_id_idx (post_id, user_id) USING BTREE | +| comments_user_id_fk | KEY comments_user_id_fk (user_id) USING BTREE | +| PRIMARY | PRIMARY KEY (id) USING BTREE | +| post_id | UNIQUE KEY post_id (post_id, user_id) USING BTREE | + +## Relations + +![er](comments.png) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/font/comments.png b/sample/font/comments.png new file mode 100644 index 000000000..fb100e0d2 Binary files /dev/null and b/sample/font/comments.png differ diff --git a/sample/font/hyphen-table.md b/sample/font/hyphen-table.md new file mode 100644 index 000000000..f8002d0f5 --- /dev/null +++ b/sample/font/hyphen-table.md @@ -0,0 +1,45 @@ +# hyphen-table + +## Description + +
+Table Definition + +```sql +CREATE TABLE `hyphen-table` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `hyphen-column` text NOT NULL, + `created` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | bigint(20) | | false | | | | +| hyphen-column | text | | false | | | | +| created | datetime | | false | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| PRIMARY | PRIMARY KEY (id) USING BTREE | + +## Relations + +![er](hyphen-table.png) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/font/hyphen-table.png b/sample/font/hyphen-table.png new file mode 100644 index 000000000..2b9389e4c Binary files /dev/null and b/sample/font/hyphen-table.png differ diff --git a/sample/font/logs.md b/sample/font/logs.md new file mode 100644 index 000000000..adc5c1480 --- /dev/null +++ b/sample/font/logs.md @@ -0,0 +1,55 @@ +# logs + +## Description + +Auditログ + +
+Table Definition + +```sql +CREATE TABLE `logs` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `post_id` bigint(20) DEFAULT NULL, + `comment_id` bigint(20) DEFAULT NULL, + `comment_star_id` bigint(20) DEFAULT NULL, + `payload` text, + `created` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Auditログ' +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | bigint(20) | | false | | | | +| user_id | int(11) | | false | | | | +| post_id | bigint(20) | | true | | | | +| comment_id | bigint(20) | | true | | | | +| comment_star_id | bigint(20) | | true | | | | +| payload | text | | true | | | | +| created | datetime | | false | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| PRIMARY | PRIMARY KEY (id) USING BTREE | + +## Relations + +![er](logs.png) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/font/logs.png b/sample/font/logs.png new file mode 100644 index 000000000..a92275fcd Binary files /dev/null and b/sample/font/logs.png differ diff --git a/sample/font/post_comments.md b/sample/font/post_comments.md new file mode 100644 index 000000000..9fc5178d4 --- /dev/null +++ b/sample/font/post_comments.md @@ -0,0 +1,34 @@ +# post_comments + +## Description + +post and comments View table + +
+Table Definition + +```sql +CREATE VIEW post_comments AS ((select `c`.`id` AS `id`,`p`.`title` AS `title`,`u2`.`username` AS `post_user`,`c`.`comment` AS `comment`,`u2`.`username` AS `comment_user`,`c`.`created` AS `created`,`c`.`updated` AS `updated` from (((`testdb`.`posts` `p` left join `testdb`.`comments` `c` on((`p`.`id` = `c`.`post_id`))) left join `testdb`.`users` `u` on((`u`.`id` = `p`.`user_id`))) left join `testdb`.`users` `u2` on((`u2`.`id` = `c`.`user_id`))))) +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | bigint(20) | 0 | true | | | comments.id | +| title | varchar(255) | | false | | | posts.title | +| post_user | varchar(50) | | true | | | posts.users.username | +| comment | text | | true | | | Comment
Multi-line
column
comment | +| comment_user | varchar(50) | | true | | | comments.users.username | +| created | datetime | | true | | | comments.created | +| updated | datetime | | true | | | comments.updated | + +## Relations + +![er](post_comments.png) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/font/post_comments.png b/sample/font/post_comments.png new file mode 100644 index 000000000..18b4d9795 Binary files /dev/null and b/sample/font/post_comments.png differ diff --git a/sample/font/posts.md b/sample/font/posts.md new file mode 100644 index 000000000..96da58010 --- /dev/null +++ b/sample/font/posts.md @@ -0,0 +1,68 @@ +# posts + +## Description + +エントリ + +
+Table Definition + +```sql +CREATE TABLE `posts` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `title` varchar(255) NOT NULL, + `body` text NOT NULL, + `post_type` enum('public','private','draft') NOT NULL COMMENT 'public/private/draft', + `created` datetime NOT NULL, + `updated` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`,`title`), + KEY `posts_user_id_idx` (`id`) USING BTREE, + CONSTRAINT `posts_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Posts table' +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | bigint(20) | | false | [comments](comments.md) | | | +| user_id | int(11) | | false | | [users](users.md) | | +| title | varchar(255) | | false | | | | +| body | text | | false | | | 本文 | +| post_type | enum('public','private','draft') | | false | | | public/private/draft | +| created | datetime | | false | | | | +| updated | datetime | | true | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| posts_user_id_fk | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users (id) | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | +| user_id | UNIQUE | UNIQUE KEY user_id (user_id, title) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| posts_user_id_idx | KEY posts_user_id_idx (id) USING BTREE | +| PRIMARY | PRIMARY KEY (id) USING BTREE | +| user_id | UNIQUE KEY user_id (user_id, title) USING BTREE | + +## Triggers + +| Name | Definition | +| ---- | ---------- | +| update_posts_updated | CREATE TRIGGER update_posts_updated BEFORE UPDATE ON posts
FOR EACH ROW
SET NEW.updated = CURRENT_TIMESTAMP() | + +## Relations + +![er](posts.png) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/font/posts.png b/sample/font/posts.png new file mode 100644 index 000000000..93dd2fc22 Binary files /dev/null and b/sample/font/posts.png differ diff --git a/sample/font/schema.png b/sample/font/schema.png new file mode 100644 index 000000000..ce3c087f6 Binary files /dev/null and b/sample/font/schema.png differ diff --git a/sample/font/user_options.md b/sample/font/user_options.md new file mode 100644 index 000000000..65001ca89 --- /dev/null +++ b/sample/font/user_options.md @@ -0,0 +1,54 @@ +# user_options + +## Description + +User options table + +
+Table Definition + +```sql +CREATE TABLE `user_options` ( + `user_id` int(11) NOT NULL, + `show_email` tinyint(1) NOT NULL DEFAULT '0', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`user_id`), + UNIQUE KEY `user_id` (`user_id`), + CONSTRAINT `user_options_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='User options table' +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| user_id | int(11) | | false | | [users](users.md) | | +| show_email | tinyint(1) | 0 | false | | | | +| created | timestamp | CURRENT_TIMESTAMP | false | | | | +| updated | timestamp | 0000-00-00 00:00:00 | false | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (user_id) | +| user_id | UNIQUE | UNIQUE KEY user_id (user_id) | +| user_options_user_id_fk | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| PRIMARY | PRIMARY KEY (user_id) USING BTREE | +| user_id | UNIQUE KEY user_id (user_id) USING BTREE | + +## Relations + +![er](user_options.png) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/font/user_options.png b/sample/font/user_options.png new file mode 100644 index 000000000..b1322c9be Binary files /dev/null and b/sample/font/user_options.png differ diff --git a/sample/font/users.md b/sample/font/users.md new file mode 100644 index 000000000..6194bb2b5 --- /dev/null +++ b/sample/font/users.md @@ -0,0 +1,59 @@ +# users + +## Description + +Users table + +
+Table Definition + +```sql +CREATE TABLE `users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(50) NOT NULL, + `password` varchar(50) NOT NULL, + `email` varchar(355) NOT NULL COMMENT 'ex. user@example.com', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + UNIQUE KEY `username` (`username`), + UNIQUE KEY `email` (`email`) +) ENGINE=InnoDB AUTO_INCREMENT=[Redacted by tbls] DEFAULT CHARSET=latin1 COMMENT='Users table' +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | int(11) | | false | [comment_stars](comment_stars.md) [comments](comments.md) [posts](posts.md) [user_options](user_options.md) | | | +| username | varchar(50) | | false | | | | +| password | varchar(50) | | false | | | | +| email | varchar(355) | | false | | | ex. user@example.com | +| created | timestamp | CURRENT_TIMESTAMP | false | | | | +| updated | timestamp | 0000-00-00 00:00:00 | false | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| email | UNIQUE | UNIQUE KEY email (email) | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | +| username | UNIQUE | UNIQUE KEY username (username) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| PRIMARY | PRIMARY KEY (id) USING BTREE | +| email | UNIQUE KEY email (email) USING BTREE | +| username | UNIQUE KEY username (username) USING BTREE | + +## Relations + +![er](users.png) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/font/users.png b/sample/font/users.png new file mode 100644 index 000000000..13e52210e Binary files /dev/null and b/sample/font/users.png differ diff --git a/sample/mssql/CamelizeTable.png b/sample/mssql/CamelizeTable.png index 5db7df029..7236bb3d6 100644 Binary files a/sample/mssql/CamelizeTable.png and b/sample/mssql/CamelizeTable.png differ diff --git a/sample/mssql/comment_stars.png b/sample/mssql/comment_stars.png index f95e07515..f25847612 100644 Binary files a/sample/mssql/comment_stars.png and b/sample/mssql/comment_stars.png differ diff --git a/sample/mssql/comments.png b/sample/mssql/comments.png index df106f699..ad8c1f41d 100644 Binary files a/sample/mssql/comments.png and b/sample/mssql/comments.png differ diff --git a/sample/mssql/hyphen-table.png b/sample/mssql/hyphen-table.png index 8831be6b8..35f36bb49 100644 Binary files a/sample/mssql/hyphen-table.png and b/sample/mssql/hyphen-table.png differ diff --git a/sample/mssql/logs.png b/sample/mssql/logs.png index 06701100c..1020c757f 100644 Binary files a/sample/mssql/logs.png and b/sample/mssql/logs.png differ diff --git a/sample/mssql/post_comments.png b/sample/mssql/post_comments.png index 6990fe6bc..590918cea 100644 Binary files a/sample/mssql/post_comments.png and b/sample/mssql/post_comments.png differ diff --git a/sample/mssql/posts.png b/sample/mssql/posts.png index 34373f6de..7b722f44e 100644 Binary files a/sample/mssql/posts.png and b/sample/mssql/posts.png differ diff --git a/sample/mssql/schema.png b/sample/mssql/schema.png index cef7ffec5..8aea9b513 100644 Binary files a/sample/mssql/schema.png and b/sample/mssql/schema.png differ diff --git a/sample/mssql/user_options.png b/sample/mssql/user_options.png index 6de7695ef..8387f43ef 100644 Binary files a/sample/mssql/user_options.png and b/sample/mssql/user_options.png differ diff --git a/sample/mssql/users.png b/sample/mssql/users.png index 4631214c8..8e5d2cacf 100644 Binary files a/sample/mssql/users.png and b/sample/mssql/users.png differ diff --git a/sample/mysql/CamelizeTable.png b/sample/mysql/CamelizeTable.png index 56e42d519..d5e5a719e 100644 Binary files a/sample/mysql/CamelizeTable.png and b/sample/mysql/CamelizeTable.png differ diff --git a/sample/mysql/comment_stars.png b/sample/mysql/comment_stars.png index d72ee6e79..2f4082767 100644 Binary files a/sample/mysql/comment_stars.png and b/sample/mysql/comment_stars.png differ diff --git a/sample/mysql/comments.png b/sample/mysql/comments.png index 7ff127610..8eb535ccb 100644 Binary files a/sample/mysql/comments.png and b/sample/mysql/comments.png differ diff --git a/sample/mysql/hyphen-table.png b/sample/mysql/hyphen-table.png index 0b62e87b3..397a76d93 100644 Binary files a/sample/mysql/hyphen-table.png and b/sample/mysql/hyphen-table.png differ diff --git a/sample/mysql/logs.png b/sample/mysql/logs.png index 954330340..9383c3df3 100644 Binary files a/sample/mysql/logs.png and b/sample/mysql/logs.png differ diff --git a/sample/mysql/post_comments.png b/sample/mysql/post_comments.png index 2c2f34d3e..7072f6ad7 100644 Binary files a/sample/mysql/post_comments.png and b/sample/mysql/post_comments.png differ diff --git a/sample/mysql/posts.png b/sample/mysql/posts.png index 66cd3deb7..1d4632fe6 100644 Binary files a/sample/mysql/posts.png and b/sample/mysql/posts.png differ diff --git a/sample/mysql/schema.png b/sample/mysql/schema.png index 664b709ca..cc9b6616f 100644 Binary files a/sample/mysql/schema.png and b/sample/mysql/schema.png differ diff --git a/sample/mysql/user_options.png b/sample/mysql/user_options.png index b240cc558..80557e0af 100644 Binary files a/sample/mysql/user_options.png and b/sample/mysql/user_options.png differ diff --git a/sample/mysql/users.png b/sample/mysql/users.png index d9d4eb78e..c4c155e62 100644 Binary files a/sample/mysql/users.png and b/sample/mysql/users.png differ diff --git a/sample/mysql8/CamelizeTable.png b/sample/mysql8/CamelizeTable.png index 53cd7d8a3..6343fb14d 100644 Binary files a/sample/mysql8/CamelizeTable.png and b/sample/mysql8/CamelizeTable.png differ diff --git a/sample/mysql8/comment_stars.png b/sample/mysql8/comment_stars.png index e9ee175f0..3f8d93541 100644 Binary files a/sample/mysql8/comment_stars.png and b/sample/mysql8/comment_stars.png differ diff --git a/sample/mysql8/comments.png b/sample/mysql8/comments.png index 9eb027222..067eec2de 100644 Binary files a/sample/mysql8/comments.png and b/sample/mysql8/comments.png differ diff --git a/sample/mysql8/hyphen-table.png b/sample/mysql8/hyphen-table.png index e1940eee2..57d60ae5a 100644 Binary files a/sample/mysql8/hyphen-table.png and b/sample/mysql8/hyphen-table.png differ diff --git a/sample/mysql8/logs.png b/sample/mysql8/logs.png index 3053dcc28..b38756a04 100644 Binary files a/sample/mysql8/logs.png and b/sample/mysql8/logs.png differ diff --git a/sample/mysql8/post_comments.png b/sample/mysql8/post_comments.png index 89229f11f..cbb98e93e 100644 Binary files a/sample/mysql8/post_comments.png and b/sample/mysql8/post_comments.png differ diff --git a/sample/mysql8/posts.png b/sample/mysql8/posts.png index 9469cf444..2802727e8 100644 Binary files a/sample/mysql8/posts.png and b/sample/mysql8/posts.png differ diff --git a/sample/mysql8/schema.png b/sample/mysql8/schema.png index aa9e371a3..30ef444a2 100644 Binary files a/sample/mysql8/schema.png and b/sample/mysql8/schema.png differ diff --git a/sample/mysql8/user_options.png b/sample/mysql8/user_options.png index c0cb8b0d5..6af5aef6b 100644 Binary files a/sample/mysql8/user_options.png and b/sample/mysql8/user_options.png differ diff --git a/sample/mysql8/users.png b/sample/mysql8/users.png index dfca5cc42..527f7faa9 100644 Binary files a/sample/mysql8/users.png and b/sample/mysql8/users.png differ diff --git a/sample/postgres/administrator.blogs.png b/sample/postgres/administrator.blogs.png index 4f11cc3a8..bd4eaaed8 100644 Binary files a/sample/postgres/administrator.blogs.png and b/sample/postgres/administrator.blogs.png differ diff --git a/sample/postgres/backup.blog_options.png b/sample/postgres/backup.blog_options.png index 04a4babed..63989710e 100644 Binary files a/sample/postgres/backup.blog_options.png and b/sample/postgres/backup.blog_options.png differ diff --git a/sample/postgres/backup.blogs.png b/sample/postgres/backup.blogs.png index ff1156f00..e63886b1f 100644 Binary files a/sample/postgres/backup.blogs.png and b/sample/postgres/backup.blogs.png differ diff --git a/sample/postgres/public.CamelizeTable.png b/sample/postgres/public.CamelizeTable.png index c6f464746..7d2fc5bf1 100644 Binary files a/sample/postgres/public.CamelizeTable.png and b/sample/postgres/public.CamelizeTable.png differ diff --git a/sample/postgres/public.comment_stars.png b/sample/postgres/public.comment_stars.png index 1b8e5df63..d41a785ea 100644 Binary files a/sample/postgres/public.comment_stars.png and b/sample/postgres/public.comment_stars.png differ diff --git a/sample/postgres/public.comments.png b/sample/postgres/public.comments.png index a0e214067..1acc5b12d 100644 Binary files a/sample/postgres/public.comments.png and b/sample/postgres/public.comments.png differ diff --git a/sample/postgres/public.hyphen-table.png b/sample/postgres/public.hyphen-table.png index e92838923..2c391a84a 100644 Binary files a/sample/postgres/public.hyphen-table.png and b/sample/postgres/public.hyphen-table.png differ diff --git a/sample/postgres/public.logs.png b/sample/postgres/public.logs.png index 548f680d7..adb0781d1 100644 Binary files a/sample/postgres/public.logs.png and b/sample/postgres/public.logs.png differ diff --git a/sample/postgres/public.post_comment_stars.png b/sample/postgres/public.post_comment_stars.png index f0a6d1ca5..2af7d5caf 100644 Binary files a/sample/postgres/public.post_comment_stars.png and b/sample/postgres/public.post_comment_stars.png differ diff --git a/sample/postgres/public.post_comments.png b/sample/postgres/public.post_comments.png index 145af7e61..8df150cab 100644 Binary files a/sample/postgres/public.post_comments.png and b/sample/postgres/public.post_comments.png differ diff --git a/sample/postgres/public.posts.png b/sample/postgres/public.posts.png index 193fe1aa5..e34c3e948 100644 Binary files a/sample/postgres/public.posts.png and b/sample/postgres/public.posts.png differ diff --git a/sample/postgres/public.user_options.png b/sample/postgres/public.user_options.png index 8fa8d30b9..0ccfe6c4b 100644 Binary files a/sample/postgres/public.user_options.png and b/sample/postgres/public.user_options.png differ diff --git a/sample/postgres/public.users.png b/sample/postgres/public.users.png index f5f581636..0d5ba1276 100644 Binary files a/sample/postgres/public.users.png and b/sample/postgres/public.users.png differ diff --git a/sample/postgres/schema.png b/sample/postgres/schema.png index 35b5251a3..4894c27f5 100644 Binary files a/sample/postgres/schema.png and b/sample/postgres/schema.png differ diff --git a/sample/postgres/time.bar.png b/sample/postgres/time.bar.png index d34108b55..0de8e7d02 100644 Binary files a/sample/postgres/time.bar.png and b/sample/postgres/time.bar.png differ diff --git a/sample/postgres/time.hyphenated-table.png b/sample/postgres/time.hyphenated-table.png index 888af27b4..cd972759f 100644 Binary files a/sample/postgres/time.hyphenated-table.png and b/sample/postgres/time.hyphenated-table.png differ diff --git a/sample/postgres/time.referencing.png b/sample/postgres/time.referencing.png index df3414cda..cb6eea1f9 100644 Binary files a/sample/postgres/time.referencing.png and b/sample/postgres/time.referencing.png differ diff --git a/sample/sqlite/CamelizeTable.png b/sample/sqlite/CamelizeTable.png index 55d411b88..f10ea4280 100644 Binary files a/sample/sqlite/CamelizeTable.png and b/sample/sqlite/CamelizeTable.png differ diff --git a/sample/sqlite/access_log.png b/sample/sqlite/access_log.png index e6696b36e..5413cd4e9 100644 Binary files a/sample/sqlite/access_log.png and b/sample/sqlite/access_log.png differ diff --git a/sample/sqlite/check_constraints.png b/sample/sqlite/check_constraints.png index 77b0c4be1..7e8fc588d 100644 Binary files a/sample/sqlite/check_constraints.png and b/sample/sqlite/check_constraints.png differ diff --git a/sample/sqlite/comment_stars.png b/sample/sqlite/comment_stars.png index c2ab11cd8..c2babcd9a 100644 Binary files a/sample/sqlite/comment_stars.png and b/sample/sqlite/comment_stars.png differ diff --git a/sample/sqlite/comments.png b/sample/sqlite/comments.png index 5ab2118ae..d8bd93f2a 100644 Binary files a/sample/sqlite/comments.png and b/sample/sqlite/comments.png differ diff --git a/sample/sqlite/hyphen-table.png b/sample/sqlite/hyphen-table.png index 8266ca7a2..2becc32f9 100644 Binary files a/sample/sqlite/hyphen-table.png and b/sample/sqlite/hyphen-table.png differ diff --git a/sample/sqlite/logs.png b/sample/sqlite/logs.png index c20dfc73c..f5a9c7f2a 100644 Binary files a/sample/sqlite/logs.png and b/sample/sqlite/logs.png differ diff --git a/sample/sqlite/post_comments.png b/sample/sqlite/post_comments.png index 31d4e6a26..b41c623ef 100644 Binary files a/sample/sqlite/post_comments.png and b/sample/sqlite/post_comments.png differ diff --git a/sample/sqlite/posts.png b/sample/sqlite/posts.png index ad83451f0..5065bf9de 100644 Binary files a/sample/sqlite/posts.png and b/sample/sqlite/posts.png differ diff --git a/sample/sqlite/schema.png b/sample/sqlite/schema.png index b7052c28d..faf9f3a59 100644 Binary files a/sample/sqlite/schema.png and b/sample/sqlite/schema.png differ diff --git a/sample/sqlite/syslog.png b/sample/sqlite/syslog.png index 1fb029a0e..96bc7d90b 100644 Binary files a/sample/sqlite/syslog.png and b/sample/sqlite/syslog.png differ diff --git a/sample/sqlite/user_options.png b/sample/sqlite/user_options.png index 8912a4fda..62df671c4 100644 Binary files a/sample/sqlite/user_options.png and b/sample/sqlite/user_options.png differ diff --git a/sample/sqlite/users.png b/sample/sqlite/users.png index 81b7d62d6..7a3b8d7c6 100644 Binary files a/sample/sqlite/users.png and b/sample/sqlite/users.png differ diff --git a/sample/svg/comment_stars.svg b/sample/svg/comment_stars.svg index 081465058..a5f91231a 100644 --- a/sample/svg/comment_stars.svg +++ b/sample/svg/comment_stars.svg @@ -4,151 +4,143 @@ - - + + comment_stars - + comment_stars - - -comment_stars - -[BASE TABLE] - -id -[bigint(20)] - -user_id -[int(11)] - -comment_post_id -[bigint(20)] - -comment_user_id -[int(11)] - -created -[timestamp] - -updated -[timestamp] - + + +comment_stars + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +comment_post_id +[bigint(20)] + +comment_user_id +[int(11)] + +created +[timestamp] + +updated +[timestamp] + comments - - -comments - -[BASE TABLE] -Comments -Multi-line -table -comment - -id -[bigint(20)] - -post_id -[bigint(20)] - -user_id -[int(11)] - -comment -[text] - Comment Multi-line column comment - -created -[datetime] - -updated -[datetime] + + +comments + +[BASE TABLE] + +id +[bigint(20)] + +post_id +[bigint(20)] + +user_id +[int(11)] + +comment +[text] + +created +[datetime] + +updated +[datetime] comment_stars:comment_post_id->comments:post_id - - -FOREIGN KEY (comment_post_id, comment_user_id) REFERENCES comments (post_id, user_id) + + +FOREIGN KEY (comment_post_id, comment_user_id) REFERENCES comments (post_id, user_id) users - - -users - -[BASE TABLE] -Users table - -id -[int(11)] - -username -[varchar(50)] - -password -[varchar(50)] - -email -[varchar(355)] - ex. user@example.com - -created -[timestamp] - -updated -[timestamp] + + +users + +[BASE TABLE] + +id +[int(11)] + +username +[varchar(50)] + +password +[varchar(50)] + +email +[varchar(355)] + +created +[timestamp] + +updated +[timestamp] comment_stars:comment_user_id->users:id - - -FOREIGN KEY (comment_user_id) REFERENCES users (id) + + +FOREIGN KEY (comment_user_id) REFERENCES users (id) logs - - -logs - -[BASE TABLE] -Auditログ - -id -[bigint(20)] - -user_id -[int(11)] - -post_id -[bigint(20)] - -comment_id -[bigint(20)] - -comment_star_id -[bigint(20)] - -payload -[text] - -created -[datetime] + + +logs + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +post_id +[bigint(20)] + +comment_id +[bigint(20)] + +comment_star_id +[bigint(20)] + +payload +[text] + +created +[datetime] logs:comment_star_id->comment_stars:id - - -Additional Relation + + +Additional Relation diff --git a/sample/svg/comments.svg b/sample/svg/comments.svg index dd0aaf702..0bc415cde 100644 --- a/sample/svg/comments.svg +++ b/sample/svg/comments.svg @@ -4,191 +4,180 @@ - - + + comments - + comments - - -comments - -[BASE TABLE] -Comments -Multi-line -table -comment - -id -[bigint(20)] - -post_id -[bigint(20)] - -user_id -[int(11)] - -comment -[text] - Comment Multi-line column comment - -created -[datetime] - -updated -[datetime] - + + +comments + +[BASE TABLE] + +id +[bigint(20)] + +post_id +[bigint(20)] + +user_id +[int(11)] + +comment +[text] + +created +[datetime] + +updated +[datetime] + posts - - -posts - -[BASE TABLE] -Posts table - -id -[bigint(20)] - -user_id -[int(11)] - -title -[varchar(255)] - -body -[text] - post body - -post_type -[enum('public','private','draft')] - public/private/draft - -created -[datetime] - -updated -[datetime] + + +posts + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +title +[varchar(255)] + +body +[text] + +post_type +[enum('public','private','draft')] + +created +[datetime] + +updated +[datetime] comments:post_id->posts:id - - -FOREIGN KEY (post_id) REFERENCES posts (id) + + +FOREIGN KEY (post_id) REFERENCES posts (id) users - - -users - -[BASE TABLE] -Users table - -id -[int(11)] - -username -[varchar(50)] - -password -[varchar(50)] - -email -[varchar(355)] - ex. user@example.com - -created -[timestamp] - -updated -[timestamp] + + +users + +[BASE TABLE] + +id +[int(11)] + +username +[varchar(50)] + +password +[varchar(50)] + +email +[varchar(355)] + +created +[timestamp] + +updated +[timestamp] comments:user_id->users:id - - -FOREIGN KEY (user_id) REFERENCES users (id) + + +FOREIGN KEY (user_id) REFERENCES users (id) logs - - -logs - -[BASE TABLE] -Auditログ - -id -[bigint(20)] - -user_id -[int(11)] - -post_id -[bigint(20)] - -comment_id -[bigint(20)] - -comment_star_id -[bigint(20)] - -payload -[text] - -created -[datetime] + + +logs + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +post_id +[bigint(20)] + +comment_id +[bigint(20)] + +comment_star_id +[bigint(20)] + +payload +[text] + +created +[datetime] logs:comment_id->comments:id - - -Additional Relation + + +Additional Relation comment_stars - - -comment_stars - -[BASE TABLE] - -id -[bigint(20)] - -user_id -[int(11)] - -comment_post_id -[bigint(20)] - -comment_user_id -[int(11)] - -created -[timestamp] - -updated -[timestamp] + + +comment_stars + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +comment_post_id +[bigint(20)] + +comment_user_id +[int(11)] + +created +[timestamp] + +updated +[timestamp] comment_stars:comment_post_id->comments:post_id - - -FOREIGN KEY (comment_post_id, comment_user_id) REFERENCES comments (post_id, user_id) + + +FOREIGN KEY (comment_post_id, comment_user_id) REFERENCES comments (post_id, user_id) diff --git a/sample/svg/logs.svg b/sample/svg/logs.svg index 899bc57fe..96fcb66b5 100644 --- a/sample/svg/logs.svg +++ b/sample/svg/logs.svg @@ -4,191 +4,180 @@ - - + + logs - + logs - - -logs - -[BASE TABLE] -Auditログ - -id -[bigint(20)] - -user_id -[int(11)] - -post_id -[bigint(20)] - -comment_id -[bigint(20)] - -comment_star_id -[bigint(20)] - -payload -[text] - -created -[datetime] - + + +logs + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +post_id +[bigint(20)] + +comment_id +[bigint(20)] + +comment_star_id +[bigint(20)] + +payload +[text] + +created +[datetime] + users - - -users - -[BASE TABLE] -Users table - -id -[int(11)] - -username -[varchar(50)] - -password -[varchar(50)] - -email -[varchar(355)] - ex. user@example.com - -created -[timestamp] - -updated -[timestamp] + + +users + +[BASE TABLE] + +id +[int(11)] + +username +[varchar(50)] + +password +[varchar(50)] + +email +[varchar(355)] + +created +[timestamp] + +updated +[timestamp] logs:user_id->users:id - - -logs->users + + +logs->users posts - - -posts - -[BASE TABLE] -Posts table - -id -[bigint(20)] - -user_id -[int(11)] - -title -[varchar(255)] - -body -[text] - post body - -post_type -[enum('public','private','draft')] - public/private/draft - -created -[datetime] - -updated -[datetime] + + +posts + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +title +[varchar(255)] + +body +[text] + +post_type +[enum('public','private','draft')] + +created +[datetime] + +updated +[datetime] logs:post_id->posts:id - - -Additional Relation + + +Additional Relation comments - - -comments - -[BASE TABLE] -Comments -Multi-line -table -comment - -id -[bigint(20)] - -post_id -[bigint(20)] - -user_id -[int(11)] - -comment -[text] - Comment Multi-line column comment - -created -[datetime] - -updated -[datetime] + + +comments + +[BASE TABLE] + +id +[bigint(20)] + +post_id +[bigint(20)] + +user_id +[int(11)] + +comment +[text] + +created +[datetime] + +updated +[datetime] logs:comment_id->comments:id - - -Additional Relation + + +Additional Relation comment_stars - - -comment_stars - -[BASE TABLE] - -id -[bigint(20)] - -user_id -[int(11)] - -comment_post_id -[bigint(20)] - -comment_user_id -[int(11)] - -created -[timestamp] - -updated -[timestamp] + + +comment_stars + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +comment_post_id +[bigint(20)] + +comment_user_id +[int(11)] + +created +[timestamp] + +updated +[timestamp] logs:comment_star_id->comment_stars:id - - -Additional Relation + + +Additional Relation diff --git a/sample/svg/post_comments.svg b/sample/svg/post_comments.svg index e08c0789c..1d4b1c9b2 100644 --- a/sample/svg/post_comments.svg +++ b/sample/svg/post_comments.svg @@ -4,49 +4,41 @@ - - + + post_comments - + post_comments - - -post_comments - -[VIEW] -post and comments View table - -id -[bigint(20)] - comments.id - -title -[varchar(255)] - posts.title - -post_user -[varchar(50)] - posts.users.username - -comment -[text] - Comment Multi-line column comment - -comment_user -[varchar(50)] - comments.users.username - -created -[datetime] - comments.created - -updated -[datetime] - comments.updated - + + +post_comments + +[VIEW] + +id +[bigint(20)] + +title +[varchar(255)] + +post_user +[varchar(50)] + +comment +[text] + +comment_user +[varchar(50)] + +created +[datetime] + +updated +[datetime] + diff --git a/sample/svg/posts.svg b/sample/svg/posts.svg index edbbea347..8b83852df 100644 --- a/sample/svg/posts.svg +++ b/sample/svg/posts.svg @@ -4,157 +4,146 @@ - - + + posts - + posts - - -posts - -[BASE TABLE] -Posts table - -id -[bigint(20)] - -user_id -[int(11)] - -title -[varchar(255)] - -body -[text] - post body - -post_type -[enum('public','private','draft')] - public/private/draft - -created -[datetime] - -updated -[datetime] - + + +posts + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +title +[varchar(255)] + +body +[text] + +post_type +[enum('public','private','draft')] + +created +[datetime] + +updated +[datetime] + users - - -users - -[BASE TABLE] -Users table - -id -[int(11)] - -username -[varchar(50)] - -password -[varchar(50)] - -email -[varchar(355)] - ex. user@example.com - -created -[timestamp] - -updated -[timestamp] + + +users + +[BASE TABLE] + +id +[int(11)] + +username +[varchar(50)] + +password +[varchar(50)] + +email +[varchar(355)] + +created +[timestamp] + +updated +[timestamp] posts:user_id->users:id - - -FOREIGN KEY (user_id) REFERENCES users (id) + + +FOREIGN KEY (user_id) REFERENCES users (id) comments - - -comments - -[BASE TABLE] -Comments -Multi-line -table -comment - -id -[bigint(20)] - -post_id -[bigint(20)] - -user_id -[int(11)] - -comment -[text] - Comment Multi-line column comment - -created -[datetime] - -updated -[datetime] + + +comments + +[BASE TABLE] + +id +[bigint(20)] + +post_id +[bigint(20)] + +user_id +[int(11)] + +comment +[text] + +created +[datetime] + +updated +[datetime] comments:post_id->posts:id - - -FOREIGN KEY (post_id) REFERENCES posts (id) + + +FOREIGN KEY (post_id) REFERENCES posts (id) logs - - -logs - -[BASE TABLE] -Auditログ - -id -[bigint(20)] - -user_id -[int(11)] - -post_id -[bigint(20)] - -comment_id -[bigint(20)] - -comment_star_id -[bigint(20)] - -payload -[text] - -created -[datetime] + + +logs + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +post_id +[bigint(20)] + +comment_id +[bigint(20)] + +comment_star_id +[bigint(20)] + +payload +[text] + +created +[datetime] logs:post_id->posts:id - - -Additional Relation + + +Additional Relation diff --git a/sample/svg/schema.svg b/sample/svg/schema.svg index 00b2f26d3..eb9dcfe46 100644 --- a/sample/svg/schema.svg +++ b/sample/svg/schema.svg @@ -4,325 +4,305 @@ - - + + testdb - + CamelizeTable - - -CamelizeTable - -[BASE TABLE] - -id -[bigint(20)] - -created -[datetime] + + +CamelizeTable + +[BASE TABLE] + +id +[bigint(20)] + +created +[datetime] comment_stars - - -comment_stars - -[BASE TABLE] - -id -[bigint(20)] - -user_id -[int(11)] - -comment_post_id -[bigint(20)] - -comment_user_id -[int(11)] - -created -[timestamp] - -updated -[timestamp] + + +comment_stars + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +comment_post_id +[bigint(20)] + +comment_user_id +[int(11)] + +created +[timestamp] + +updated +[timestamp] comments - - -comments - -[BASE TABLE] -Comments -Multi-line -table -comment - -id -[bigint(20)] - -post_id -[bigint(20)] - -user_id -[int(11)] - -comment -[text] - Comment Multi-line column comment - -created -[datetime] - -updated -[datetime] + + +comments + +[BASE TABLE] + +id +[bigint(20)] + +post_id +[bigint(20)] + +user_id +[int(11)] + +comment +[text] + +created +[datetime] + +updated +[datetime] comment_stars:comment_post_id->comments:post_id - - -FOREIGN KEY (comment_post_id, comment_user_id) REFERENCES comments (post_id, user_id) + + +FOREIGN KEY (comment_post_id, comment_user_id) REFERENCES comments (post_id, user_id) users - - -users - -[BASE TABLE] -Users table - -id -[int(11)] - -username -[varchar(50)] - -password -[varchar(50)] - -email -[varchar(355)] - ex. user@example.com - -created -[timestamp] - -updated -[timestamp] + + +users + +[BASE TABLE] + +id +[int(11)] + +username +[varchar(50)] + +password +[varchar(50)] + +email +[varchar(355)] + +created +[timestamp] + +updated +[timestamp] comment_stars:comment_user_id->users:id - - -FOREIGN KEY (comment_user_id) REFERENCES users (id) + + +FOREIGN KEY (comment_user_id) REFERENCES users (id) posts - - -posts - -[BASE TABLE] -Posts table - -id -[bigint(20)] - -user_id -[int(11)] - -title -[varchar(255)] - -body -[text] - post body - -post_type -[enum('public','private','draft')] - public/private/draft - -created -[datetime] - -updated -[datetime] + + +posts + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +title +[varchar(255)] + +body +[text] + +post_type +[enum('public','private','draft')] + +created +[datetime] + +updated +[datetime] comments:post_id->posts:id - - -FOREIGN KEY (post_id) REFERENCES posts (id) + + +FOREIGN KEY (post_id) REFERENCES posts (id) comments:user_id->users:id - - -FOREIGN KEY (user_id) REFERENCES users (id) + + +FOREIGN KEY (user_id) REFERENCES users (id) hyphen-table - - -hyphen-table - -[BASE TABLE] - -id -[bigint(20)] - -hyphen-column -[text] - -created -[datetime] + + +hyphen-table + +[BASE TABLE] + +id +[bigint(20)] + +hyphen-column +[text] + +created +[datetime] logs - - -logs - -[BASE TABLE] -Auditログ - -id -[bigint(20)] - -user_id -[int(11)] - -post_id -[bigint(20)] - -comment_id -[bigint(20)] - -comment_star_id -[bigint(20)] - -payload -[text] - -created -[datetime] + + +logs + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +post_id +[bigint(20)] + +comment_id +[bigint(20)] + +comment_star_id +[bigint(20)] + +payload +[text] + +created +[datetime] logs:comment_star_id->comment_stars:id - - -Additional Relation + + +Additional Relation logs:comment_id->comments:id - - -Additional Relation + + +Additional Relation logs:post_id->posts:id - - -Additional Relation + + +Additional Relation logs:user_id->users:id - - -logs->users + + +logs->users post_comments - - -post_comments - -[VIEW] -post and comments View table - -id -[bigint(20)] - comments.id - -title -[varchar(255)] - posts.title - -post_user -[varchar(50)] - posts.users.username - -comment -[text] - Comment Multi-line column comment - -comment_user -[varchar(50)] - comments.users.username - -created -[datetime] - comments.created - -updated -[datetime] - comments.updated + + +post_comments + +[VIEW] + +id +[bigint(20)] + +title +[varchar(255)] + +post_user +[varchar(50)] + +comment +[text] + +comment_user +[varchar(50)] + +created +[datetime] + +updated +[datetime] posts:user_id->users:id - - -FOREIGN KEY (user_id) REFERENCES users (id) + + +FOREIGN KEY (user_id) REFERENCES users (id) user_options - - -user_options - -[BASE TABLE] -User options table - -user_id -[int(11)] - -show_email -[tinyint(1)] - -created -[timestamp] - -updated -[timestamp] + + +user_options + +[BASE TABLE] + +user_id +[int(11)] + +show_email +[tinyint(1)] + +created +[timestamp] + +updated +[timestamp] user_options:user_id->users:id - - -FOREIGN KEY (user_id) REFERENCES users (id) + + +FOREIGN KEY (user_id) REFERENCES users (id) diff --git a/sample/svg/user_options.svg b/sample/svg/user_options.svg index 00cec3c9b..a29add376 100644 --- a/sample/svg/user_options.svg +++ b/sample/svg/user_options.svg @@ -4,69 +4,66 @@ - - + + user_options - + user_options - - -user_options - -[BASE TABLE] -User options table - -user_id -[int(11)] - -show_email -[tinyint(1)] - -created -[timestamp] - -updated -[timestamp] - + + +user_options + +[BASE TABLE] + +user_id +[int(11)] + +show_email +[tinyint(1)] + +created +[timestamp] + +updated +[timestamp] + users - - -users - -[BASE TABLE] -Users table - -id -[int(11)] - -username -[varchar(50)] - -password -[varchar(50)] - -email -[varchar(355)] - ex. user@example.com - -created -[timestamp] - -updated -[timestamp] + + +users + +[BASE TABLE] + +id +[int(11)] + +username +[varchar(50)] + +password +[varchar(50)] + +email +[varchar(355)] + +created +[timestamp] + +updated +[timestamp] user_options:user_id->users:id - - -FOREIGN KEY (user_id) REFERENCES users (id) + + +FOREIGN KEY (user_id) REFERENCES users (id) diff --git a/sample/svg/users.svg b/sample/svg/users.svg index 61a6f7c99..1dbf43b0a 100644 --- a/sample/svg/users.svg +++ b/sample/svg/users.svg @@ -4,220 +4,208 @@ - - + + users - + users - - -users - -[BASE TABLE] -Users table - -id -[int(11)] - -username -[varchar(50)] - -password -[varchar(50)] - -email -[varchar(355)] - ex. user@example.com - -created -[timestamp] - -updated -[timestamp] - + + +users + +[BASE TABLE] + +id +[int(11)] + +username +[varchar(50)] + +password +[varchar(50)] + +email +[varchar(355)] + +created +[timestamp] + +updated +[timestamp] + comment_stars - - -comment_stars - -[BASE TABLE] - -id -[bigint(20)] - -user_id -[int(11)] - -comment_post_id -[bigint(20)] - -comment_user_id -[int(11)] - -created -[timestamp] - -updated -[timestamp] + + +comment_stars + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +comment_post_id +[bigint(20)] + +comment_user_id +[int(11)] + +created +[timestamp] + +updated +[timestamp] comment_stars:comment_user_id->users:id - - -FOREIGN KEY (comment_user_id) REFERENCES users (id) + + +FOREIGN KEY (comment_user_id) REFERENCES users (id) comments - - -comments - -[BASE TABLE] -Comments -Multi-line -table -comment - -id -[bigint(20)] - -post_id -[bigint(20)] - -user_id -[int(11)] - -comment -[text] - Comment Multi-line column comment - -created -[datetime] - -updated -[datetime] + + +comments + +[BASE TABLE] + +id +[bigint(20)] + +post_id +[bigint(20)] + +user_id +[int(11)] + +comment +[text] + +created +[datetime] + +updated +[datetime] comments:user_id->users:id - - -FOREIGN KEY (user_id) REFERENCES users (id) + + +FOREIGN KEY (user_id) REFERENCES users (id) posts - - -posts - -[BASE TABLE] -Posts table - -id -[bigint(20)] - -user_id -[int(11)] - -title -[varchar(255)] - -body -[text] - post body - -post_type -[enum('public','private','draft')] - public/private/draft - -created -[datetime] - -updated -[datetime] + + +posts + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +title +[varchar(255)] + +body +[text] + +post_type +[enum('public','private','draft')] + +created +[datetime] + +updated +[datetime] posts:user_id->users:id - - -FOREIGN KEY (user_id) REFERENCES users (id) + + +FOREIGN KEY (user_id) REFERENCES users (id) user_options - - -user_options - -[BASE TABLE] -User options table - -user_id -[int(11)] - -show_email -[tinyint(1)] - -created -[timestamp] - -updated -[timestamp] + + +user_options + +[BASE TABLE] + +user_id +[int(11)] + +show_email +[tinyint(1)] + +created +[timestamp] + +updated +[timestamp] user_options:user_id->users:id - - -FOREIGN KEY (user_id) REFERENCES users (id) + + +FOREIGN KEY (user_id) REFERENCES users (id) logs - - -logs - -[BASE TABLE] -Auditログ - -id -[bigint(20)] - -user_id -[int(11)] - -post_id -[bigint(20)] - -comment_id -[bigint(20)] - -comment_star_id -[bigint(20)] - -payload -[text] - -created -[datetime] + + +logs + +[BASE TABLE] + +id +[bigint(20)] + +user_id +[int(11)] + +post_id +[bigint(20)] + +comment_id +[bigint(20)] + +comment_star_id +[bigint(20)] + +payload +[text] + +created +[datetime] logs:user_id->users:id - - -logs->users + + +logs->users diff --git a/testdata/font_test_tbls.yml b/testdata/font_test_tbls.yml new file mode 100644 index 000000000..7c64e09c8 --- /dev/null +++ b/testdata/font_test_tbls.yml @@ -0,0 +1,23 @@ +--- +er: + comment: true + font: ./testdata/mplus-1p-light.ttf +labels: + - サンプル + - tbls +comments: + - + table: posts + tableComment: エントリ + columnComments: + body: 本文 + - + table: post_comments + tableComment: post and comments View table + columnComments: + id: comments.id + title: posts.title + post_user: posts.users.username + comment_user: comments.users.username + created: comments.created + updated: comments.updated diff --git a/testdata/mplus-1p-light.ttf b/testdata/mplus-1p-light.ttf new file mode 100644 index 000000000..0a2bcfd1f Binary files /dev/null and b/testdata/mplus-1p-light.ttf differ diff --git a/testdata/test_tbls.yml b/testdata/test_tbls.yml index 62167e5d1..cd1b2d174 100644 --- a/testdata/test_tbls.yml +++ b/testdata/test_tbls.yml @@ -1,7 +1,5 @@ --- desc: Sample database document. -er: - comment: true labels: - sample - tbls