Skip to content

Commit

Permalink
docs: add RENAME CONSTRAINT diagram
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
jseldess committed Apr 1, 2019
1 parent cf19139 commit 4e428d0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docs/generated/sql/bnf/rename_constraint.bnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
alter_onetable_stmt ::=
'ALTER' 'TABLE' table_name 'RENAME' 'CONSTRAINT' current_name 'TO' name
| 'ALTER' 'TABLE' 'IF' 'EXISTS' table_name 'RENAME' 'CONSTRAINT' current_name 'TO' name
12 changes: 10 additions & 2 deletions pkg/cmd/docgen/diagrams.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,14 +838,22 @@ var specs = []stmtSpec{
{
name: "release_savepoint",
stmt: "release_stmt",
inline: []string{"savepoint_name"}},
inline: []string{"savepoint_name"},
},
{
name: "rename_column",
stmt: "alter_rename_table_stmt",
inline: []string{"opt_column"},
match: []*regexp.Regexp{regexp.MustCompile("'ALTER' 'TABLE' .* 'RENAME' ('COLUMN'|name)")},
replace: map[string]string{"relation_expr": "table_name", "name 'TO'": "current_name 'TO'"},
unlink: []string{"table_name", "current_name"}},
unlink: []string{"table_name", "current_name"},
},
{
name: "rename_constraint",
stmt: "alter_onetable_stmt",
replace: map[string]string{"relation_expr": "table_name", "alter_table_cmds": "'RENAME' 'CONSTRAINT' current_name 'TO' name"},
unlink: []string{"table_name", "current_name"},
},
{
name: "rename_database",
stmt: "alter_rename_database_stmt",
Expand Down

0 comments on commit 4e428d0

Please sign in to comment.