summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/uptrace/bun')
-rw-r--r--vendor/github.com/uptrace/bun/CHANGELOG.md16
-rw-r--r--vendor/github.com/uptrace/bun/db.go7
-rw-r--r--vendor/github.com/uptrace/bun/dialect/feature/feature.go2
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/dialect.go1
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/version.go2
-rw-r--r--vendor/github.com/uptrace/bun/dialect/sqlitedialect/dialect.go5
-rw-r--r--vendor/github.com/uptrace/bun/dialect/sqlitedialect/version.go2
-rw-r--r--vendor/github.com/uptrace/bun/package.json2
-rw-r--r--vendor/github.com/uptrace/bun/query_table_create.go24
-rw-r--r--vendor/github.com/uptrace/bun/schema/table.go7
-rw-r--r--vendor/github.com/uptrace/bun/version.go2
11 files changed, 54 insertions, 16 deletions
diff --git a/vendor/github.com/uptrace/bun/CHANGELOG.md b/vendor/github.com/uptrace/bun/CHANGELOG.md
index 059721b36..62f297d2d 100644
--- a/vendor/github.com/uptrace/bun/CHANGELOG.md
+++ b/vendor/github.com/uptrace/bun/CHANGELOG.md
@@ -1,3 +1,19 @@
+## [1.2.15](https://github.com/uptrace/bun/compare/v1.2.14...v1.2.15) (2025-07-17)
+
+
+### Bug Fixes
+
+* **pgdriver:** add mandatory space before negative numbers to resolve CVE-2024-34359 ([8067a8f](https://github.com/uptrace/bun/commit/8067a8f13f8d22fb57b76d6800f7aefc12b044cd))
+
+
+### Features
+
+* **db:** rename CleanQueryHook to ResetQueryHooks ([cb17679](https://github.com/uptrace/bun/commit/cb176796f5fbae8b3ea44e67875dd00ecf689425))
+* **db:** support clean query hooks ([a5f19a7](https://github.com/uptrace/bun/commit/a5f19a7c0d68fd44eaff99ebaaeb88ca089d7538)), closes [#1226](https://github.com/uptrace/bun/issues/1226)
+* **dialect:** return default on update/delete when create table ([d347b48](https://github.com/uptrace/bun/commit/d347b48c7764a23000a28ca3ad40368b8b89e298)), closes [#1212](https://github.com/uptrace/bun/issues/1212)
+
+
+
## [1.2.14](https://github.com/uptrace/bun/compare/v1.2.13...v1.2.14) (2025-06-16)
diff --git a/vendor/github.com/uptrace/bun/db.go b/vendor/github.com/uptrace/bun/db.go
index 9ac99a586..506c3a53f 100644
--- a/vendor/github.com/uptrace/bun/db.go
+++ b/vendor/github.com/uptrace/bun/db.go
@@ -235,6 +235,13 @@ func (db *DB) AddQueryHook(hook QueryHook) {
db.queryHooks = append(db.queryHooks, hook)
}
+func (db *DB) ResetQueryHooks() {
+ for i := range db.queryHooks {
+ db.queryHooks[i] = nil
+ }
+ db.queryHooks = nil
+}
+
func (db *DB) Table(typ reflect.Type) *schema.Table {
return db.dialect.Tables().Get(typ)
}
diff --git a/vendor/github.com/uptrace/bun/dialect/feature/feature.go b/vendor/github.com/uptrace/bun/dialect/feature/feature.go
index 89693fc21..65e7a0508 100644
--- a/vendor/github.com/uptrace/bun/dialect/feature/feature.go
+++ b/vendor/github.com/uptrace/bun/dialect/feature/feature.go
@@ -41,6 +41,7 @@ const (
DeleteOrderLimit // DELETE ... ORDER BY ... LIMIT ...
DeleteReturning
AlterColumnExists // ADD/DROP COLUMN IF NOT EXISTS/IF EXISTS
+ FKDefaultOnAction // FK ON UPDATE/ON DELETE has default value: NO ACTION
)
type NotSupportError struct {
@@ -91,4 +92,5 @@ var flag2str = map[Feature]string{
DeleteOrderLimit: "DeleteOrderLimit",
DeleteReturning: "DeleteReturning",
AlterColumnExists: "AlterColumnExists",
+ FKDefaultOnAction: "FKDefaultOnAction",
}
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/dialect.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/dialect.go
index 05c4e371f..74ac13a49 100644
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/dialect.go
+++ b/vendor/github.com/uptrace/bun/dialect/pgdialect/dialect.go
@@ -55,6 +55,7 @@ func New(opts ...DialectOption) *Dialect {
feature.SelectExists |
feature.GeneratedIdentity |
feature.CompositeIn |
+ feature.FKDefaultOnAction |
feature.DeleteReturning |
feature.AlterColumnExists
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/version.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/version.go
index c774ccc50..aa6229020 100644
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/version.go
+++ b/vendor/github.com/uptrace/bun/dialect/pgdialect/version.go
@@ -2,5 +2,5 @@ package pgdialect
// Version is the current release version.
func Version() string {
- return "1.2.14"
+ return "1.2.15"
}
diff --git a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/dialect.go b/vendor/github.com/uptrace/bun/dialect/sqlitedialect/dialect.go
index 1280d0d69..7489ddb2e 100644
--- a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/dialect.go
+++ b/vendor/github.com/uptrace/bun/dialect/sqlitedialect/dialect.go
@@ -41,6 +41,7 @@ func New(opts ...DialectOption) *Dialect {
feature.SelectExists |
feature.AutoIncrement |
feature.CompositeIn |
+ feature.FKDefaultOnAction |
feature.DeleteReturning
for _, opt := range opts {
@@ -102,7 +103,7 @@ func (d *Dialect) AppendBytes(b []byte, bs []byte) []byte {
return b
}
-func (d *Dialect) DefaultVarcharLen() int {
+func (*Dialect) DefaultVarcharLen() int {
return 0
}
@@ -132,7 +133,7 @@ func (d *Dialect) AppendSequence(b []byte, table *schema.Table, field *schema.Fi
// DefaultSchemaName is the "schema-name" of the main database.
// The details might differ from other dialects, but for all means and purposes
// "main" is the default schema in an SQLite database.
-func (d *Dialect) DefaultSchema() string {
+func (*Dialect) DefaultSchema() string {
return "main"
}
diff --git a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/version.go b/vendor/github.com/uptrace/bun/dialect/sqlitedialect/version.go
index 8e82dcb5d..c47e129ee 100644
--- a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/version.go
+++ b/vendor/github.com/uptrace/bun/dialect/sqlitedialect/version.go
@@ -2,5 +2,5 @@ package sqlitedialect
// Version is the current release version.
func Version() string {
- return "1.2.14"
+ return "1.2.15"
}
diff --git a/vendor/github.com/uptrace/bun/package.json b/vendor/github.com/uptrace/bun/package.json
index 740a9c1d5..2cd6b1de2 100644
--- a/vendor/github.com/uptrace/bun/package.json
+++ b/vendor/github.com/uptrace/bun/package.json
@@ -1,6 +1,6 @@
{
"name": "gobun",
- "version": "1.2.14",
+ "version": "1.2.15",
"main": "index.js",
"repository": "git@github.com:uptrace/bun.git",
"author": "Vladimir Mihailenco <vladimir.webdev@gmail.com>",
diff --git a/vendor/github.com/uptrace/bun/query_table_create.go b/vendor/github.com/uptrace/bun/query_table_create.go
index 3e1474ed7..0fa9035d0 100644
--- a/vendor/github.com/uptrace/bun/query_table_create.go
+++ b/vendor/github.com/uptrace/bun/query_table_create.go
@@ -318,15 +318,23 @@ func (q *CreateTableQuery) appendFKConstraintsRel(fmter schema.Formatter, b []by
for _, key := range keys {
if rel := relations[key]; rel.References() {
+ query := "(?) REFERENCES ? (?)"
+ args := []any{
+ Safe(appendColumns(nil, "", rel.BasePKs)),
+ rel.JoinTable.SQLName,
+ Safe(appendColumns(nil, "", rel.JoinPKs)),
+ }
+ if len(rel.OnUpdate) > 0 {
+ query += " ?"
+ args = append(args, Safe(rel.OnUpdate))
+ }
+ if len(rel.OnDelete) > 0 {
+ query += " ?"
+ args = append(args, Safe(rel.OnDelete))
+ }
b, err = q.appendFK(fmter, b, schema.QueryWithArgs{
- Query: "(?) REFERENCES ? (?) ? ?",
- Args: []interface{}{
- Safe(appendColumns(nil, "", rel.BasePKs)),
- rel.JoinTable.SQLName,
- Safe(appendColumns(nil, "", rel.JoinPKs)),
- Safe(rel.OnUpdate),
- Safe(rel.OnDelete),
- },
+ Query: query,
+ Args: args,
})
if err != nil {
return nil, err
diff --git a/vendor/github.com/uptrace/bun/schema/table.go b/vendor/github.com/uptrace/bun/schema/table.go
index 44d5e5719..5e951630b 100644
--- a/vendor/github.com/uptrace/bun/schema/table.go
+++ b/vendor/github.com/uptrace/bun/schema/table.go
@@ -11,6 +11,7 @@ import (
"github.com/jinzhu/inflection"
+ "github.com/uptrace/bun/dialect/feature"
"github.com/uptrace/bun/internal"
"github.com/uptrace/bun/internal/tagparser"
)
@@ -623,7 +624,10 @@ func (t *Table) belongsToRelation(field *Field) *Relation {
rel.Condition = field.Tag.Options["join_on"]
}
- rel.OnUpdate = "ON UPDATE NO ACTION"
+ if t.dialect.Features().Has(feature.FKDefaultOnAction) {
+ rel.OnUpdate = "ON UPDATE NO ACTION"
+ rel.OnDelete = "ON DELETE NO ACTION"
+ }
if onUpdate, ok := field.Tag.Options["on_update"]; ok {
if len(onUpdate) > 1 {
panic(fmt.Errorf("bun: %s belongs-to %s: on_update option must be a single field", t.TypeName, field.GoName))
@@ -638,7 +642,6 @@ func (t *Table) belongsToRelation(field *Field) *Relation {
rel.OnUpdate = s
}
- rel.OnDelete = "ON DELETE NO ACTION"
if onDelete, ok := field.Tag.Options["on_delete"]; ok {
if len(onDelete) > 1 {
panic(fmt.Errorf("bun: %s belongs-to %s: on_delete option must be a single field", t.TypeName, field.GoName))
diff --git a/vendor/github.com/uptrace/bun/version.go b/vendor/github.com/uptrace/bun/version.go
index f1a7efe4a..273c625bf 100644
--- a/vendor/github.com/uptrace/bun/version.go
+++ b/vendor/github.com/uptrace/bun/version.go
@@ -2,5 +2,5 @@ package bun
// Version is the current release version.
func Version() string {
- return "1.2.14"
+ return "1.2.15"
}