Upgrading To v1.8 From v1.7
Exciting New Features ๐
Enhancements ๐
- Add methods for Request(1.8.0)
- Add methods for Response(1.8.0)
- Optimize database migrate(1.8.0)
- Route supports HTTPS(1.8.3)
Breaking Changes ๐
- Optimize import order(1.8.0)
- mock.Validator change name(1.8.0)
- support.Mysql change name(1.8.0)
- database.NewGormInstance is about to be deprecated(1.8.0)
Bug Fixes ๐
Upgrade Guide
Estimated Upgrade Time: 1 Minutes
Updating Dependencies
Update dependencies in the go.mod
file:
go get -u github.com/goravel/framework@v1.8.3
Add model association for Orm
Version: v1.8.0
Add methods for Orm, to handle model association:
Method | Action |
---|---|
Association | Association |
DB | Generic Database Interface sql.DB |
Load | Lazy Eager Loading |
LoadMissing | Lazy Eager Loading(not exist) |
Omit | Omit associations |
With | Eager Loading |
Add methods for Request
Version: v1.8.0
Add methods for ctx.Request()
, to enrich the format of Query
parameters:
Method | Action |
---|---|
QueryArray | Get the array parameters |
QueryMap | Get the map parameters |
Add-methods-for-Response
Version: v1.8.0
Add Origin
method to ctx.Response()
, you can get all information of Response
in the HTTP middleware.
Optimize import order
Version: v1.8.0
The import order in the bootstrap/app.go
file change to:
package bootstrap
import (
"github.com/goravel/framework/foundation"
"goravel/config"
)
Optimize database migrate
Version: v1.8.0
Run the command that generate the migrate file: go run . artisan make:migration create_users_table
, the corresponding migration file will be generated based on the default database driver currently in use(facades.Config.GetString("database.default")
).
mock.Validator Change Name
Version: v1.8.0
If you use mock.Validator
to write unit tests, the following modifications are required:
import "github.com/goravel/framework/testing/mock"
mock.Validator
// Modify to
import "github.com/goravel/framework/testing/mock"
mock.Validation
support.Mysql Change Name
Version: v1.8.0
If you use framework constants such as support.Mysql
to judge the database driver, you need to make the following modifications:
import "github.com/goravel/framework/database/support"
support.Mysql
support.Postgresql
support.Sqlite
support.Sqlserver
// Modify to
import "github.com/goravel/framework/contracts/database/orm"
orm.Mysql
orm.Postgresql
orm.Sqlite
orm.Sqlserver
The new constants such as orm.Mysql
are of type orm.Driver
and can be converted to a string type using the orm.Mysql.String()
method.
database.NewGormInstance is about to be deprecated
Version: v1.8.0
The database.NewGormInstance
method will be deprecated in v1.9.0 version, it can be used in current version, if you use the method to get the gorm
instance, the following modifications are required:
import "github.com/goravel/framework/database"
gorm, err := database.NewGormInstance(connection)
// Modify to
import "github.com/goravel/framework/database/gorm"
gorm, err := gorm.New(connection)
Fix Orm concurrency safety issue
Version: v1.8.1
When high concurrent access, reading facades.Orm
for the first time may return nil.
Fix Mail module can't send mail by 25 and 465 ports
Version: v1.8.2
You can send mail by 25, 465, 587 ports now.
Route supports HTTPS
Version: v1.8.3
facades.Route
Add RunTLS
method๏ผsupport start HTTPS server, For Detail.