Upgrading To v1.8 From v1.7

Exciting New Features ๐ŸŽ‰

Enhancements ๐Ÿš€

Breaking Changes ๐Ÿ› 

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:

MethodAction
AssociationAssociation
DBGeneric Database Interface sql.DB
LoadLazy Eager Loading
LoadMissingLazy Eager Loading(not exist)
OmitOmit associations
WithEager Loading

Add methods for Request

Version: v1.8.0

Add methods for ctx.Request(), to enrich the format of Query parameters:

MethodAction
QueryArrayGet the array parameters
QueryMapGet 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.

Detail

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"
)

The Fileopen in new window

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

Detail

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.