add postgres and refactor code

This commit is contained in:
andrusyakka
2023-07-17 13:59:44 +03:00
parent 94d2a1df2b
commit 6a386e38cf
15 changed files with 107 additions and 47 deletions

View File

@@ -7,7 +7,7 @@ import (
"astra-users/mw"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"gorm.io/driver/sqlite"
"gorm.io/driver/postgres"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"log"
@@ -27,7 +27,7 @@ func main() {
},
)
db, err := gorm.Open(sqlite.Open(config.Env.Server.ConnectionString), &gorm.Config{
db, err := gorm.Open(postgres.Open(config.Env.Server.ConnectionString), &gorm.Config{
Logger: newLogger,
})
if err != nil {