From a8381e6b8fca7ae67d760ad7efd7d448791055f0 Mon Sep 17 00:00:00 2001 From: nutcas3 Date: Wed, 29 Apr 2026 02:55:13 +0300 Subject: [PATCH] refactor: Remove inline schema creation from PostgresProfileStore in favor of centralized migration system - Remove AutoMigrate call for profileRow from NewPostgresProfileStore - Update function comment to reference migration system (make db-migrate) instead of inline schema creation - Add note that esim_profiles table is created by migration system - Remove error handling for AutoMigrate execution --- apps/carrier-connector/internal/repository/postgres.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/carrier-connector/internal/repository/postgres.go b/apps/carrier-connector/internal/repository/postgres.go index 526f60d..51acfa3 100644 --- a/apps/carrier-connector/internal/repository/postgres.go +++ b/apps/carrier-connector/internal/repository/postgres.go @@ -34,8 +34,8 @@ type PostgresProfileStore struct { db *gorm.DB } -// NewPostgresProfileStore connects to Postgres using the given DSN, runs the -// profile schema migration, and returns a repository ready to use. +// NewPostgresProfileStore connects to Postgres using the given DSN and returns a repository ready to use. +// Note: Database schema should be created by running migrations via `make db-migrate` func NewPostgresProfileStore(dsn string) (*PostgresProfileStore, error) { if dsn == "" { return nil, errors.New("postgres DSN is empty") @@ -46,9 +46,8 @@ func NewPostgresProfileStore(dsn string) (*PostgresProfileStore, error) { if err != nil { return nil, fmt.Errorf("open postgres: %w", err) } - if err := db.AutoMigrate(&profileRow{}); err != nil { - return nil, fmt.Errorf("migrate esim_profiles: %w", err) - } + // Note: AutoMigrate removed - schema managed by migration system + // Run `make db-migrate` to create/update database schema return &PostgresProfileStore{db: db}, nil }