feat: add support for sqlserver (#81)
* feat: add support for sqlserver * fix: update gorm dependencies * fix: update constraint
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/driver/sqlserver"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/schema"
|
||||
)
|
||||
@@ -78,6 +79,9 @@ func InitDB() {
|
||||
case enum.Mysql.String():
|
||||
sqlDB, err = gorm.Open(mysql.Open(constants.DATABASE_URL), ormConfig)
|
||||
break
|
||||
case enum.SQLServer.String():
|
||||
sqlDB, err = gorm.Open(sqlserver.Open(constants.DATABASE_URL), ormConfig)
|
||||
break
|
||||
case enum.Arangodb.String():
|
||||
arangodb, err := initArangodb()
|
||||
if err != nil {
|
||||
|
@@ -31,6 +31,7 @@ func (mgr *manager) AddVerification(verification VerificationRequest) (Verificat
|
||||
verification.Key = verification.ID
|
||||
verification.ObjectID = verification.ID
|
||||
result := mgr.sqlDB.Clauses(clause.OnConflict{
|
||||
Columns: []clause.Column{{Name: "email"}, {Name: "identifier"}},
|
||||
DoUpdates: clause.AssignmentColumns([]string{"token", "expires_at"}),
|
||||
}).Create(&verification)
|
||||
|
||||
|
Reference in New Issue
Block a user