1.2.6 (2024-11-20)
- append IDENTITY to ADD COLUMN statement if needed (694f873)
- ci: prune stale should be executed at 3 AM every day (0cedcb0)
- cleanup after testUniqueRenamedTable (b1ae32e)
- fix go.mod of oracledialect (89e21ea)
- has many relationship with multiple columns (1664b2c)
- ignore case for type equivalence (c3253a5)
- implement DefaultSchema for Oracle dialect (d08fa40)
- oracledialect: add go.mod file so the dialect is released properly (#1043) (1bb5597)
- oracledialect: update go.mod by go mod tidy to fix tests (7f90a15)
- pgdialect: array value quoting (892c416)
- remove schema name from t.Name during bun-schema inspection (31ed582)
- rename column only if the name does not exist in 'target' (fed6012)
- support embed with tag Unique (3acd6dd)
- update oracledialect/version.go in release.sh (bcd070f)
- update schema.Field names (9b810de)
- add and drop columns (3fdd5b8)
- add and drop IDENTITY (dd83779)
- add support type for net/netip.addr and net/netip.prefix (#1028) (95c4a8e)
- automigrate: detect renamed tables (c03938f)
- change column type (3cfd8c6)
- ci: support release on osx (435510b)
- create sql migrations and apply them (1bf7cfd)
- create transactional migration files (c3320f6)
- detect Create/Drop table (408859f)
- detect modified relations (a918dc4)
- detect renamed columns (886d0a5)
- detect renamed tables (8857bab)
- enhance Apply method to accept multiple functions (7823f2f)
- implement fmt.Stringer queries (5060e47)
- improve FK handling (a822fc5)
- include target schema name in migration name (ac8d221)
- mariadb: support RETURNING clause in DELETE statement (b8dec9d)
- migrate FKs (4c1dfdb)
- mysql: support ORDER BY and LIMIT clauses in UPDATE and DELETE statements (de71bed)
- support modifying primary keys (a734629)
- support UNIQUE constraints (3c4d5d2)
- use *bun.DB in MigratorDialect (a8788bf)
1.2.5 (2024-10-26)
- allow Limit() without Order() with MSSQL (#1009) (1a46ddc)
- copy bytes in mapModel.Scan (#1030) (#1032) (39fda4e)
- fix issue with has-many join and pointer fields (#950) (#983) (cbc5177)
- restore explicit column: name override (#984) (169f258)
- return column option back (#1036) (a3ccbea)
- sql.NullString mistaken as custom struct (#1019) (87c77b8)
- typos (#1026) (760de7d)
- refactor SelectQuery.ScanAndCount to optimize performance when there is no limit and offset (#1035) (8638613)
1.2.4 (2024-10-26)
- allow Limit() without Order() with MSSQL (#1009) (1a46ddc)
- copy bytes in mapModel.Scan (#1030) (#1032) (39fda4e)
- return column option back (#1036) (a3ccbea)
- sql.NullString mistaken as custom struct (#1019) (87c77b8)
- typos (#1026) (760de7d)
- refactor SelectQuery.ScanAndCount to optimize performance when there is no limit and offset (#1035) (8638613)
1.2.3 (2024-08-31)
1.2.2 (2024-08-29)
- gracefully handle empty hstore in pgdialect (#1010) (2f73d8a)
- number each unit test (#974) (b005dc2)
1.2.1 (2024-04-02)
1.2.0 (2024-04-02)
- embedding of scanonly fields (ed6ed74)
- table: allow alt annotation (#956) (8a0397b)
- transactional migration file extension (#959) (921b15b)
- Allow overriding of Warn and Deprecated loggers (#952) (0e9d737)
- enable SNI (#953) (4071ffb)
- idb: add NewMerge method to IDB (#966) (664e2f1)
1.1.17 (2024-01-11)
- add CreateTxSQLMigrations function (#916) (c68ec7c)
- add Join to UpdateQuery (#908) (8c4d8be)
- bunslog.QueryHook for Bun logging using
log/slog
(#904) (4953367) - dbfixture.New to accept IDB interface (#900) (2dee174)
1.1.16 (2023-09-16)
1.1.15 (2023-09-10)
- "model does not have column" error (#850) (16367aa)
- alloc when mounting (#891) (f2256f1)
- index hints have to be specified following a table name (4a2ae85)
- make Rows.Close to drain messages (5ceba07)
- run hooks on Rows (#892) (f652b3d)
- scan error #709 (#837) (b82afa5)
1.1.14 (2023-05-24)
- enable CompositeIn for MySQL (9f377b5)
1.1.13 (2023-05-06)
- bunbig.Int.Scan typo (7ddabb8)
- compare full MySQL version (096fabe)
- enable delete table alias for MySQL >= 8.0.16 (77a600b)
- incorrect table relationship panic message #791 (ad41888)
- should rollback if migrate using transaction and got an err (thanks @bayshark) (e7a119b)
- add option to customize Go migration template (f31bf73)
- expose Exec(…) method for RawQuery (11192c8)
- prefix migration files with 1 upto 14 digits (b74b671)
- rename option (9353a3f)
1.1.12 (2023-02-20)
1.1.11 (2023-02-01)
- add support for inserting values with Unicode encoding for mssql dialect (e98c6c0)
- fix relation tag (a3eedff)
1.1.10 (2023-01-16)
- allow QueryEvent to better detect operations in raw queries (8e44735)
- append default VARCHAR length instead of hardcoding it in the type definition (e5079c7)
- prevent panic when use pg array with custom database type (67e4412)
- properly return sql.ErrNoRows when scanning []byte (996fead)
- mssql output support for update or delete query (#718) (08876b4)
- add Err method to query builder (c722c90)
- add support for time.Time array in Postgres (3dd6f3b)
- mssql and pg merge query (#723) (deea764)
- setError on attempt to set non-positive .Varchar() (3335e0b)
- go 1.18 (67a4488)
1.1.9 (2022-11-23)
- adding dialect override for append-bool (#695) (338f2f0)
- don't call hooks twice for whereExists (9057857)
- don't lock migrations when running Migrate and Rollback (69a7354)
- query: make WhereDeleted compatible with ForceDelete (299c3fd), closes #673
- relation join soft delete SQL generate (a98f4e9)
- add migrate.Exec (d368bbe)
- update: "skipupdate" while bulk (1a32b2f)
- zerolog: added zerolog hook (9d2267d)
1.1.8 (2022-08-29)
- bunotel: handle option attributes (#656) (9f1e0bd)
- driver.Valuer returns itself causes stackoverflow (c9f51d3), closes #657
- pgdriver: return FATAL and PANIC errors immediately (4595e38)
- quote m2m table name fixes #649 (61a634e)
- support multi-level embed column (177ec4c), closes #643
- conditions not supporting composite in (e5d78d4)
- idb: support raw query (be4e688)
- migrate: add MissingMigrations (42567d0)
- pgdriver: implement database/sql/driver.SessionResetter (bda298a)
- pgdriver: provide access to the underlying net.Conn (d07ea0e)
1.1.7 (2022-07-29)
- change ScanAndCount without a limit to select all rows (de5c570)
1.1.6 (2022-07-10)
- bunotel add set attributes to query metrics (dae82cc)
- db.ScanRows: ensure rows.Close is called (9ffbc6a)
- merge apply (3081849)
- migrate: close conn/tx on error (7b168ea)
- migrate: type Migration should be used as a value rather than a pointer (fb43935)
- migrate: type MigrationGroup should be used as a value rather than a pointer (649da1b)
- mssql cursor pagination (#589) (b34ec97)
- "skipupdate" model field tag (#565) (9288294)
- add pgdriver write error to log (5ddda3d)
- add query string representation (520da7e)
- add relation condition with tag (fe5bbf6)
- add support for ON UPDATE and ON DELETE rules on belongs-to relationships from struct tags (#533) (a327b2a)
- add tx methods to IDB (#587) (feab313)
- added raw query calls (#596) (127644d)
- bunotel: add option to enable formatting of queries (#547) (b9c768c)
- config.go: add sslrootcert support to DSN parameters (3bd5d69)
- create an extra module for newrelic (#599) (6c676ce)
- migrate: add WithMarkAppliedOnSuccess (31b2cc4)
- pgdialect: add hstore support (66b44f7)
- pgdialect: add identity support (646251e)
- pgdriver: expose pgdriver.ParseTime (405a7d7)
1.1.5 (2022-05-12)
- driver/sqliteshim: make it work with recent version of modernc sqlite (2360584)
1.1.4 (2022-04-20)
- automatically set nullzero when there is default:value option (72c44ae)
- fix ForceDelete on live/undeleted rows (1a33250)
- fix OmitZero and value overriding (087ea07)
- rename Query to QueryBuilder (98d111b)
- add ApplyQueryBuilder (582eca0)
- config.go: add connect_timeout to DSN parsable params (998b04d), closes #505
1.1.3 (2022-03-29)
- fix panic message when has-many encounter an error (cfd2747)
- migrate: change rollback to match migrate behavior (df5af9c)
1.1.2 (2022-03-22)
- correctly handle bun.In([][]byte{...}) (800616e)
- accept extend option to allow extending existing models (48b80e4)
1.1.0 (2022-02-28)
- Added MSSQL support as a 4th fully supported DBMS.
- Added
SetColumn("col_name", "upper(?)", "hello")
in addition toSet("col_name = upper(?)", "hello")
which works for all 4 supported DBMS.
- improve nil ptr values handling (b398e6b)
- Bun no longer automatically marks some fields like
ID int64
aspk
andautoincrement
. You need to manually add those options:
type Model struct {
- ID int64
+ ID int64 `bun:",pk,autoincrement"`
}
Bun v1.0.25 prints warnings for models with missing options so you are recommended to upgrade to v1.0.24 before upgrading to v1.1.x.
-
Also, Bun no longer adds
nullzero
option tosoft_delete
fields. -
Removed
nopk
andallowzero
options.
- append slice values (4a65129)
- check for nils when appending driver.Value (7bb1640)
- cleanup soft deletes for mssql (e72e2c5)
- dbfixture: apply cascade option. Fixes #447 (d32d988)
- create table WithForeignKey() and has-many relation (3cf5649)
- do not emit m2m relations in WithForeignKeys() (56c8c5e)
- accept dest in select queries (33b5b6f)
1.0.25 (2022-02-22)
In the coming v1.1.x release, Bun will stop automatically adding ,pk,autoincrement
options on
ID int64/int32
fields. This version (v1.0.23) only prints a warning when it encounters such
fields, but the code will continue working as before.
To fix warnings, add missing options:
type Model struct {
- ID int64
+ ID int64 `bun:",pk,autoincrement"`
}
To silence warnings:
bun.SetWarnLogger(log.New(ioutil.Discard, "", log.LstdFlags))
Bun will also print a warning on soft delete
fields without a ,nullzero
option. You can fix the warning by adding missing ,nullzero
or
,allowzero
options.
In v1.1.x, such options as ,nopk
and ,allowzero
will not be necessary and will be removed.
- fix missing autoincrement warning (3bc9c72)
- append slice values (4a65129)
- don't automatically set pk, nullzero, and autoincrement options (519a0df)
- add CreateTableQuery.DetectForeignKeys (a958fcb)
1.0.22 (2022-01-28)
- insert: get last insert id only with pk support auto increment
(79e7c79). Make
sure your MySQL models have
bun:",pk,autoincrement"
options if you are using autoincrements.
1.0.21 (2022-01-06)
- append where to index create (1de6cea)
- check if slice is nil when calling BeforeAppendModel (938d9da)
- dbfixture: directly set matching types via reflect (780504c)
- properly handle driver.Valuer and type:json (a17454a)
- support scanning string into uint64 (73cc117)
- unique module name for opentelemetry example (f2054fe)
- add anonymous fields with type name (508375b)
- add baseQuery.GetConn() (81a9bee)
- create new queries from baseQuery (ae1dd61)
- support INSERT ... RETURNING for MariaDB >= 10.5.0 (b6531c0)
1.0.20 (2021-12-19)
- add Event.QueryTemplate and change Event.Query to be always formatted (52b1ccd)
- change GetTableName to return formatted table name in case ModelTableExpr (95144dd)
- change ScanAndCount to work with transactions (5b3f2c0)
- dbfixture: directly call funcs bypassing template eval (a61974b)
- don't append CASCADE by default in drop table/column queries (26457ea)
- migrate: mark migrations as applied on error so the migration can be rolled back (8ce33fb)
- respect nullzero when appending struct fields. Fixes #339 (ffd02f3)
- reuse tx for relation join (#366) (60bdb1a)
- add
Dialect()
to Transaction and IDB interface (693f1e1) - add model embedding via embed:prefix_ (9a2cedc)
- change the default log output to stderr (4bf5773), closes #349
1.0.19 (2021-11-30)
- add support for column:name to specify column name (e37b460)
1.0.18 (2021-11-24)
- use correct operation for UpdateQuery (687a004)
- add pgdriver.Notify (7ee443d)
- CreateTableQuery.PartitionBy and CreateTableQuery.TableSpace (cd3ab4d)
- pgdriver: add CopyFrom and CopyTo (0b97703)
- support InsertQuery.Ignore on PostgreSQL (1aa9d14)
1.0.17 (2021-11-11)
- don't call rollback when tx is already done (8246c2a)
- mysql: escape backslash char in strings (fb32029)
1.0.16 (2021-11-07)
- call query hook when tx is started, committed, or rolled back (30e85b5)
- pgdialect: auto-enable array support if the sql type is an array (62c1012)
- support multiple tag options join:left_col1=right_col1,join:left_col2=right_col2 (78cd5aa)
- tag: log with bad tag name (4e82d75)
1.0.15 (2021-10-29)
1.0.14 (2021-10-24)
- correct binary serialization for mysql (#259) (e899f50)
- correctly escape single quotes in pg arrays (3010847)
- use BLOB sql type to encode []byte in MySQL and SQLite (725ec88)
- warn when there are args but no placeholders (06dde21)
1.0.13 (2021-10-17)
- pgdriver: enable TLS by default with InsecureSkipVerify=true (15ec635)
1.0.12 (2021-10-14)
- add InsertQuery.ColumnExpr to specify columns (60ffe29)
- bundebug: change WithVerbose to accept a bool flag (b2f8b91)
- pgdialect: fix bytea[] handling (a5ca013)
- pgdriver: rename DriverOption to Option (51c1702)
- support allowzero on the soft delete field (d0abec7)
- bundebug: allow to configure the hook using env var, for example, BUNDEBUG={0,1,2} (ce92852)
- bunotel: report DBStats metrics (b9b1575)
- pgdriver: add Error.StatementTimeout (8a7934d)
- pgdriver: allow setting Network in config (b24b5d8)
1.0.11 (2021-10-05)
- mysqldialect: remove duplicate AppendTime (8d42090)
1.0.10 (2021-10-05)
- add UpdateQuery.OmitZero (2294db6)
- make ExcludeColumn work with many-to-many queries (300e12b)
- mysqldialect: append time in local timezone (e763cc8)
- tagparser: improve parsing options with brackets (0daa61e)
- add timetz parsing (6e415c4)
1.0.9 (2021-09-27)
- change DBStats to use uint32 instead of uint64 to make it work on i386 (caca2a7)
- add IQuery and QueryEvent.IQuery (b762942)
- add QueryEvent.Model (7688201)
- bunotel: add experimental bun.query.timing metric (2cdb384)
- pgdriver: add Config.ConnParams to session config params (408caf0)
- pgdriver: allow specifying timeout in DSN (7dbc71b)
1.0.8 (2021-09-18)
- don't append soft delete where for insert queries with on conflict clause (27c477c)
- improve bun.NullTime to accept string (73ad6f5)
- make allowzero work with auto-detected primary keys (82ca87c)
- support soft deletes on nil model (0556e3c)
1.0.7 (2021-09-15)
- don't append zero time as NULL without nullzero tag (3b8d9cb)
- pgdriver: return PostgreSQL DATE as a string (40be0e8)
- specify table alias for soft delete where (5fff1dc)
- add SelectQuery.Exists helper (c3e59c1)
1.0.6 (2021-09-11)
- change unique tag to create a separate unique constraint (8401615)
- improve zero checker for ptr values (2b3623d)
- chore: tweak bundebug colors
- fix: check if table is present when appending columns
- fix: copy []byte when scanning
- Added support for MariaDB.
- Restored default
SET
forON CONFLICT DO UPDATE
queries.
- Fixed bulk soft deletes.
- pgdialect: fixed scanning into an array pointer.
- Changed to completely ignore fields marked with
bun:"-"
. If you want to be able to scan into such columns, usebun:",scanonly"
. - pgdriver: fixed SASL authentication handling.
- pgdriver: added erroneous zero writes retry.
- Improved column handling in Relation callback.
- First stable release.
- Fixed migrate package to properly rollback migrations.
- Added
allowzero
tag option that undoesnullzero
option.
- Changed
WhereGroup
function to accept*SelectQuery
. - Fixed query hooks for count queries.
- Renamed
migrate.CreateGo
toCreateGoMigration
. - Added
migrate.WithPackageName
to customize the Go package name in generated migrations. - Renamed
migrate.CreateSQL
toCreateSQLMigrations
and changedCreateSQLMigrations
to create both up and down migration files.
- Renamed
alias
field struct tag toalt
so it is not confused with column alias. - Reworked migrate package API. See migrate example for details.
- Changed migrate package to return structured data instead of logging the progress. See migrate example for details.
- Added sqliteshim by Ivan Trubach.
- Added support for MySQL 5.7 in addition to MySQL 8.
- Fixed scanners for net.IP and net.IPNet.
- Fixed pgdriver to format passed query args.
- Added support for prepared statements in pgdriver.
-
Added
UpdateQuery.Bulk
helper to generate bulk-update queries.Before:
models := []Model{ {42, "hello"}, {43, "world"}, } return db.NewUpdate(). With("_data", db.NewValues(&models)). Model(&models). Table("_data"). Set("model.str = _data.str"). Where("model.id = _data.id")
Now:
db.NewUpdate(). Model(&models). Bulk()
- Changed time.Time to always append zero time as
NULL
. - Added
db.RunInTx
helper.
- Added SSL support to pgdriver.
- Replaced
ForceDelete(ctx)
withForceDelete().Exec(ctx)
for soft deletes.
- Renamed
DBI
toIConn
.IConn
is a common interface for*sql.DB
,*sql.Conn
, and*sql.Tx
. - Added
IDB
.IDB
is a common interface for*bun.DB
,bun.Conn
, andbun.Tx
.
- Changed model hooks. See model-hooks example.
- Renamed
has-one
tobelongs-to
. Renamedbelongs-to
tohas-one
. Previously Bun used incorrect names for these relations.