ADD: added dockerfiles and a logger for the backend
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"studia/internal/config"
|
||||
"studia/internal/logger"
|
||||
|
||||
_ "github.com/lib/pq" // Import the PostgreSQL driver
|
||||
)
|
||||
@@ -22,7 +23,7 @@ func New(cfg *config.Config) *sql.DB {
|
||||
WHERE table_schema = 'public'
|
||||
`)
|
||||
if err != nil {
|
||||
log.Println("failed to query existing tables:", err)
|
||||
logger.Log.Error().Err(err).Msg("Failed to query existing tables")
|
||||
}
|
||||
|
||||
missing := checkTables(expectedTables, existing)
|
||||
@@ -32,7 +33,7 @@ func New(cfg *config.Config) *sql.DB {
|
||||
// Here you would normally run migrations to create the missing tables
|
||||
// For simplicity, we just log the missing tables
|
||||
} else {
|
||||
log.Println("All expected tables are present.")
|
||||
logger.Log.Info().Msg("All expected tables are present.")
|
||||
}
|
||||
|
||||
return db
|
||||
@@ -41,7 +42,7 @@ func New(cfg *config.Config) *sql.DB {
|
||||
func setupDatabase(cfg *config.Config) *sql.DB {
|
||||
// Database connection setup logic here
|
||||
|
||||
log.Println(cfg)
|
||||
logger.Log.Println(cfg)
|
||||
switch cfg.DatabaseDriver {
|
||||
case "postgres":
|
||||
// Setup Postgres connection
|
||||
|
||||
Reference in New Issue
Block a user