Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Graphviz dot for generate ER diagram .png
Browse files Browse the repository at this point in the history
k1LoW committed May 29, 2018
1 parent 7f1a209 commit 9dbb3b7
Showing 55 changed files with 195 additions and 21 deletions.
55 changes: 49 additions & 6 deletions cmd/doc.go
Original file line number Diff line number Diff line change
@@ -23,9 +23,13 @@ package cmd
import (
"fmt"
"github.com/k1LoW/tbls/db"
"github.com/k1LoW/tbls/output/dot"
"github.com/k1LoW/tbls/output/md"
"github.com/k1LoW/tbls/schema"
"github.com/spf13/cobra"
"os"
"os/exec"
"path/filepath"
)

// docCmd represents the doc command
@@ -64,24 +68,63 @@ var docCmd = &cobra.Command{
}
}

switch outputFormat {
case "md":
err = md.Output(s, outputPath, force)
default:
err = fmt.Errorf("Error: %s", "unsupported output format")
_, err = exec.Command("which", "dot").Output()
if err == nil {
err := withDot(s, outputPath)
if err != nil {
fmt.Println(err)
}
}

err = md.Output(s, outputPath, force)

if err != nil {
fmt.Println(err)
os.Exit(1)
}
},
}

// withDot ...
func withDot(s *schema.Schema, outputPath string) error {
fullPath, err := filepath.Abs(outputPath)
if err != nil {
return err
}
fmt.Printf("%s\n", filepath.Join(outputPath, "schema.png"))
c := exec.Command("dot", "-Tpng", "-o", filepath.Join(fullPath, "schema.png"))
stdin, _ := c.StdinPipe()
err = dot.OutputSchema(stdin, s)
if err != nil {
return err
}
stdin.Close()
err = c.Run()
if err != nil {
return err
}
// tables
for _, t := range s.Tables {
fmt.Printf("%s\n", filepath.Join(outputPath, fmt.Sprintf("%s.png", t.Name)))
c := exec.Command("dot", "-Tpng", "-o", filepath.Join(fullPath, fmt.Sprintf("%s.png", t.Name)))
stdin, _ := c.StdinPipe()
err = dot.OutputSchema(stdin, s)
if err != nil {
return err
}
stdin.Close()
err = c.Run()
if err != nil {
return err
}
}

return nil
}

func init() {
rootCmd.AddCommand(docCmd)
docCmd.Flags().BoolVarP(&force, "force", "f", false, "force")
docCmd.Flags().BoolVarP(&sort, "sort", "", false, "sort")
docCmd.Flags().StringVarP(&additionalDataPath, "add", "a", "", "additional schema data path")
docCmd.Flags().StringVarP(&outputFormat, "output", "o", "md", "output format")
}
3 changes: 0 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -36,9 +36,6 @@ var sort bool
// additionalDataPath is a additional data path
var additionalDataPath string

// outputFormat is output format
var outputFormat string

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "tbls",
14 changes: 7 additions & 7 deletions output/dot/templates.go
Original file line number Diff line number Diff line change
@@ -11,19 +11,19 @@ var _Assets5bd148e6149bb9adcdddfcf8cc46d6e3047dbe26 = "digraph {{ .Table.Name }}

