Skip to content

Database migration part 1 #33

@Jaden51

Description

@Jaden51

Description

This is the most critical phase. The goal is to move the production data from the manually-managed live schema into echo-base's migration-managed public schema on the same EC2 instance, same PostgreSQL installation.

Step 1: Back Up the Production Database

Keep this backup somewhere and test restoring it to a local postgres to verify it's valid.

Step 2: Create a New Database for Echo-Base

We have a couple options here.

  1. Rather than modifying the existing database and applying the migrations there, we could create a separate database. This way the old one is untouched and you can roll back by just pointing back to the old one.
  2. As we do in the dev environment right now, we spin up a postgres container instead of having it live directly on the instance and expose the port for the echo-base container to use.

Step 3: Run Echo-Base Migrations on the New Database

Point EB_DSN at the new database and run sql-migrate up -env=production

This creates the gamer_profile, gamer_activity, and application tables as needed. Another way to do this is to create a new table called migrations and "fake" a migration by putting the first one in database.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions