Skip to content

Database migration part 2 #34

@Jaden51

Description

@Jaden51

Description

After the database is migrated with no data in it, we need a way to move the data into the new one. The goal for this is to write a migration script that:

  1. Copies gamer_profile records adjusting columns as
    • Generate UUIDs for the new id column
    • Compute membership_expiry_date for each record based on membership_tier (using echo-base's tier logic: next May 1st Pacific time)
    • Map all existing columns (student_number, first_name, last_name, membership_tier, banned, notes, created_at)
  2. Copies gamer_activity records from testdb.live.gamer_activity to echobase.public.gamer_activity
    • Generate UUIDs for the new id column
    • Map all columns (student_number, pc_number, game, started_at, ended_at, exec_name)

Key considerations:

  • The live schema uses student_number as the PK for gamer_profile; echo-base adds a UUID id as PK while keeping student_number as a unique constraint. This is compatible.
  • The live schema has no membership_expiry_date column; echo-base does. You need to compute this during migration.
  • Verify foreign key integrity: every student_number in gamer_activity must exist in gamer_profile.

Validate the data after you are done.

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