mirror of
https://github.com/flipped-aurora/gin-vue-admin.git
synced 2026-09-21 12:32:25 +00:00
Develop init (#1280)
* 修改数据库初始化方式,增加引擎配置、统一表前缀、是否关闭复数表名 * 修改拦截器逻辑,develop模式不走数据库权限验证 * 增加表前缀,复数表,数据库引擎配置。 Co-authored-by: 吴璟 <hypf2008@126.com>
This commit is contained in:
committed by
GitHub
co-authored by
吴璟
parent
4ebe66a29c
commit
9dacd7056b
@@ -1,6 +1,7 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"gorm.io/gorm/schema"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
@@ -20,8 +21,14 @@ type _gorm struct{}
|
||||
|
||||
// Config gorm 自定义配置
|
||||
// Author [SliverHorn](https://github.com/SliverHorn)
|
||||
func (g *_gorm) Config() *gorm.Config {
|
||||
config := &gorm.Config{DisableForeignKeyConstraintWhenMigrating: true}
|
||||
func (g *_gorm) Config(prefix string, singular bool) *gorm.Config {
|
||||
config := &gorm.Config{
|
||||
NamingStrategy: schema.NamingStrategy{
|
||||
TablePrefix: prefix,
|
||||
SingularTable: singular,
|
||||
},
|
||||
DisableForeignKeyConstraintWhenMigrating: true,
|
||||
}
|
||||
_default := logger.New(NewWriter(log.New(os.Stdout, "\r\n", log.LstdFlags)), logger.Config{
|
||||
SlowThreshold: 200 * time.Millisecond,
|
||||
LogLevel: logger.Warn,
|
||||
|
||||
Reference in New Issue
Block a user