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
This commit is contained in:
nutcas3
2026-04-29 02:55:13 +03:00
parent 85b97c0950
commit a8381e6b8f
@@ -34,8 +34,8 @@ type PostgresProfileStore struct {
db *gorm.DB db *gorm.DB
} }
// NewPostgresProfileStore connects to Postgres using the given DSN, runs the // NewPostgresProfileStore connects to Postgres using the given DSN and returns a repository ready to use.
// profile schema migration, 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) { func NewPostgresProfileStore(dsn string) (*PostgresProfileStore, error) {
if dsn == "" { if dsn == "" {
return nil, errors.New("postgres DSN is empty") return nil, errors.New("postgres DSN is empty")
@@ -46,9 +46,8 @@ func NewPostgresProfileStore(dsn string) (*PostgresProfileStore, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("open postgres: %w", err) return nil, fmt.Errorf("open postgres: %w", err)
} }
if err := db.AutoMigrate(&profileRow{}); err != nil { // Note: AutoMigrate removed - schema managed by migration system
return nil, fmt.Errorf("migrate esim_profiles: %w", err) // Run `make db-migrate` to create/update database schema
}
return &PostgresProfileStore{db: db}, nil return &PostgresProfileStore{db: db}, nil
} }