Skip to content

Commit

Permalink
fix: display db type after 'database' (#1389)
Browse files Browse the repository at this point in the history
displaying attributes after the resource identifier for consistency with
other resources
  • Loading branch information
worstell authored May 2, 2024
1 parent 26c87a2 commit cf51f26
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions backend/schema/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ type Database struct {
Pos Position `parser:"" protobuf:"1,optional"`

Comments []string `parser:"@Comment*" protobuf:"3"`
Type string `parser:"@'postgres'" protobuf:"4"`
Name string `parser:"'database' @Ident" protobuf:"2"`
Type string `parser:"'database' @'postgres'" protobuf:"4"`
Name string `parser:"@Ident" protobuf:"2"`
}

var _ Decl = (*Database)(nil)
Expand All @@ -29,7 +29,7 @@ func (d *Database) schemaChildren() []Node { return nil }
func (d *Database) String() string {
w := &strings.Builder{}
fmt.Fprint(w, encodeComments(d.Comments))
fmt.Fprintf(w, "%s database %s", d.Type, d.Name)
fmt.Fprintf(w, "database %s %s", d.Type, d.Name)
return w.String()
}

Expand Down
4 changes: 2 additions & 2 deletions backend/schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module todo {
config configValue String
secret secretValue String
postgres database testdb
database postgres testdb
export data CreateRequest {
name {String: String}? +alias json "rqn"
Expand Down Expand Up @@ -392,7 +392,7 @@ func TestParseModule(t *testing.T) {
module todo {
config configValue String
secret secretValue String
postgres database testdb
database postgres testdb
export data CreateRequest {
name {String: String}? +alias json "rqn"
Expand Down
4 changes: 2 additions & 2 deletions backend/schema/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ func TestValidate(t *testing.T) {
{name: "DuplicateDatabases",
schema: `
module one {
postgres database MY_DB
postgres database MY_DB
database postgres MY_DB
database postgres MY_DB
}
`,
errs: []string{
Expand Down
2 changes: 1 addition & 1 deletion go-runtime/compile/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestExtractModuleSchema(t *testing.T) {
config configValue one.Config
secret secretValue String
postgres database testDb
database postgres testDb
export enum Color: String {
Red = "Red"
Expand Down

0 comments on commit cf51f26

Please sign in to comment.