Skip to content

Conversation

@Denes-cilwal
Copy link
Contributor

This pull request migrates the codebase from MySQL to PostgreSQL, refactors environment variable usage, and updates related configuration, infrastructure, and dependency files. The changes ensure compatibility with PostgreSQL, improve environment config structure, and update Docker and migration tooling accordingly.

Database Migration and Configuration Updates:

  • Migrated from MySQL to PostgreSQL across the codebase, including .env.example, docker-compose.yml, atlas.hcl, and migration files. Updated environment variables and connection ports to match PostgreSQL conventions. [1] [2] [3] [4] [5] [6]
  • Refactored pkg/infrastructure/db.go to use PostgreSQL driver, add validation for database names, and implement logic for creating/checking the target database in PostgreSQL. The database connection setup now uses gorm.io/driver/postgres.

Dependency and Tooling Updates:

  • Updated Go dependencies in go.mod to use gorm.io/driver/postgres instead of MySQL, removed direct MySQL driver dependency, and adjusted indirect dependencies accordingly. [1] [2] [3] [4]
  • Updated migration tooling in Makefile to use PostgreSQL connection strings and Atlas migration commands compatible with PostgreSQL.

Environment and Configuration Refactoring:

  • Refactored pkg/framework/env.go to group environment variables into structured config types (ServerConfig, DatabaseConfig, SentryConfig, AWSConfig, AdminConfig), and updated usage throughout the codebase for improved clarity and maintainability. [1] [2] [3] [4]

Codebase Adjustments for PostgreSQL:

  • Updated model definitions and removed MySQL-specific fields and logic (e.g., UUID field and its BeforeCreate hook in domain/models/user.go). [1] [2]
  • Updated repository and service constructors to use pointer types for the new database struct. [1] [2]

Docker and Service Orchestration:

  • Replaced MySQL service with PostgreSQL in docker-compose.yml, updated health checks, and adjusted service dependencies and networks. Updated Adminer configuration for PostgreSQL. [1] [2]

References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21]

projectmap and others added 22 commits November 8, 2024 11:12
[WIP] Update database provider interface based on feedback
[WIP] Update implementation based on feedback for database provider interface
…-one

[WIP] Address feedback on database provider interface implementation
…-one

[WIP] Address feedback on database provider interface implementation

// User model
type User struct {
gorm.Model
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Denes-cilwal Let's use uuid as PK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants