summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/query_column_add.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/uptrace/bun/query_column_add.go')
-rw-r--r--vendor/github.com/uptrace/bun/query_column_add.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/vendor/github.com/uptrace/bun/query_column_add.go b/vendor/github.com/uptrace/bun/query_column_add.go
index 50576873c..48cb2542a 100644
--- a/vendor/github.com/uptrace/bun/query_column_add.go
+++ b/vendor/github.com/uptrace/bun/query_column_add.go
@@ -13,6 +13,7 @@ type AddColumnQuery struct {
baseQuery
ifNotExists bool
+ comment string
}
var _ Query = (*AddColumnQuery)(nil)
@@ -85,6 +86,14 @@ func (q *AddColumnQuery) IfNotExists() *AddColumnQuery {
//------------------------------------------------------------------------------
+// Comment adds a comment to the query, wrapped by /* ... */.
+func (q *AddColumnQuery) Comment(comment string) *AddColumnQuery {
+ q.comment = comment
+ return q
+}
+
+//------------------------------------------------------------------------------
+
func (q *AddColumnQuery) Operation() string {
return "ADD COLUMN"
}
@@ -93,6 +102,9 @@ func (q *AddColumnQuery) AppendQuery(fmter schema.Formatter, b []byte) (_ []byte
if q.err != nil {
return nil, q.err
}
+
+ b = appendComment(b, q.comment)
+
if len(q.columns) != 1 {
return nil, fmt.Errorf("bun: AddColumnQuery requires exactly one column")
}