DB optimization: pool, golang-migrate, consolidate to single Postgres

- Fix DB_NAME=db_yal -> mydb in api_yal .env
- Add connection pool (MaxOpenConns 25, MaxIdleConns 10, ConnMaxLifetime 30m)
- Replace GORM AutoMigrate with golang-migrate in api_yal and api_bb
- Create embedded SQL migrations for both APIs
- Add DB_SCHEMA support to api_bb config
- Consolidate to single Postgres: db_bb -> schema 'bb' on db container
- Remove db_bb service, bb-network, db_bb volume from compose
- Remove api_tp targets from Makefile
- Clean up old migrate.go
This commit is contained in:
valitovgaziz
2026-06-12 10:47:41 +05:00
parent ec83b97c25
commit b0350abfbe
18 changed files with 610 additions and 206 deletions
@@ -11,6 +11,7 @@ import (
type Config struct {
Port string
DatabaseURL string
DBSchema string
StaticURL string `env:"STATIC_URL" envDefault:"http://localhost:8080"`
JWTSecret string `env:"JWT_SECRET,required"`
@@ -34,6 +35,7 @@ func Load() *Config {
return &Config{
Port: port,
DatabaseURL: databaseURL,
DBSchema: getEnv("DB_SCHEMA", "public"),
JWTSecret: jwtSecret,
}
}