Dmitri 36cbda5e7a
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 2m12s
added migrations
2026-04-19 18:51:04 +02:00

34 lines
665 B
Go

package main
import (
"context"
"log"
"time"
"git.kanopo.dev/rhythm/rhythm-backend/internal/config"
"git.kanopo.dev/rhythm/rhythm-backend/internal/db"
"github.com/jackc/pgx/v5/pgxpool"
)
func main() {
cfg := config.Load()
ctx := context.Background()
pool, err := pgxpool.New(ctx, cfg.DbUrl)
if err != nil {
log.Fatalf("Error creatin the db pool:%v\n", err.Error())
}
defer pool.Close()
{
ctx, cancel := context.WithTimeout(ctx, time.Second*5)
defer cancel()
if err := pool.Ping(ctx); err != nil {
log.Fatalf("ping to db failed %v", err.Error())
}
log.Printf("successfully connected to database")
db.RunMigrations(cfg.DbUrl)
}
}