Sobes.tech
Senior

How did the migration happen? Who did you do it with? How exactly?

sobes.tech AI

Answer from AI

Migration occurred as part of transitioning from one database version to another, as well as during the transfer of some functionality to a new service. The following were involved:

  • Backend development team,
  • DBA,
  • DevOps engineers.

Main steps of migration:

  1. Preparing migration scripts for schema and data using migration tools (e.g., golang-migrate).
  2. Testing migration in a staging environment.
  3. Coordinating with the DevOps team to plan downtime or use blue-green deployment.
  4. Running migration in production with monitoring.

Example of using golang-migrate:

import (
    "github.com/golang-migrate/migrate/v4"
    _ "github.com/golang-migrate/migrate/v4/database/postgres"
    _ "github.com/golang-migrate/migrate/v4/source/file"
)

func migrateDB() error {
    m, err := migrate.New(
        "file://migrations",
        "postgres://user:password@localhost:5432/dbname?sslmode=disable",
    )
    if err != nil {
        return err
    }
    err = m.Up()
    if err != nil && err != migrate.ErrNoChange {
        return err
    }
    return nil
}

Thus, the migration was carefully planned and executed with minimal risks.

How did the migration happen? Who did you do it with… - sobes.tech