// Assets returns go-assets FileSystem
var Assets = assets.NewFileSystem(map[string][]string{"/": []string{"schema.dot.tmpl", "table.dot.tmpl"}}, map[string]*assets.File{
"/": &assets.File{
"/table.dot.tmpl": &assets.File{
Path: "/table.dot.tmpl",
FileMode: 0x1a4,
Mtime: time.Unix(1527595732, 1527595732000000000),
Data: []byte(_Assets5bd148e6149bb9adcdddfcf8cc46d6e3047dbe26),
}, "/": &assets.File{
Path: "/",
FileMode: 0x800001ed,
Mtime: time.Unix(1527518947, 1527518947000000000),
Mtime: time.Unix(1527595732, 1527595732000000000),
Data: nil,
}, "/schema.dot.tmpl": &assets.File{
Path: "/schema.dot.tmpl",
FileMode: 0x1a4,
Mtime: time.Unix(1527512634, 1527512634000000000),
Data: []byte(_Assets21532ae17ad95976ac467eeaeab81f2bb1d537e4),
}, "/table.dot.tmpl": &assets.File{
Path: "/table.dot.tmpl",
FileMode: 0x1a4,
Mtime: time.Unix(1527518947, 1527518947000000000),
Data: []byte(_Assets5bd148e6149bb9adcdddfcf8cc46d6e3047dbe26),
}}, "")
26 changes: 26 additions & 0 deletions output/md/md.go
Original file line number Diff line number Diff line change
@@ -34,8 +34,13 @@ func Output(s *schema.Schema, path string, force bool) error {
if err != nil {
return err
}
er := false
if _, err := os.Lstat(filepath.Join(fullPath, "schema.png")); err == nil {
er = true
}
err = tmpl.Execute(file, map[string]interface{}{
"Schema": s,
"er": er,
})
if err != nil {
return err
@@ -55,8 +60,13 @@ func Output(s *schema.Schema, path string, force bool) error {
if err != nil {
return err
}
er := false
if _, err := os.Lstat(filepath.Join(fullPath, fmt.Sprintf("%s.png", t.Name))); err == nil {
er = true
}
err = tmpl.Execute(file, map[string]interface{}{
"Table": t,
"er": er,
})
if err != nil {
return err
@@ -84,8 +94,16 @@ func Diff(s *schema.Schema, path string) error {
f, _ := Assets.Open(filepath.Join("/", "index.md.tmpl"))
bs, _ := ioutil.ReadAll(f)
tmpl, err := template.New("index").Parse(string(bs))
if err != nil {
return err
}
er := false
if _, err := os.Lstat(filepath.Join(fullPath, "schema.png")); err == nil {
er = true
}
err = tmpl.Execute(a, map[string]interface{}{
"Schema": s,
"er": er,
})
if err != nil {
return err
@@ -111,8 +129,16 @@ func Diff(s *schema.Schema, path string) error {
f, _ := Assets.Open(filepath.Join("/", "table.md.tmpl"))
bs, _ := ioutil.ReadAll(f)
tmpl, err := template.New(t.Name).Parse(string(bs))
if err != nil {
return err
}
er := false
if _, err := os.Lstat(filepath.Join(fullPath, fmt.Sprintf("%s.png", t.Name))); err == nil {
er = true
}
err = tmpl.Execute(a, map[string]interface{}{
"Table": t,
"er": er,
})
if err != nil {
return err
10 changes: 5 additions & 5 deletions output/md/templates.go
Original file line number Diff line number Diff line change
@@ -6,24 +6,24 @@ import (
"github.com/jessevdk/go-assets"
)

var _Assetsac44302fb6150a621aa9d04a0350aac972bf7e18 = "# {{ .Table.Name }}\n\n## Description\n\n{{ .Table.Comment }}\n\n## Columns\n\n| Name | Type | Default | Nullable | Children | Parents | Comment |\n| ---- | ---- | ------- | -------- | -------- | ------- | ------- |\n{{- range $i, $c := .Table.Columns }}\n| {{ $c.Name }} | {{ $c.Type }} | {{ $c.Default.String }} | {{ $c.Nullable }} | {{ range $ii, $r := $c.ChildRelations -}}[{{ $r.Table.Name }}]({{ $r.Table.Name }}.md) {{ end }} | {{ range $ii, $r := $c.ParentRelations -}}[{{ $r.ParentTable.Name }}]({{ $r.ParentTable.Name }}.md) {{ end }} | {{ $c.Comment }} |\n{{- end }}\n\n## Constraints\n\n| Name | Type | Def |\n| ---- | ---- | --- |\n{{- range $i, $c := .Table.Constraints }}\n| {{ $c.Name }} | {{ $c.Type }} | {{ $c.Def }} |\n{{- end }}\n\n## Indexes\n\n| Name | Def |\n| ---- | --- |\n{{- range $i, $idx := .Table.Indexes }}\n| {{ $idx.Name }} | {{ $idx.Def }} |\n{{- end }}\n\n---\n\n> Generated by [tbls](https://github.com/k1LoW/tbls)"
var _Assets43889384df1c6f74d764c29d91b9d5637eb46061 = "# {{ .Schema.Name }}\n\n## Tables\n\n| Name | Columns | Comment | Type |\n| ---- | ------- | ------- | ---- |\n{{- range $i, $t := .Schema.Tables }}\n| [{{ $t.Name }}]({{ $t.Name }}.md) | {{ len $t.Columns }} | {{ $t.Comment }} | {{ $t.Type }} |\n{{- end }}\n\n---\n\n> Generated by [tbls](https://github.com/k1LoW/tbls)"
var _Assets43889384df1c6f74d764c29d91b9d5637eb46061 = "# {{ .Schema.Name }}\n\n## Tables\n\n| Name | Columns | Comment | Type |\n| ---- | ------- | ------- | ---- |\n{{- range $i, $t := .Schema.Tables }}\n| [{{ $t.Name }}]({{ $t.Name }}.md) | {{ len $t.Columns }} | {{ $t.Comment }} | {{ $t.Type }} |\n{{- end }}\n\n{{ if .er -}}\n## Relations\n\n![er](schema.png)\n{{- end }}\n\n---\n\n> Generated by [tbls](https://github.com/k1LoW/tbls)"
var _Assetsac44302fb6150a621aa9d04a0350aac972bf7e18 = "# {{ .Table.Name }}\n\n## Description\n\n{{ .Table.Comment }}\n\n## Columns\n\n| Name | Type | Default | Nullable | Children | Parents | Comment |\n| ---- | ---- | ------- | -------- | -------- | ------- | ------- |\n{{- range $i, $c := .Table.Columns }}\n| {{ $c.Name }} | {{ $c.Type }} | {{ $c.Default.String }} | {{ $c.Nullable }} | {{ range $ii, $r := $c.ChildRelations -}}[{{ $r.Table.Name }}]({{ $r.Table.Name }}.md) {{ end }} | {{ range $ii, $r := $c.ParentRelations -}}[{{ $r.ParentTable.Name }}]({{ $r.ParentTable.Name }}.md) {{ end }} | {{ $c.Comment }} |\n{{- end }}\n\n## Constraints\n\n| Name | Type | Def |\n| ---- | ---- | --- |\n{{- range $i, $c := .Table.Constraints }}\n| {{ $c.Name }} | {{ $c.Type }} | {{ $c.Def }} |\n{{- end }}\n\n## Indexes\n\n| Name | Def |\n| ---- | --- |\n{{- range $i, $idx := .Table.Indexes }}\n| {{ $idx.Name }} | {{ $idx.Def }} |\n{{- end }}\n\n{{ if .er -}}\n## Relations\n\n![er]({{ .Table.Name }}.png)\n{{- end }}\n\n---\n\n> Generated by [tbls](https://github.com/k1LoW/tbls)"

// Assets returns go-assets FileSystem
var Assets = assets.NewFileSystem(map[string][]string{"/": []string{"index.md.tmpl", "table.md.tmpl"}}, map[string]*assets.File{
"/": &assets.File{
Path: "/",
FileMode: 0x800001ed,
Mtime: time.Unix(1527296235, 1527296235000000000),
Mtime: time.Unix(1527597737, 1527597737000000000),
Data: nil,
}, "/index.md.tmpl": &assets.File{
Path: "/index.md.tmpl",
FileMode: 0x1a4,
Mtime: time.Unix(1526904993, 1526904993000000000),
Mtime: time.Unix(1527597737, 1527597737000000000),
Data: []byte(_Assets43889384df1c6f74d764c29d91b9d5637eb46061),
}, "/table.md.tmpl": &assets.File{
Path: "/table.md.tmpl",
FileMode: 0x1a4,
Mtime: time.Unix(1527296235, 1527296235000000000),
Mtime: time.Unix(1527597735, 1527597735000000000),
Data: []byte(_Assetsac44302fb6150a621aa9d04a0350aac972bf7e18),
}}, "")
6 changes: 6 additions & 0 deletions output/md/templates/index.md.tmpl
Original file line number Diff line number Diff line change
@@ -8,6 +8,12 @@
| [{{ $t.Name }}]({{ $t.Name }}.md) | {{ len $t.Columns }} | {{ $t.Comment }} | {{ $t.Type }} |
{{- end }}

{{ if .er -}}
## Relations

![er](schema.png)
{{- end }}

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
6 changes: 6 additions & 0 deletions output/md/templates/table.md.tmpl
Original file line number Diff line number Diff line change
@@ -28,6 +28,12 @@
| {{ $idx.Name }} | {{ $idx.Def }} |
{{- end }}

{{ if .er -}}
## Relations

![er]({{ .Table.Name }}.png)
{{- end }}

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
4 changes: 4 additions & 0 deletions sample/mysql/CamelizeTable.md
Original file line number Diff line number Diff line change
@@ -23,6 +23,10 @@
| ---- | --- |
| PRIMARY | PRIMARY KEY (id) USING BTREE |

## Relations

![er](CamelizeTable.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/mysql/CamelizeTable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/mysql/README.md
Original file line number Diff line number Diff line change
@@ -12,6 +12,10 @@
| [posts](posts.md) | 7 | Posts table | BASE TABLE |
| [users](users.md) | 6 | Users table | BASE TABLE |

## Relations

![er](schema.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
4 changes: 4 additions & 0 deletions sample/mysql/comment_stars.md
Original file line number Diff line number Diff line change
@@ -33,6 +33,10 @@
| 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)
Binary file added sample/mysql/comment_stars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/mysql/comments.md
Original file line number Diff line number Diff line change
@@ -33,6 +33,10 @@
| 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)
Binary file added sample/mysql/comments.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/mysql/logs.md
Original file line number Diff line number Diff line change
@@ -28,6 +28,10 @@
| ---- | --- |
| PRIMARY | PRIMARY KEY (id) USING BTREE |

## Relations

![er](logs.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/mysql/logs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/mysql/post_comments.md
Original file line number Diff line number Diff line change
@@ -26,6 +26,10 @@ VIEW
| Name | Def |
| ---- | --- |

## Relations

![er](post_comments.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/mysql/post_comments.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/mysql/posts.md
Original file line number Diff line number Diff line change
@@ -32,6 +32,10 @@ Posts table
| PRIMARY | PRIMARY KEY (id) USING BTREE |
| user_id | UNIQUE KEY user_id (user_id, title) USING BTREE |

## Relations

![er](posts.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/mysql/posts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sample/mysql/schema.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/mysql/users.md
Original file line number Diff line number Diff line change
@@ -31,6 +31,10 @@ Users table
| 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)
Binary file added sample/mysql/users.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/mysql8/CamelizeTable.md
Original file line number Diff line number Diff line change
@@ -23,6 +23,10 @@
| ---- | --- |
| PRIMARY | PRIMARY KEY (id) USING BTREE |

## Relations

![er](CamelizeTable.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/mysql8/CamelizeTable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/mysql8/README.md
Original file line number Diff line number Diff line change
@@ -12,6 +12,10 @@
| [posts](posts.md) | 7 | Posts table | BASE TABLE |
| [users](users.md) | 6 | Users table | BASE TABLE |

## Relations

![er](schema.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
4 changes: 4 additions & 0 deletions sample/mysql8/comment_stars.md
Original file line number Diff line number Diff line change
@@ -33,6 +33,10 @@
| 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)
Binary file added sample/mysql8/comment_stars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/mysql8/comments.md
Original file line number Diff line number Diff line change
@@ -33,6 +33,10 @@
| 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)
Binary file added sample/mysql8/comments.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/mysql8/logs.md
Original file line number Diff line number Diff line change
@@ -28,6 +28,10 @@
| ---- | --- |
| PRIMARY | PRIMARY KEY (id) USING BTREE |

## Relations

![er](logs.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/mysql8/logs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/mysql8/post_comments.md
Original file line number Diff line number Diff line change
@@ -26,6 +26,10 @@ VIEW
| Name | Def |
| ---- | --- |

## Relations

![er](post_comments.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/mysql8/post_comments.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/mysql8/posts.md
Original file line number Diff line number Diff line change
@@ -32,6 +32,10 @@ Posts table
| PRIMARY | PRIMARY KEY (id) USING BTREE |
| user_id | UNIQUE KEY user_id (user_id, title) USING BTREE |

## Relations

![er](posts.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/mysql8/posts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sample/mysql8/schema.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/mysql8/users.md
Original file line number Diff line number Diff line change
@@ -31,6 +31,10 @@ Users table
| 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)
Binary file added sample/mysql8/users.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/postgres/CamelizeTable.md
Original file line number Diff line number Diff line change
@@ -21,6 +21,10 @@
| Name | Def |
| ---- | --- |

## Relations

![er](CamelizeTable.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/postgres/CamelizeTable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/postgres/README.md
Original file line number Diff line number Diff line change
@@ -12,6 +12,10 @@
| [post_comments](post_comments.md) | 7 | | VIEW |
| [CamelizeTable](CamelizeTable.md) | 2 | | BASE TABLE |

## Relations

![er](schema.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
4 changes: 4 additions & 0 deletions sample/postgres/comment_stars.md
Original file line number Diff line number Diff line change
@@ -29,6 +29,10 @@
| ---- | --- |
| comment_stars_user_id_comment_post_id_comment_user_id_key | CREATE UNIQUE INDEX comment_stars_user_id_comment_post_id_comment_user_id_key ON public.comment_stars USING btree (user_id, comment_post_id, comment_user_id) |

## Relations

![er](comment_stars.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/postgres/comment_stars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/postgres/comments.md
Original file line number Diff line number Diff line change
@@ -32,6 +32,10 @@
| comments_post_id_user_id_key | CREATE UNIQUE INDEX comments_post_id_user_id_key ON public.comments USING btree (post_id, user_id) |
| comments_post_id_user_id_idx | CREATE INDEX comments_post_id_user_id_idx ON public.comments USING btree (post_id, user_id) |

## Relations

![er](comments.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/postgres/comments.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/postgres/logs.md
Original file line number Diff line number Diff line change
@@ -26,6 +26,10 @@
| Name | Def |
| ---- | --- |

## Relations

![er](logs.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/postgres/logs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/postgres/post_comments.md
Original file line number Diff line number Diff line change
@@ -26,6 +26,10 @@
| Name | Def |
| ---- | --- |

## Relations

![er](post_comments.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/postgres/post_comments.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/postgres/posts.md
Original file line number Diff line number Diff line change
@@ -33,6 +33,10 @@ Posts table
| posts_user_id_title_key | CREATE UNIQUE INDEX posts_user_id_title_key ON public.posts USING btree (user_id, title) |
| posts_user_id_idx | CREATE INDEX posts_user_id_idx ON public.posts USING btree (user_id) |

## Relations

![er](posts.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/postgres/posts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sample/postgres/schema.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample/postgres/users.md
Original file line number Diff line number Diff line change
@@ -32,6 +32,10 @@ Users table
| users_username_key | CREATE UNIQUE INDEX users_username_key ON public.users USING btree (username) |
| users_email_key | CREATE UNIQUE INDEX users_email_key ON public.users USING btree (email) |

## Relations

![er](users.png)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Binary file added sample/postgres/users.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9dbb3b7

Please sign in to comment.